The Append the source XML file feature
This scenario shows the way to append records to an existing XML
file.
The Append the source xml file feature provided by the tAdvancedFileOutputXML component appends 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 scenario generates an XML file using the data in the following two tables.
Person
Class_id | Person_id | Name |
---|---|---|
1 | 1 | Shong |
1 | 2 | Elisa |
2 | 1 | Sabrina |
2 | 2 | Patrick |
Item
Class_id | Person_id | Name |
---|---|---|
1 | 1 | item1 |
1 | 2 | item2 |
2 | 1 | item3 |
The scenario reads the above data and generates the following XML file.
Tip: From the above XML file, you can see that there are two loop elements
in the file: person and item. However,
the tAdvancedFileOutputXML component does not support setting
multiple loop elements at a time. You can use the Append the source xml
file feature of the tAdvancedFileOutputXML to
avoid this restriction and solve the problem.
Setting up the Job for generating an XML file
This Job uses the following components.
- two tFixedFlowInput components to generate the person and the item data from a text file;
- two tAdvancedFileOutpuXML components to generate an XML file and append records to the XML file.