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

Generating Hierarchy Relationship Rows

Generating Hierarchy Relationship Rows

By default, the Integration Service creates rows for all views with data in the view row. Select Hierarchy Relationship Row to generate a row for a child view if the parent view has corresponding data in a hierarchy relationship. The parent view must have data to generate a row for the child view.
For example, an XML definition might have a hierarchy consisting of an Employee view and an Address view. Employee is the parent view. The address data can include Employee\Addresses or Store\Addresses. You can choose to output Employee\Address.
The following XML file has an Address within the Store element and an Address within the Employee element:
<?xml version=”1.0” encoding=”UTF-8”?> <!DOCTYPE STORE > <STORE SID=”BE1752”>   <SNAME>Mud and Sawdust Furniture Store</SNAME>   
<ADDRESS>
    <STREETADDRESS>335 Westshore Road</STREETADDRESS>     <CITY>Fausta City</CITY>     <STATE>CA</STATE>     <ZIP>97584</ZIP>   </ADDRESS>   <EMPLOYEE DEPID=”34”>     <ENAME>       <LASTNAME>Bacon</LASTNAME>       <FIRSTNAME>Allyn</FIRSTNAME>     </ENAME>   
<ADDRESS>
    <STREETADDRESS>1000 Seaport Blvd</STREETADDRESS>     <CITY>Redwood City</CITY>     <STATE>CA</STATE>     <ZIP>94063</ZIP>   </ADDRESS>  <EPHONE>(408)226-7415</EPHONE>  <EPHONE>(650)687-6831</EPHONE> </EMPLOYEE> </STORE>
The following figure shows a hierarchical relationship between the Employee view and the Address view:
The Employee view is connected to the Address view with a blue line that defines a one-to-one relationship between the parent and the child view. The Employee view has a primary key, XPK_Employee, and an Employee element consisting of LastName and FirstName. The Address view has a foreign key, FK_Employee, and an Address element that consists of StreetAddress, City, State, and Zip.
By default, the Integration Service generates a row for each occurrence of the Address element. The Integration Service generates one row for the Store\Address and another for Employee\Address.
The following figure shows the Address XML data if you clear the Hierarchy Relationship Row option:
The Address XML data contains two rows and the columns STREETADDRESS, FK_EMPLOYEE, CITY, STATE, and ZIP. It contains two rows of data. The Hierarchy Relationship Row option is not selected.
When you select the Hierarchy Relationship Row option, the Integration Service generates rows in a session as follows:
  • The Integration Service generates a row for the Address view when the Employee view has corresponding data in a session.
  • The Integration Service generates a row representing the Employee\Address hierarchy relationship.
  • The Integration Service does not generate a row for Store\Address.
The following shows the Address data if you select the Hierarchy Relationship Row option:
The Address XML data contains three rows and the columns STREETADDRESS, FK_EMPLOYEE, CITY, STATE, and ZIP. It contains two rows of data. The Hierarchy Relationship Row option is selected.

0 COMMENTS

We’d like to hear from you!