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?
1 ACCEPTED SOLUTION

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
6 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