One Star

Advanced XML output writing

Hello,
I have some problems to write data in an specific XML file format
I want to build a file from this row format
Column Type
channel_id (int)
program_id (int)
program (DomElement)

My output file should have this structure
<channels> (my root element)
<channel channel_id="1">
<program program_id="1">
<programdomcontent/>
</program>
<program program_id="2"/>
<programdomcontent/>
</program>
</channel>
<channel channel_id="2">
<program program_id="3"/>
<programdomcontent/>
</program>
<program program_id="4"/>
<programdomcontent/>
</program>
</channel>
</channels>


Currently I'm using a tJavaFlex with org.dom4j.Element to perform the xml build. I tried to use the tAdvancedFileOutputXML instead, with no success.
How can I transform my rows in the desired XML file format?
Can anyone help me or give me a lead ?

Best regards,
Max
3 REPLIES
One Star

Re: Advanced XML output writing

Hi
You may use tAdvancedFileOutputXml to format xml file.
Best regards!
Pedro
One Star

Re: Advanced XML output writing

Hi Pedro,
Thanks for your answer !
I tried your solution and added a second loop on program. The XML Output structure is here.
Now I've problem with the DomElement. I want my program column to be the program XML element.
With the current solution, my program column content is added as text ("<" and ">" are encoded as "<" and ">") and can not be parsed properly...
Regards,
Max
One Star

Re: Advanced XML output writing

Building on Pedro's example...set "loop element" (right-click) on program and "group" (right-click) on channel.