Using tXMLMap to read XML

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.

Getting ready

Open the job jo_cook_ch09_0010_readXMLFile.

How to do it...

The first stage of this process is to convert the XML file into Java Document format for use by the downstream component.

  1. Drag a tFileInputXML component onto the canvas.
  2. Edit the schema and add a column named payload. Make it a type of Document, as shown in the screenshot:
    How to do it...
  3. Open the tFileInputXML component and change the File name/Stream field to context.cookbookData+"/chapter9/chapter09_jo_0010_customerData.xml" ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.