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.


It is highly recommended to consider the Structural split component instead as it will keep the main nodes as well as the structure of the XML file.

 

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:


 

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:


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

    • 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 ...
    • Structural split

      This article covers the advanced, converter workflow component, Structural split. This component should normally be used instead of the Split XML component as the structural split normally generates the wanted output. The component can be used if you ...
    • 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. For splitting an XML file the workflow component, Structural split is ...
    • 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 ...