XML-Input with multiple xpath loop

Five Stars

XML-Input with multiple xpath loop

Hi, 

i have to read from a XML-file with more than one "Main" Loop.

positions.JPG

One is Positions with 3 rows, Ordernumber 100,101,102 and the other is Foot with to Charge , 1 and 2

My Problem is when i set the absolute xpath to Positions i get all porsitions but only the first Charge.

If i set it to charges i get the two Charge but only the first Position.

xpath.JPG

 

Is it possible to get it both and the write it to a similar XML as the Input file?


Accepted Solutions
Community Manager

Re: XML-Input with multiple xpath loop

OK, to start I should say that this can be painful. It is not pleasant to work with XML like this with any product. However Talend does have the Talend Data Mapper in the Enterprise Edition. If you have that, use it. It isn't like ANY of the other Talend components, can be a real pain to find documentation, but once you get used to it, it really does help. If you are using the Open Source product, you are left with using multiple tExtractXMLField components. I gave an explanation as to how to do this here (https://community.talend.com/t5/Design-and-Development/Complex-XML-with-multiple-loops-into-one-outp...). At some point I will put together a mini tutorial, but you will learn a lot if you try this out yourself from the description I have given. As I said, it is not pretty, but once you get to grips with it, it isn't so hard.


All Replies
Community Manager

Re: XML-Input with multiple xpath loop

OK, to start I should say that this can be painful. It is not pleasant to work with XML like this with any product. However Talend does have the Talend Data Mapper in the Enterprise Edition. If you have that, use it. It isn't like ANY of the other Talend components, can be a real pain to find documentation, but once you get used to it, it really does help. If you are using the Open Source product, you are left with using multiple tExtractXMLField components. I gave an explanation as to how to do this here (https://community.talend.com/t5/Design-and-Development/Complex-XML-with-multiple-loops-into-one-outp...). At some point I will put together a mini tutorial, but you will learn a lot if you try this out yourself from the description I have given. As I said, it is not pretty, but once you get to grips with it, it isn't so hard.

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog