You can now decompose documents that contain non-unique attributes or non-unique 4element names that map to different columns (of the same or different tables) 4without receiving the DXXQ045E error. The following is an example of an XML 4document with non-unique attributes and non-unique element names:
4<Order ID="0001-6789"> 4 <!-- Note: attribute name ID is non-unique --> 4 <Customer ID="1111"> 4 <Name>John Smith</Name> 4 </Customer> 4 <!-- Note: element name Name is non_unique --> 4 <Salesperson ID="1234"> 4 <Name>Jane Doe</Name> 4 </Salesperson> 4 <OrderDetail> 4 <ItemNo>xxxx-xxxx</ItemNo> 4 <Quantity>2</Quantity> 4 <UnitPrice>12.50</UnitPrice> 4 </OrderDetail> 4 <OrderDetail> 4 <ItemNo>yyyy-yyyy</ItemNo> 4 <Quantity>4</Quantity> 4 <UnitPrice>24.99</UnitPrice> 4 </OrderDetail> 4</Order>
The accompanying DAD, which maps the duplicate elements and 4attributes to different columns, looks like this:
4<element_node name="Order"> 4 <RDB_node> 4 <table name="order_tab" key="order_id"/> 4 <table name="detail_tab"/> 4 <condition> 4 order_tab.order_id=detail_tab.order_id 4 </condition> 4 </RDB_node> 4 4 <!--attribute ID duplicated below, but mapped to a different col--> 4 <attribute_node name="ID"> 4 <RDB_node> 4 <table name="order_tab" /> 4 <column name="order_id" type="char(9)"/> 4 </RDB_node> 4 </attribute_node> 4 4 <element_node name="Customer"> 4 <!--attribute ID duplicated above, but mapped to a different col--> 4 <attribute_node name="ID"> 4 <RDB_node> 4 <table name="order_tab" /> 4 <column name="cust_id" type="integer"/> 4 </RDB_node> 4 </attribute_node> 4 4 <!--element name duplicated below, but mapped to a different col--> 4 <element_node name="Name"> 4 <text_node> 4 <RDB_node> 4 <table name="order_tab" /> 4 <column name="cust_name" type="char(20)" /> 4 </RDB_node> 4 </text_node> 4 </element_node> 4 </element_node> 4 4 <element_node name="Salesperson"> 4 <!--attribute ID duplicated above, but mapped to a different col--> 4 <attribute_node name="ID"> 4 <RDB_node> 4 <table name="order_tab" /> 4 <column name="salesp_id" type="integer"/> 4 </RDB_node> 4 </attribute_node> 4 4 <!--element name duplicated above, but mapped to a different col--> 4 <element_node name="Name"> 4 <text_node> 4 <RDB_node> 4 <table name="order_tab" /> 4 <column name="salesp_name" type="char(20)" /> 4 </RDB_node> 4 </text_node> 4 </element_node> 4 </element_node> 4 4 <element_node name="OrderDetail" multi_occurrence="YES"> 4 <element_node name="ItemNo"> 4 <text_node> 4 <RDB_node> 4 <table name="detail_tab" /> 4 <column name="itemno" type="char(9)"/> 4 </RDB_node> 4 </text_node> 4 </element_node> 4 <element_node name="Quantity"> 4 <text_node> 4 <RDB_node> 4 <table name="detail_tab" /> 4 <column name="quantity" type="integer"/> 4 </RDB_node> 4 </text_node> 4 </element_node> 4 <element_node name="UnitPrice"> 4 <text_node> 4 <RDB_node>detail_tab" /> 4 <table name="detail_tab" /> 4 <column name="unit_price" type="decimal(7,2)"/> 4 </RDB_node> 4 </text_node> 4 </element_node> 4 </element_node> 4</element_node>
The contents of the tables would look like the following 4sample after the preceding document is decomposed:
4ORDER _TAB: 4 4ORDER_ID CUST_ID CUST_NAME SALESP_ID SALESP_NAME 40001-6789 1111 John Smith 1234 Jane Doe 4 4DETAIL_TAB: 4 4ORDER_ID ITEMNO QUANTITY UNIT_PRICE 40001-6789 xxxx-xxxx 2 12.50 40001-6789 yyyy-yyyy 4 24.994 4