Split large XML into multiple XML

In this post, I will describe you how to split large XML into several xml.

Here is our Sample XML file. ( which is not huge but just a sample)

Split Xml Talend
Source XML

We are expecting three XML files from sample xml hence lets start with metadata creation for this sample file.

Once you created metadata then you can drag and drop schema to job designer. for the scenario we will choose tFileInputXML component.

Now add another component tXMLMap and link tFileInputXML to tAdvancedFileOutputXml then configure tAdvancedFileOutputXml as shown in image.

tAdvanceOutputXMl Mapping
tAdvanceOutputXMl Mapping

Now we have mapped our source column to output columns, but it will output all the rows in single file, to create a file for each row we have to configured tAdvancedFileOutputXML component using Advance property of component tab. use “Spit output in Several files” option with value as “1”. by doing this it will create new file for each row.

tAdvancedOutputXML Setting
tAdvancedOutputXML Setting

After run, this job will create three files on mention path like below.

Output Xml Files
Output Xml Files

And here is the final output.

Output Xml Files
splitxml6 splitxml7Output Xml Files


About Umesh

I am Software consultant with approx 7 years of experience mainly in Business Intelligence and data warehousing assignments using Talend. Writing is not my passion but i am doing it to help others. if you have any special case where you want me to demonstrate then please post me.

2 comments on “Split large XML into multiple XML

  1. Hi Umesh,

    I have a requirement where in I need to read the details from multiple tables and join those and create a XML output file dynamically.
    For ex. Organisations–>Companies–>Dept–>Employee–>EmpDetails
    so in case I provide dept(as parent) and Employee (as Child) I should get details from Dept till (its leaf node)EmpDetails

    1. Hi Vidya,

      which talend version are you using? data mapper is good place to do such things, but i would suggest refer advance XML output component.it has functionality which suites your need. if you provide more details on your requirment with source and expected output sample I can assist you better.


Leave a Reply

Your email address will not be published. Required fields are marked *