Reading complex hierarchical XML
The first two recipes show how tXMLMap
can be used to map between XML formats visually, much like the tMap
component; however, it can become overly complex and difficult to manage when there are multiple levels of hierarchy and multiple loops within the XML. This recipe shows how we can deconstruct a more complex XML record into individual sets of data while ensuring that the hierarchical relationships between the data are not lost.
Getting ready
Open the job jo_cook_ch09_0040_readComplexXML
file. If
you
view the input file chapter09_jo_0040_orderDate.xml
, you will see that we have a hierarchy of customer that has many orders, and orders have many items.
How to do it...
First, we will create a customer schema using the XML schema wizard.
In the metadata panel under File XML | Chapter 09 right-click and select the option Create file xml.
Name the XML file
sc_cook_ch9_0040_XMLorderDataCustomer
.Select Input XML, then click on Next.
Click on Browser to select the XML...