Example 3: Marshal with Combine and Group

In Marshal with Combine Output (2), duplicate elements have been eliminated from the XML output, but elements of the same type are not grouped together. By modifying settings in the XML Structure tab, you can group the LineItem elements together in the output file for the sample project.

 

 <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>
<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>
<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>
</PurchaseOrder>
</xml>

Examples

1.

Marshal Without Combine

No settings have been made in the XML Structure tab

2.

Marshal with Combine

XML output combines all PurchaseOrder nodes that have a matching value for the OrderID node.

3.

Marshal with Combine and Group

 This page.

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