[resolved] How to read recursive XML tags

Highlighted
One Star

[resolved] How to read recursive XML tags

Hi all,
i have a some XML like this:
<tasks>
<task id="1" name="Task1">
<task id="11" name="Task11" />
<task id="12" name="Task12" />
</task>
<task id="2" name="Task2" >
<task id="21" name="Task21"/>
</task>
</tasks>

and I need flat rows ID, Name from each task tag. How to define Loop XPath query for tFileInputXML component?

Accepted Solutions
Employee

Re: [resolved] How to read recursive XML tags

Loop xpath query should be : //task
it will retrieve all task element in the file
for column id xpath query would be : ./@id

All Replies
Employee

Re: [resolved] How to read recursive XML tags

Loop xpath query should be : //task
it will retrieve all task element in the file
for column id xpath query would be : ./@id
One Star

Re: [resolved] How to read recursive XML tags

YES!!! ... That's it. Thx vm.
One Star

Re: [resolved] How to read recursive XML tags

<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>


This is my xml file and when i am reading this file i am only getting output 2 time but the same value as the first row printed twice
my loopxpath query is /bookstore/book
One Star

Re: [resolved] How to read recursive XML tags

So can anyoen help to resolve this bug
One Star

Re: [resolved] How to read recursive XML tags

I have been breaking my head with the same problem Smiley Sad
One Star

Re: [resolved] How to read recursive XML tags

Hi,
Make sure there is not a UTF-8 signature (BOM) on the XML file which can cause weird behavior in Talend.
See http://www.w3.org/International/questions/qa-utf8-bom for additional information.
Best,
-Randall

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog