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