You probably want XML output from marshalling operations to appear in a nested format in the following situations:
When a single schema element has many sub-elements (children) or sub-sub-elements (grandchildren) of the same type, as in the example below where single Orders element can have one or more Item_Detail sub-elements.
When the database tables you are using have one-to-many relations (1:M) between tables to capture situations where one object is related to one or more occurrences of another object. For example, an order consists of one or more line items. Typically, XML documents represent relationships like these by creating an element that can have one or more sub-elements. For example, an Orders element might have one or more Item sub-elements. In a database, there would be an Orders table and an Items table where each Item record has a field identifying its Order ID (foreign key).
<Orders ID="10643" Date="9/25/1995"
CustomerID="ALFKI">
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>46</ID_Product>
<Product>Spegesild</Product>
<UnitPrice>12</UnitPrice>
<Quantity>2</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>39</ID_Product>
<Product>Chartreuse verte</Product>
<UnitPrice>18</UnitPrice>
<Quantity>21</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>28</ID_Product>
<Product>Rössle Sauerkraut</Product>
<UnitPrice>45.6</UnitPrice>
<Quantity>15</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
</Orders>
The XML Structure tab in the Mapper allows you to define how you want your XML output to appear.
By default, the Combine property is not set because of the potential increase in memory usage for large XML documents. XML output looks as follows when the Combine property is not set:
<Orders ID="10643" Date="9/25/1995"
CustomerID="ALFKI">
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>46</ID_Product>
<Product>Spegesild</Product>
<UnitPrice>12</UnitPrice>
<Quantity>2</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
</Orders>
<Orders ID="10643" Date="9/25/1995" CustomerID="ALFKI">
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>39</ID_Product>
<Product>Chartreuse verte</Product>
<UnitPrice>18</UnitPrice>
<Quantity>21</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
</Orders>
<Orders ID="10643" Date="9/25/1995" CustomerID="ALFKI">
<Item_Detail>
<ID_Order>10643</ID_Order>
<ID_Product>28</ID_Product>
<Product>Rössle Sauerkraut</Product>
<UnitPrice>45.6</UnitPrice>
<Quantity>15</Quantity>
<Discount>0.25</Discount>
</Item_Detail>
</Orders>
Setting
Up Nested XML Elements for Marshalling
Combine Node Wizard
Combining Duplicate Elements in XML Output
Customizing Combine Settings for XML Output
Sample Marshal with Combine Project