Table of Contents

Search

  1. Preface
  2. XML Concepts
  3. Using XML with PowerCenter
  4. Working with XML Sources
  5. Using the XML Editor
  6. Working with XML Targets
  7. XML Source Qualifier Transformation
  8. Midstream XML Transformations
  9. XML Datatype Reference
  10. XPath Query Functions Reference

XML Guide

XML Guide

XML Parser Transformation

XML Parser Transformation

When the Integration Service processes an XML Parser transformation, it reads a row of XML data, parses the XML, and returns data through output groups. The XML Parser transformation returns non-XML data in pass-through ports. You can parse XML messages from sources such as JMS or IBM WebSphere MQ . The XML Parser transformation is an active transformation.
The XML Parser transformation has one input group and one or more output groups. The input group has one input port, DataInput, which accepts an XML document in a string.
When you create an XML Parser transformation, use the XML Wizard to import an XML, DTD, or XML schema file. For example, you can import the following Employee DTD file:
<!ELEMENT EMPLOYEES (EMPLOYEE+)> <!ELEMENT EMPLOYEE (LASTNAME, FIRSTNAME, ADDRESS, PHONE+, EMAIL*,   EMPLOYMENT)>   <!ATTLIST EMPLOYEE EMPID CDATA #REQUIRED                        DEPTID CDATA #REQUIRED> <!ELEMENT LASTNAME (#PCDATA)> <!ELEMENT FIRSTNAME (#PCDATA)> <!ELEMENT ADDRESS (STREETADDRESS, CITY, STATE, ZIP)> <!ELEMENT STREETADDRESS (#PCDATA)> <!ELEMENT CITY (#PCDATA)> <!ELEMENT STATE (#PCDATA)> <!ELEMENT ZIP (#PCDATA)> <!ELEMENT PHONE (#PCDATA)> <!ELEMENT EMAIL (#PCDATA)> <!ELEMENT EMPLOYMENT (DATEOFHIRE, SALARY+)> <!ATTLIST EMPLOYMENT EMPLSTAT (PF|PP|TF|TP|O) "PF"> <!ELEMENT DATEOFHIRE (#PCDATA)> <!ELEMENT SALARY (#PCDATA)>
The XML Parser transformation shows the root view, X_Employees, with X_Employees shown as a parent of X_Employee. X_Employee is a parent of X_Salary, X_Phone, and X_Email.
The following figure shows the XML Parser transformation that the Designer creates if you choose to create entity relationships:
""
The Designer creates a root view, X_Employees. X_Employees is the parent of X_Employee. X_Employee is a parent of X_Salary, X_Phone, and X_Email.
Each view in the XML Parser transformation has at least one key to establish its relationship with another view. If you do not designate the keys in the XML Editor, the Designer creates the primary and foreign keys for each view. The keys are of datatype bigint. The keys are called generated keys because the Integration Service creates the key values each time it returns a row from the XML Parser transformation.
When the Designer creates a primary or foreign key column, it assigns a column name with a prefix. In an XML definition, the prefix is XPK_ for a generated primary key column and XFK_ for a generated foreign key column. A foreign key always refers to a primary key in another group. A generated foreign key column always refers to a generated primary key column.
For example, the group X_Employee has the XPK_Employee primary key. The Designer creates foreign key columns that connect the X_Phone, X_Email, and X_Salary to the X_Employee group. Each group has the foreign key column XFK_Employee.
The repository stores the key values. You cannot change the values in the repository, but you can choose to reset or restart the sequence numbers after a session.

0 COMMENTS

We’d like to hear from you!