Six Stars

Split a big xml file into small files with header in each small files

I would like to split a big xml file which has over 2000 POs into small files which has only 200 POs in each file (or one in each file). All the content in each file should be the same as big file, with the same header as well. 
This image is the big xml structure (left). Right side is the small file I would like to split.

Do you know any way to do this?
Thank you!
2 REPLIES
Community Manager

Re: Split a big xml file into small files with header in each small files

Read the big XML file with tFileInputXML, rewrite the XML file with tAdvancedFileOutputXML with 'split output in several files' option, configure the rows in each output file.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: Split a big xml file into small files with header in each small files

Shong, thanks for the reply.
When I use tFileInputXML to read file in and use tAdvancedFileOutputXML rewrite xml, do I have to define each field (column) one by one again?
For example, I would like to split output by PurchaseReceipt node. But under PurchaseReceipt node there are over 100 fields there. Do I have to define each field again and map them from input to output? Is there a way I can just rewrite all fields under PurchaseReceipt to the new splitted xml file. 
Thanks.