Combine Node Wizard: Set Combined Node

Set Combined Node>Set Combine Keys>Eliminate Duplicate Child Nodes>Select Child Nodes to Group
 

 This wizard helps you define the structure of your XML output or input. The wizard settings are used in marshalling data to XML to determine the organization of the XML output. When unmarshalling, the wizard settings are used to interpret the structure of the XML input and expand it into database records correctly. The steps are:

 

Set Combined Node (This step)

Marshalling/
Unmarshalling

For marshalling, set the XML node to combine so that the output file contains only one occurrence of the node and all sub-nodes are aggregated under that node. Click Finish to exit the wizard and use default values for the remaining screen or continue to Set Combine Keys screen

For unmarshalling, set the XML node to expand so that each record contains the node. Click Finish to exit the wizard.

(Optional) Set Combine Keys

Marshalling only

Select the set of nodes to use in identifying duplicate nodes to combine.

(Optional) Eliminate Duplicate Children

Marshalling only

Determine if nodes, after combining, should only occur once in the output file.

(Optional) Select Child Nodes to Group

Marshalling only

Choose which child nodes of a combined node to order together in the XML output file.

 

Example: XML Output When Marshalling

When marshalling relational data to XML, you can use the wizard to remove duplicate occurrences of a node and aggregate sub-nodes under the remaining node in your XML output. This typically gives you a more standard-looking XML document. For example, where the XML output consists of order elements and line item elements, you usually want line item elements for a specific order to be grouped under the order, without repeating the order element for each line item.

Here's an example that shows default XML output, with no combined nodes:

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Leather chair</Item>
</Order>

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Computer Table</Item>
</Order>

If you set <Order> as a combined node, <Item> elements are grouped together under the <Order> element:

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Leather chair</Item>
    <Customer>John Smith</Customer>
    <Item>Computer Table</Item>
</Order>

You can also remove duplicate sub-nodes, in this case <Customer>John Smith</Customer> using the Eliminate Duplicates option in Step 3 of this wizard.

Example: XML Input When Unmarshalling

When unmarshalling an XML document to a relational database, the XML input document might contain multiple XML nodes aggregated under a super-node. In the example below, an <Order> element has two <Item> sub-elements.

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Leather chair</Item>
    <Item>Computer Table</Item>
</Order>

When inserting this data in the database, you typically expect to see two records, one for each line item. To achieve this result, you need to set the combine feature on the <Order> element. When unmarshalling, the combine feature in this wizard works in conjunction with the setting Expand XML Nodes Method in the  Unmarshal Settings dialog.

The effects of setting <Order> as a combined node and setting Expand XML Nodes Method to One-To-Many Association in the Unmarshal Settings dialog are:

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Leather chair</Item>
</Order>

<Order ID =”1”>
    <Customer>null</Customer>
    <Item>Computer Table</Item>
</Order>

The effects of setting <Order> as a combined node and setting Expand XML Nodes Method to Many-To-Many Association in the Unmarshal Settings dialog are:

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Leather chair</Item>
</Order>

<Order ID =”1”>
    <Customer>John Smith</Customer>
    <Item>Computer Table</Item>
</Order>

See Also

XML Structure Tab
Introduction to Combining Nodes in XML Output when Marshalling

Combining Duplicate Elements in XML Output

Customizing Combine Settings for XML Output

Handling Nested XML Elements when Unmarshalling

Unmarshal Settings dialog