Split XML

Split XML

This advanced converter workflow component can split up an XML in the payload of the current workflow. The subtree of this workflow component is executed for each splitted XML.

 

A similar component, which is also able to transform the splitted files, is the Transform or split component.

 

Any changes to variables within the split definitions are local for the actual split and are forgotten when the next split is processed (and when all processing of the splitted XMLs are done).

 

If you are combining a split in a sub-workflow with an error handler, and you want to have an indication in the main workflow if an error occurred for any of the splitted files, then you should consider to create a temporary unique resource (that is linked with the input file), if an error occurs and then verify if such a resource exists in the main workflow, when processing returns from the sub-workflow. Here the main workflow should then also delete the temporary document. A similar example for spooled files is included here.

 

This video shows how to split XML files in the workflow:



The Split XML workflow component has these parameters:

 

NG2WorkflowSplitXML001

 

 

Split XPath

This can be used, if you want to split up an XML file per node in the input file. You can click the magnifying glass to refer to the optional sample XML file of the workflow. If you use the path above: /Root/Document on an XML file, that looks like this:

 

NG2WorkflowTransformOrSplit0002

Then you will get 3 output XML files, that contains each the Document subtree - without the common Root and CompanyInfo nodes.

 

If you want to keep any header nodes in the splitted XML files, then you need to copy this into each subtree before splitting the file. This is covered here.

 

 

Collect attachments

This option can be used if you want one attachment in an output email for each document found in the input XML file. For that you might use both the component, Set attachment name and Payload to attachment for each of the splitted XML files. In order to force the workflow to remember and collect all of these attachments you need to enable this function on the Split XML component. If you do not enable this, then each repeat loop starts with an empty list of attachments.

    • Related Articles

    • Transform or split

      Transform or split : The transform or split workflow component is able to transform and/or split an input XML file. The subtree of this workflow component is executed for each splitted/transformed XML. A similar component is the Split XML component, ...
    • XML

      XML is used widely in InterFormNG2 as both input and output payload in the workflow (and of course in the designer). Please notice, that some workflow components are listed as accepting only XML as input, where they actually also accept an IBM i ...
    • Spooled file split

      You might want to split up spooled files during InterFormNG2 processing. The reason might be, that the input spooled file may contain multiple documents (e.g. invoices), and that you want to create one PDF file (or email) for each invoice. There are ...
    • Split spool (complex key)

      A spooled file can be split into smaller files depending on the contents e.g. to split up a larger spooled file with many invoices into individual invoices. If the other spooled file split functions are not enough, then you can consider this workflow ...
    • Split spool (fixed key position)

      If you want InterFormNG2 to process spooled files, that contains multiple documents e.g. multiple invoices within a single spooled file (e.g. generated by a batch invoice run), then you may want to split up the spooled file into multiple output PDF ...