Example 1: Marshal Without Combine

This table displays four XML output records retrieved from the database  according to the instructions in the sample project mapping file. For this example, the mapping file includes a predicate to retrieve only records that have an OrderID value of 1. The marshal operation retrieves four records with an OrderID value of 1. No combine or sort settings have been applied to nodes in the XML output file. Differences between records are displayed in bold text.

 

Record 1

<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>
<PaymentTerms>0</PaymentTerms>
</PurchaseOrder>

Record 2

<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="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>

<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>
<PaymentTerms>0</PaymentTerms>
</PurchaseOrder>

 

Record 3

<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="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>

<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>
<PaymentTerms>0</PaymentTerms>
</PurchaseOrder>

 

Record 4

<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="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>
<PaymentTerms>0</PaymentTerms>
</PurchaseOrder>

Examples

1.

Marshal Without Combine

This page

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

 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