Four Stars

XML with several loops

Hi everyone,

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

 

Basically

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

Tatiana

2 REPLIES
Twelve Stars

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.

Rilhia Solutions
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 .
Tatiana