One Star

XPath query

Hi,
I have to read an xml file which is in below format.

I want to read the file using the tFileInputXML step. I want to extract all the contents coming under the <student_details></student_details> tags and print it in next tLogRow step.
In the above file the <student_details></student_details> tag is present 5 times. but the number of times, the <student_details></student_details> tag is present is not constant.it will vary. so i don't know what to give in the XPath query to extract all the <student_details></student_details> tags irrespective how many times its present.

please help.
thanks,
jayanth
2 REPLIES
One Star

Re: XPath query

is it a java project? If so it doesnt matter it will automatically take in every entry of student details in the file, like such:

"/student_details"
then the mapping will look like:
yourcolumnName student_name
yourothercolumnName student_class
etc
etc
its all about where you place the LoopXpath Query, thats the field that tells talend to loop on the given xml element
Employee

Re: XPath query

is it a java project? If so it doesnt matter it will automatically take in every entry of student details in the file, like such:

Of course, it also works perfectly with a Perl project :-)