Skip to Content

Flat to Hierarchical Output

Sample 3 Target Document Structure

The target document structure for this flat-to-hierarchical transformation is an XML document. The following data represents the desired result of this sample transformation.

<?xml version="1.0"?>

<inventory>

<snapshotinfo>

<snapshotdate>2/1/2001</snapshotdate>

<snapshotuser>manager1</snapshotuser>

<snapshotsource>batchjob</snapshotsource>

</snapshotinfo>

<warehouse>

<warehousecode>WH123</warehousecode>

<warehousestate>WA</warehousestate>

</warehouse>

<warehouse>

<warehousecode>WH456</warehousecode>

<warehousestate>TX</warehousestate>

</warehouse>

<warehouse>

<warehousecode>WH789</warehousecode>

<warehousestate>CA</warehousestate>

</warehouse>

<instockitem>

<itemnumber>ABC-123</itemnumber>

<attribute>

<attributecode>COLOR</attributecode>

<attributevalue>BLUE</attributevalue>

</attribute>

<attribute>

<attributecode>WEIGHT</attributecode>

<attributevalue>13</attributevalue>

</attribute>

<attribute>

<attributecode>COST</attributecode>

<attributevalue>450.00</attributevalue>

</attribute>

<instockat>

<whcode>WH123</whcode>

<quantity>450</quantity>

</instockat>

<instockat>

<whcode>WH456</whcode>

<quantity>210</quantity>

</instockat>

</instockitem>

<instockitem>

<itemnumber>ABC-456</itemnumber>

<itemquantity>210</itemquantity>

<attribute>

<attributecode>COLOR</attributecode>

<attributevalue>GREEN</attributevalue>

</attribute>

<attribute>

<attributecode>WEIGHT</attributecode>

<attributevalue>5</attributevalue>

</attribute>

<attribute>

<attributecode>COST</attributecode>

<attributevalue>525.00</attributevalue>

</attribute>

<instockat>

<whcode>WH123</whcode>

<quantity>75</quantity>

</instockat>

<instockat>

<whcode>WH789</whcode>

<quantity>250</quantity>

</instockat>

</instockitem>

<instockitem>

<itemnumber>DEF-456</itemnumber>

<itemquantity>75</itemquantity>

<attribute>

<attributecode>LENGTH</attributecode>

<attributevalue>72</attributevalue>

</attribute>

<attribute>

<attributecode>WEIGHT</attributecode>

<attributevalue>23</attributevalue>

</attribute>

<attribute>

<attributecode>COST</attributecode>

<attributevalue>1250.00</attributevalue>

</attribute>

<instockat>

<whcode>WH123</whcode>

<quantity>60</quantity>

</instockat>

<instockat>

<whcode>WH456</whcode>

<quantity>50</quantity>

</instockat>

<instockat>

<whcode>WH789</whcode>

<quantity>40</quantity>

</instockat>

</instockitem>

</inventory>