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

Hello
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
/root/body/data/invoice
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
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.

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.