XPath concat multiple nodes

One Star

XPath concat multiple nodes

I have the following xml as source.I need to concate the subEl1 and subEl2.

<item>
<element1>el1</element1>
<element2>el2</element2>
<element3>el3</element3>
<element4>
<subEl1>subel1a</subEl1>
<subEl2>subel2a</subEl2>
</element4>
<element4>
<subEl1>subel1b</subEl1>
<subEl2>subel2b</subEl2>
</element4>
</item>
The output should be "subel1a subel2a"
Community Manager

Re: XPath concat multiple nodes

Hi
Use a tFileInputXml to extract the records from the xml file and concate the two columns into one column on tMap, please see my screenshots.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: XPath concat multiple nodes

Thanks Shong.There are some case where the sub element occurence is more than two or in some with one.What will i do in this scenario?
<item>
<element1>el1</element1>
<element2>el2</element2>
<element3>el3</element3>
<element4>
<subEl1>subel1a</subEl1>
<subEl2>subel2a</subEl2>
<subEl3>subel3a</subEl3>
</element4>
<element4>
<subEl1>subel1b</subEl1>
<subEl2>subel2b</subEl2>
</element4>
<element4>
<subEl1>subel1b</subEl1>
</element4>
</item>
Community Manager

Re: XPath concat multiple nodes

Hi
You should extract all the fields from the xml file, that means you always extract the max number of fields, maybe some of fields could be empty in output because the element occurence is more than two or in some with one.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

Calling Talend Open Studio Users

The first 100 community members completing the Open Studio survey win a $10 gift voucher.

Start the survey

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

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog