Example 2: Marshal with Combine

The following settings have been applied to the sample project whose output was described in 1: Marshal Without Combine.

The table below displays a single XML output record instead of the four records in The following settings have been applied to the sample project whose output was described in 1: Marshal Without Combine. The four records have been combined into a single record with multiple LineItem elements.  However, note that the XML output still contains a number of repeated elements: Customer, OrderDate, RequiredDate, ShipDate and so on. By modifying settings in the XML Structure tab, you can remove duplicate elements in the XML output file.

 

 <xml>
<PurchaseOrder OrderID="1">
<Customer>
<Company>Berman</Company>
<Address street="85 Walk Ave" city="Los Angeles" state="CA" zip="78554" country="USA" />
<Contact name="John Mena" title="Mr." phone="(882) 452 5568" mobile="(882) 123 5688" />
</Customer>
<SalesRepresentative Name="JEAN Holtzman"  Phone="(558) 899-5899" />
<LineItem Quantity="10" UnitPrice="225.80" Discount="0" Total="2258.00">
<Product>
   <Name>tall vertical file</Name>
   <UnitsInStock>35</UnitsInStock>
   <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
   <Category Name="Filing Cabinet" Description="Lateral and vertical filing cabinets" />
</Product>
</LineItem>
<OrderDate>2002-12-06T00:00:00.0</OrderDate>
<RequiredDate>2002-12-20T00:00:00.0</RequiredDate>
<ShipDate>2002-12-15T00:00:00.0</ShipDate>
<Taxrate>0.0000</Taxrate>
<SubTotal>27852.95</SubTotal>
<TotalAmount>27852.95</TotalAmount>
<Terms>0</Terms>
<LineItem Quantity="50" UnitPrice="365.50" Discount="0" Total="18275.00">
<Product>
   <Name>side chair</Name>
   <UnitsInStock>11</UnitsInStock>
   <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
   <Category Name="Chair" Description="Office chairs" />
</Product>
</LineItem>
<LineItem Quantity="8" UnitPrice="290.00" Discount="0" Total="2320.00">
<Product>
   <Name>tall bookshelf</Name>
   <UnitsInStock>19</UnitsInStock>
   <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
   <Category Name="Shelving" Description="Bookshelves and storage shelves" />
</Product>
</LineItem>
<LineItem Quantity="5" UnitPrice="999.99" Discount="0" Total="4999.95">
<Product>
   <Name>conference table</Name>
   <UnitsInStock>32</UnitsInStock>
   <InventoryDate>2002-09-20T00:00:00.0</InventoryDate>
   <Category Name="Desk" Description="Workstations and executive desks" />
</Product>
</LineItem>
</PurchaseOrder>
</xml>

Examples

1.

Marshal Without Combine

No settings have been made in the XML Structure tab

2.

Marshal with Combine

This page.

3.

Marshal with Combine and Group

 XML output groups  all matching elements (LineItem) together

4.

 

Marshal with Combine and Order By

XML output contains records retrieved from the database using an ORDER BY clause

5.

Marshal with Optimized Combine

XML output generated using the Optimized Combine feature in the XML Structure tab.

See Also

Marshal with Combine Project
XML Structure Tab

Introduction to Combining Nodes in XML Output when Marshalling

Combining Duplicate Elements in XML Output

Customizing Combine Settings for XML Output