Splitting XML Files
The XML Split task will take a large XML file and split it into smaller XML files using a specific XPath Query and specifying the number of records to output, whilst maintaining the same XML document structure. This is generally used when the external system you are integrating with is unable to accept large sets of data.
The collection of output files produced by this task can be processed using the File Repeater task.
Settings
Input File
Required
The XML file to be processed.
Output Files Format
Required
Used to control the format of the output files generated by the task, the name is built up of the input file appended with a unique value based on this setting. Defaults to Number
. The following options are available: -
- Number - will append an incrementing number starting from 1 e.g. an input of
orders.xml
could result inorders_123.xml
- Timestamp - will append a timestamp e.g. an input of
orders.xml
could result inorders_201912051559315403023.xml
Output Folder
Required
The output folder for the split XML files. All output files generated by the task will be created in this folder with a name based on Input File and Output Files Format.
Record Limit
Required
The maximum number of records each XML file should contain. Defaults to 200
. Only integer values greater than or equal to 1 will be accepted.
XPath Query
Required
The XPath query that specifies each row of data that needs to be split e.g. Company/Products/Product
Zynk Settings
Examples
A sample input file is shown below, containing two stock transactions to be split into separate files. To achieve this, the XPath Query setting should be set to Company/StockTransactions/StockTransaction
, and the Record Limit should be set to 1
.
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<StockTransactions>
<StockTransaction>
<UniqueId>1</UniqueId>
<StockTransactionType>AdjustmentIn</StockTransactionType>
<StockCode>BOARD001</StockCode>
<StockTransactionDate>2006-12-31T00:00:00</StockTransactionDate>
<Reference>STK TAKE</Reference>
<Details>Whiteboard - Drywipe (900 x 1200)</Details>
<Qty>2</Qty>
<CostPrice>15</CostPrice>
<SalesPrice>0</SalesPrice>
<StockTransactionNumber>1</StockTransactionNumber>
</StockTransaction>
<StockTransaction>
<UniqueId>2</UniqueId>
<StockTransactionType>AdjustmentIn</StockTransactionType>
<StockCode>BOARD002</StockCode>
<StockTransactionDate>2006-12-31T00:00:00</StockTransactionDate>
<Reference>STK TAKE</Reference>
<Details>Whiteboard - Drywipe (1000 x 1500)</Details>
<Qty>2</Qty>
<CostPrice>17</CostPrice>
<SalesPrice>0</SalesPrice>
<StockTransactionNumber>2</StockTransactionNumber>
</StockTransaction>
</StockTransactions>
</Company>
Two output files will be created, as shown below, each including a single stock transaction:
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<StockTransactions>
<StockTransaction>
<UniqueId>1</UniqueId>
<StockTransactionType>AdjustmentIn</StockTransactionType>
<StockCode>BOARD001</StockCode>
<StockTransactionDate>2006-12-31T00:00:00</StockTransactionDate>
<Reference>STK TAKE</Reference>
<Details>Whiteboard - Drywipe (900 x 1200)</Details>
<Qty>2</Qty>
<CostPrice>15</CostPrice>
<SalesPrice>0</SalesPrice>
<StockTransactionNumber>1</StockTransactionNumber>
</StockTransaction>
</StockTransactions>
</Company>
<?xml version="1.0"?>
<Company xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<StockTransactions>
<StockTransaction>
<UniqueId>2</UniqueId>
<StockTransactionType>AdjustmentIn</StockTransactionType>
<StockCode>BOARD002</StockCode>
<StockTransactionDate>2006-12-31T00:00:00</StockTransactionDate>
<Reference>STK TAKE</Reference>
<Details>Whiteboard - Drywipe (1000 x 1500)</Details>
<Qty>2</Qty>
<CostPrice>17</CostPrice>
<SalesPrice>0</SalesPrice>
<StockTransactionNumber>2</StockTransactionNumber>
</StockTransaction>
</StockTransactions>
</Company>