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 first 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:


1 1 Shong
1 2 Elisa
2 1


2 2 Patrick


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 above XML, you can see that there are two loop elements in the file: person and item. However, the tAdvancedFileOutputXML component does not allow to set multiple loop elements at a time. As a workaround, you can use the Append the source xml filefeature of the tAdvancedFileOutputXML to avoid this restriction and solve the problem. For more 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.

  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 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, 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.



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

The demo Job is available in the Related Files section of this article.

Execute the Job

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

Related Files

  File Modified
  ZIP Archive Sep 29, 2013 byShicong Hong


Version history
Version 1 (current version) Created by Shicong Hong   Sep 29, 2013
Version history
Revision #:
1 of 1
Last update:
‎04-13-2017 10:28 PM
Updated by:
Labels (1)