Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

[resolved] How to insert a xml node to an existing xml file

Hi there,
I am new to Talend.
I have a task to merge two xml file:
- Xml File #1
<root>
<row>
<column1>test</column1>
<column2>test</column2>
<column3>test</column3>
</row>
<row1>
<column1>test</column1>
<column2>test</column2>
<column3>test</column3>
</row1>
...
</root>

-XML File #2
<another_root>
<header></header>
<content>
<element1>
<subelement1></subelement1>
<subelement2></subelement2>
</element1>
<element2>
<subelement1></subelement1>
<subelement2></subelement2>
</element2>
...
</content>
</another_root>
so what I want to achieve is to grab "root" element from XML file #1 and insert it to underneath of element2.
In other words.....

<another_root>
<header></header>
<content>
<element1>
<subelement1></subelement1>
<subelement2></subelement2>
</element1>
<element2>
<subelement1></subelement1>
<subelement2></subelement2>
</element2>
... <--- root element of xml file #1 goes here
</content>
</another_root>

I researched all xml related components and could not figure out how to do this.
Please let me how it can be resolved. Thank you in advance.
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi
You can try the 'append the source xml file' option on tAdvancedOutputXMLFile component, here is an simple example in topic: https://community.talend.com/t5/Design-and-Development/Extract-and-aggregate-data-from-2-tables-1-to...
Best regards
Shong

View solution in original post

2 Replies
Anonymous
Not applicable

Hi
You can try the 'append the source xml file' option on tAdvancedOutputXMLFile component, here is an simple example in topic: https://community.talend.com/t5/Design-and-Development/Extract-and-aggregate-data-from-2-tables-1-to...
Best regards
Shong
_AnonymousUser
Specialist III
Specialist III
Author

Shong,
I appreciate your help. It worked like a charm.
Thanks,
Jong