XPath in XMLMap

Five Stars aoh
Five Stars

XPath in XMLMap

Hello,
I'm trying to get an XPath-Query working in a XML-Map. But I got some problems with it.
The XML is from a webservice an I need the XML as it is, just with some additional data. It is an invoice with several lines. I need to add the total.
An option would be an tExtractXMLField with tAggregateRow, then put the value on the global map an read the xml-document an the total after FlowToIterate.
Is there an easier option?

The best solution would be to get the total with an XPath-Query in the XML-Map.

A simlyfied example is this one:
XML-Structure:
<invoice>
<line>
<nr>1</nr>
<amount>100</amount>
</line>
<line>
<nr>2</nr>
<amount>100</amount>
</line>
</invoice>

When I read the XML from a file and put the XPath in tFileInputXML it works.
When I read the XML as a node an put the XPath in an XMLMap (what I want for the webservice) it stops with an error (method not defined).
Is there a way to get XPath working in tXMLMap?
Employee

Re: XPath in XMLMap

Hi aoh,
Please refer to my attachment solution.png.
First you can use tConvertType component convert you output String type to what you want to (like Integer,Double and so on ).
And then pass the value to another tXMLMap component.

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

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download