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>
3 REPLIES
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.