XMLSplitter Activity

The XMLSplitter activity splits a large XML file into multiple fragments depending on the specified fragment criteria and outputs it to the configured location without allowing any processing of fragments in the ActiveMatrix BusinesssWorks process.

For more information on how the XMLSplitter activity splits the large XML, refer to XML Split Elements.

General Tab

The General tab has the following fields.
Field Literal Value/ Module Property/ Process Property? Description
Name No The name to be displayed in the process definition
Description No A short description of the activity
Input XML Source
(Mandatory) No The format of the input XML:
  • file name
  • input stream
  • output stream
Fragment Criteria
(Mandatory) No The criteria used for fragmenting:
  • size of fragment - split size in bytes
  • number of records
Fragment criteria value

(Optional)

Yes The value of Fragment Criteria.

Note: You can also specify the fragment criteria value in the Input tab. The fragment criteria value specified in the Input tab overrides the fragment criteria value specified in the General tab.

Create Non-Existing Directories (Optional)

No

When this check box is selected, the activity creates all directories in the specified path, if they do not already exist.

If this check box is not selected and one or more directories in the specified path do not exist, it throws an exception.

Input Tab

The input for the activity is the following.
Input Item Datatype Description
fileName String Complete path of the XML file to split.

It is available only when File is selected as the Input XML Source on the General tab.

inputStream ObjectReference Object reference of the Input Stream or Output Stream mapped from the output of FileToStream or GetFragment activity.

It is available only when Input Stream is selected as the Input XML Source on the General tab.

outputStream ObjectReference The Output stream ObjectReference mapped from the GetFragment activity.

It is available only when Output Stream is selected as the Input XML source on the General tab.

elementName String Name of the split element to be used for splitting the input XML document into smaller files.

If you want to consider parent elements during fragmenting, specify the split element name as an expression. For example:

/root/parent/split element
Note: The path must begin with a forward slash (/).
For more information on how the XMLSplitter activity splits the large XML, refer to XML Split Elements.
fragmentSize Integer Maximum size of the fragment (in bytes) to be used for fragmenting
fragmentPrependName String

Prefix to be added to the file name when creating the fragment name.

If fragmentPrependName is not set, the default fragment name used is "XMLFragment-".

If fragmentPrependName is set, the fragment name is created as fragmentPrependName+numberoffragment+". xml". For example, splitterOutput-1.xml, splitterOuput-2.xml, splitterOuput-3.xml, and so on.

noOfRecords Integer Maximum number of records to be used for fragmenting
fragmentStoreLocation String Location where the split files are to be stored

Output Tab

The output of the activity is the following.
Output Item Datatype Description
totalFragments Integer Total number of fragments created
fragmentStoreLocation String Location where the split files are stored

Fault Tab

The Fault tab lists the possible exceptions that can be thrown by this activity. See TIBCO ActiveMatrix BusinessWorks Error Codes for more information about the error codes and corrective actions to take.
Exception Thrown When...
XMLSplitterException This is a Generic Splitter Activity Exception. This Exception provides errors related to fragment processing.
FileNotFoundException Cannot find the file provided in the fileName parameter.
FragmentCriteriaException This exception provides errors related to fragment criteria.

The excessSplitElement in FragmentCriteriaException holds the excess split element in binary form. You can handle these errors to process the excess split elements separately.

Properties

To set the number of threads used to create the fragment files, set the bw.plugin.largeXml.splitter.maxThreads plug-in property. The default is 10 threads.

Sample

The TIBCO_HOME/bw/palettes/lx/<version>/samples folder contains samples and a readme file that explains how to import and use the sample.