This recipe shows how we can convert an XML record stored in a file into a format that is readable by tXMLMap
, and how we can then read and process the data in the XML record.
The first stage of this process is to convert the XML file into Java Document format for use by the downstream component.
Edit the schema and add a column named payload. Make it a type of Document, as shown in the screenshot:
Open the
tFileInputXML
component and change the File name/Stream field tocontext.cookbookData+"/chapter9/chapter09_jo_0010_customerData.xml"
.Change the Loop Xpath query field to
"/"
.Your
tFileInputXML
should look like the one shown in the next screenshot:Reading using tXMLMap
Add a
tXMLMap
component to the canvas and link to thetFileInputXML
component.Open the
tXMLMap
component and right-click on payload...