Append the source xml file feature


The Append the source xml file feature on the tAdvancedFileOutputXML component is used to append records to an existing XML file. This feature also resolves the can't create multiple loop elements on tAdvancedFileOutputXML at a time limitation: you can output one entity to an XML file, and append another entity to the existing XML file with this feature. This article explains how to use this feature.



This procedure was written with:

  • Talend Open Studio for Data Integration
  • JDK version: Sun JDK build 1.6.0_26-b03
  • Operating system: Windows XP SP3

This procedure is compatible with Data Integration releases starting from 4.2.3.




Here are the two data sources used in this example:


Class_id Person_id Name
1 1 Shong
1 2 Elisa
2 1 Sabrina
2 2 Patrick



Class_id Item_id Item_name
1 1 item1
1 2 item2
2 1 item3


You need to read the data from the two data sources and generate an XML file as below:

<?xml version="1.0" encoding="ISO-8859-15"?>
  <class class_id="1">
  <class class_id="2">


From the XML above, you can see that there are two loop elements in the file: person and item. However, the tAdvancedFileOutputXML component does not allow you to set multiple loop elements at a time. As a workaround, you can use the Append the source xml file feature of the tAdvancedFileOutputXML to avoid this restriction and solve the problem. For details about the implementation process, see the following section.


Create an example Job

  1. Use a tFixedFlowInput to generate the person data and link it to a tAdvancedFileOutputXML. The demo job is also available as an attachment.



  2. In the File Name field of the tAdvancedFileOutputXML_1, enter the file path to the XML file to generate, for example: D:/out.xml.



  3. Configure its XML tree as shown below. Set person as a loop element and set class as a group element.



  4. Use a second tFixedFlowInput_2 to generate the item data, and link it to another tAdvancedFileOutputXML_2.



  5. In the tAdvancedFileOutputXML_2, check the Append the source xml file box to append the data to an existing XML file, D:/out.xml.



  6. Configure the XML tree as below, set item as a loop element and set class as a group element.



    Warning: This feature requires the presence of a group element in the XML tree, for example, in this case the class element is a group element. Otherwise, with no group element, an error displays as below.



Execute the Job

Execute the Job and see whether you get the expected result as shown in the Requirement section.

Version history
Revision #:
5 of 5
Last update:
‎09-29-2018 12:17 AM
Updated by:
Labels (2)