Talend's FileInputXML and Xpath 2.0

One Star

Talend's FileInputXML and Xpath 2.0

Hey folks,
I'm trying to parse a xml input file via the FileInputXML component. However, my Xpath 2.0 expression (tested in XMLSpy) will not work in Talend:
- The xpath is as follows in XML Spy:
(if(exists(//data/invoice)) then (//data/invoice) else (//data/invoice))
- The xpath is as follows in Talend (escaped cause its a String in Talend):
"(if(exists(//data/invoice)) then (//data/invoice) else (//data/invoice))"
The exception I get indicates (imho) a mismatch between the component and xpath 2.0. So my question is a) does de component actually support xpath 2.0 and b1) if not, is there a viable alternative or b2) it does, what am I doing wrong?
I've added 2 example input xml files and the expected result in pseudo xml to indicate what I'm trying to achieve:
- In the non YK file there are multiple invoice elements, none of them with an object-id that starts with YK. So I expect Talend to loop over each invoice element.
- In the YK file there are also multiple invoice elements, but one of them has an object-id that starts with YK. So I expect Talend to only that specific invoice element.
The Talend exception: javax.xml.transform.TransformerException: Could not find function: if
at com.sun.org.apache.xpath.internal.compiler.XPathParser.error
I hope I explained it enough and thanks in advance for the help.
Regards Roel
Community Manager

Re: Talend's FileInputXML and Xpath 2.0

Talend doesn't support a xpath as you set, for now, you can set the xpath as below, extract all the records and filter the records on tMap
Best regards

Talend | Data Agility for Modern Business
One Star

Re: Talend's FileInputXML and Xpath 2.0

Maybe you can request for this feature in the bug tracker, it would need to use the library saxon (for instance) for parsing.


Talend named a Leader.

Get your copy


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


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration


Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.