How to Read XML File using tFileInputXML component - Not Reading data properly

Four Stars

How to Read XML File using tFileInputXML component - Not Reading data properly

Hi All,

I need to read the XML data using tFileInputXml Component. But, I am not getting how to give Xpath queries.

Here is the tag tree of my data. 

<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<th scope="col">ColumnName1</th>
<th scope="col">ColumnName2</th>
<th scope="col">ColumnName3</th>
<th...remaining header tags</th>
</tr>
<tr>
<td>ABCDEFGH ENERGIA LTDA.</td>
<td>APPROVED</td>
<td>IVY XYZ</td>
<td>6097</td>
<td .. remainig td's></td>
</tr>
</table>
</p>

Please suggest me how to fill in the columns for the xml component. I did try it as in the below screenshot and other ways also. But data is not aligned in expected rows and columns (It is reading only first td for each row).

readXMLData.PNG

I am new to Talend. So please help me out in this. 

Thanks in advance.

Eight Stars

Re: How to Read XML File using tFileInputXML component - Not Reading data properly

Hi @JeevithaS 

 

Your XML contains multiple loops under a parent which is not possible to read through tFileInputXML.

 

Hence you have to use tXMLMap or Talend Data Mapper.

 

Please follow the job flow as attached and let us know if it is serving your requirement.

 

Make sure you save the input to a file then remove all the new lines as Document type will read total data as one line. In tXMLMap you can define two loops for header and detail and you can mention same in tXMLMap Source Loop Tree.

 

XML_6.JPGXML_5.JPGXML_4.JPGXML_3.JPGXML_2.JPGXML_1.JPG

 

Thanks and Regards,

Subhadip

Four Stars

Re: How to Read XML File using tFileInputXML component - Not Reading data properly

Hi @subhadip13 ,

 

Thanks for your response.

I tried in your way. But The Data is not getting aligned in the proper way when i am trying to insert in Excel file. Same as before, each data is storing as single row. I need to transpose the data as one complete tr loop should be stored as one row in excel file with each td value as cell value for that row. 

 

I need to loop tr node and each td value inside the tr node should be mapped to different column names which we will define as schema for output component. I hope you got it.

 

Anyway, I am able to pull the data using tHttpTableInput. Thank you so much for your effort Smiley Happy 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog