XML with several loops

Four Stars

XML with several loops

Hi everyone,

I need help to develop a job that generates a multi-loops XML.



the "decla" tag is repeated several times (loop) and contains the output 3 others loop-tags : "souscripteur", "assure" and "beneficiaire" (in yellow here after)

xml structure.PNG


All the Talend Components support only one definited loop.

How can i do to obtain that structure ?


Thanks a lot for your answers


Best regards


Community Manager

Re: XML with several loops

There are several ways to do this....

1) Use the Talend Data Mapper. But that is only available to the Enterprise Edition users....and is a bit funky if you are using it for the first time.
2) Use a bit of Java. Unfortunately the tXMLMap just won't cover this requirement on its own. But what you can do is create your base XML structure using a tXMLMap and then add to it using some Java (....my favourite approach). 

3) Similar to the last approach, but instead of writing Java code to manipulate and add to DOM objects, you build your base XML structure and then build your sub-XML structures (your loops), convert everything to Strings and then carry out a find and replace to build up your final XML structure.

To be honest, they are all quite tricky at first. But once you figure out the structure and the method, it is actually quite methodical.

Four Stars

Re: XML with several loops

Hello Rhall.
Thanks for solutions. The first one would not be possible because i have to stay in a data integration context.
So i'll try the second one on mondey and leave a message in any case.
Thanks Again for your help .

What’s New for Talend Spring ’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


How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration


Downloads and Trials

Test drive Talend's enterprise products.