Split XML

Top Previous Topic Next Topic  Print this topic

The split-xml task is used to split XML input documents to produce several sub-XML's.  Your input XML may contain the monthly invoice content for thousands of customers, for example.  This task is used to create a separate XML file for each that would be used to render an output for each of the sub-XML files.  This task involves specifying your input XML as well as telling Ecrion Omni System which element to split up the XML file by.

 

split_xml_intro

Figure 1:  The split-xml task is chosen in the Selected Tasks menu.

Configuration

Once you have selected split-xml in the Selected Tasks menu, you can access the configuration menu below.  Here you will need to specify four fields to tell Ecrion Omni System how you would like to split your XML and what to name the created sub-XML files.

 

split_xml_config

Figure 2:  The configuration menu for split-xml is used to configure the split-xml task.

 

Source Files - You will first need to specify which source file that Ecrion Omni System will need to use for this task.  In the example in Figure 2, a source file named sample.xml is retrieved from the Project. NOTE: this file is the result of the first get-xml-data task.
Split Path - Next, you must specify the exact the XPath expression that Ecrion Omni System will use to create a sub-XML file for.  In the example in Figure 2, the master XML contains a large set of invoices for all customers.  Within resides a repeating element 'customer'.  We are telling Ecrion Omni System to create a sub-XML file for the occurrence of every 'customer' element.
Number of Threads - Because this task is often used to split large XML Files, you may wish to configure the number of threads that Ecrion Omni System will allocate to accomplish this task.  Here you will need to simply manually specify the number of threads you would like to use to accomplish this task.  This can have a performance impact when executing this task for very large split operations.
Output Files Name - You will now need to tell Ecrion Omni System what to name each of these sub-XML files.  Normally, this is done by including a unique identifier that is present in your data.  You can combine both static and dynamic information to create these file name.  In the example in Figure 2, we are creating a file named 'customerid_' static text combined with the @id attribute that is found in each customer element in the data source. NOTE: The syntax used to obtain that value from our XML is:  {XPATH:/customer/@id}. It is also important to note that the XPath used when obtaining this ID uses the structure of the resulting sub-XML files, where 'customer' is the root element.

 

You can now proceed with configuring your other workflow steps, but do make sure to select Update to ensure your changes are committed.  Upon executing this task, Ecrion Omni System will use the specified XML File, split the file to create many sub-XML Files based upon your Split Path specification, and rename the files according to the Output File Name you have specified. If you finished configuring the Job, select the Save button in order to save all the settings for the Job.