export to xml with multiple loops

Six Stars

export to xml with multiple loops

I am trying to extract data from database to a xml file. There are multiple loops inside xml document. it is like below. I created a metadata based on the output xml file format. I am thinking I could use tAdvancedFileOutputXML. But I don't know how to map the data from database to the xml loops. Shall I split each loop to a small part, then map it from db to xml first? Then add all these small part together to a big file?
I appreciate if anybody could give me any idea on this. Thanks.

<root>
<Header>
<MessageId></MessageId>
</Header>
<contactinfo>
<contactHeader>
<contactId></contactId>
</contactHeader>
<contactAddress>
<name></name>
<phone></phone>
</contactAddress>

<contactAddress>
<name></name>
<phone></phone>
</contactAddress>

</contactinfo>
<contactinfo>
<contactHeader>
<contactId></contactId>
</contactHeader>
<contactAddress>
<name></name>
<phone></phone>
</contactAddress>

<contactAddress>
<name></name>
<phone></phone>
</contactAddress>

</contactinfo>
</root>
Moderator

Re: export to xml with multiple loops

Hi,
I think the component tXMLMap can meet your needs(multiple loops), please review the component reference and related scenarios at first, and then feel free post your issue on forum.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: export to xml with multiple loops

Thanks for the document.
I looked through it. The examples are all input file is the xml file. My case is the output file is XML file.
When I use tXmlmap, my input is database, out put is tAdvancedFileOutputXML. I couldn't see the tree in tXmlMap.
Do you have any example for tXmlMap with output is xml file?
Thanks.
Moderator

Re: export to xml with multiple loops

Hi,
I think you should be familiar with the component tXMLMap firstly , there is the article about tXMLMap operation with three chapters Using the document type to create the XML tree, Defining the output mode and Editing the XML tree schema.
In addition, tAdvancedFileOutputXML only support one loop element in it and cannot be used together with tXMLMap.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch