Splitter Preparsers

In this section:

Splitter preparsers divide an incoming document into smaller pieces based on a specified delimiter. The incoming document could be an XMl document or a flat file. Different preparsers handle different types of incoming documents. All streaming preparsers are splitter preparsers, but all splitter preparsers are not streaming preparsers. The following splitter preparsers are available:


Top of page

x
Delimited Value Splitter Preparser (com.ibi.preparsers.XDDelVal)

Syntax:

com.ibi.preparsers.XDDelVal

Description:

The Delimited Value preparser is a delimited value handler, which is useful when the incoming message consists of a delimited value stream such as lines of comma separated values. The first line can optionally hold field names (DIF format input). An XML document is generated from the input with a child node of each row, and children of that row in turn for each value.

In a use case scenario, the Delimited Value preparser can be used when an incoming message consists of a batch of flat files that are delimited by a special character, such as '|'. This message also needs to be converted to XML format.

Parameters:

Parameter

Description

Root name *

The element name of the outer tag.

Dif *

Determines whether the first line should be treated as an element name.

Delimiter *

Determines the delimiter to be used. Select comma or tab from the drop-down list, or enter a specific character in the field.

Trim values

Determines whether all values should be trimmed.

Quotes

Determines whether surrounding quotes should be eliminated.

Empty elements

Determines whether empty elements at the 'right' should be eliminated.

Include blanks *

Determines whether a blank line should be treated as a row with all null elements, or ignored.

Example:

  1. Select the Del Val (com.ibi.preparsers.XDDelVal) preparser from the Type drop-down list and click Next.

    The configuration parameters pane opens.

  2. Enter testroot in the Root name field.
  3. Select false from the Dif field drop-down list.
  4. Enter | in the Delimiter field and leave the default values selected for all the remaining fields.
  5. Click Next.

    The name and description pane opens.

  6. Enter a name (for example, DelvalPreparser) and an optional description.
  7. Click Finish.
  8. Construct an inlet, for example, PreparseInlet, which is associated with a file listener and the new preparser (DelvalPreparser).
  9. Define a simple move route and a default outlet for the channel.
  10. Build, deploy, and start the channel.
  11. Create a simple input text document (for example, TestData.txt), which contains the following:
    02|penny|copper|$0.01
    03|one dollar|paper|$1.00
    04|five dollars|paper|$5.00
    05|ten dollars|paper|$10.00
    06|twenty dollars|paper|$20.00

    When this input document is processed by the channel, an output XML document is generated with the following contents:

    <?xml version="1.0" encoding="ISO-8859-1" ?><testroot RowCount="4"><row rowcnt="1"><_nb02>03</_nb02><penny>one dollar</penny><copper>paper</copper><_dlr0.01>$1.00</_dlr0.01></row><row rowcnt="2"><_nb02>04</_nb02><penny>five dollars</penny><copper>paper</copper><_dlr0.01>$5.00</_dlr0.01></row><row rowcnt="3"><_nb02>05</_nb02><penny>ten dollars</penny><copper>paper</copper><_dlr0.01>$10.00</_dlr0.01></row><row rowcnt="4"><_nb02>06</_nb02><penny>twenty dollars</penny><copper>paper</copper><_dlr0.01>$20.00</_dlr0.01></row></testroot>


x
XML Splitter Preparser (com.ibi.preparsers.XDXMLSplit)

Syntax:

com.ibi.preparsers.XDXMLSplit

Description:

The XML Splitter preparser is used to divide an incoming XML document into smaller documents at a specified, repeating child.

In a use case scenario, if the incoming XML document is large and has repeating segments, this document could be divided into smaller pieces to improve the speed at which messages are processed.

Parameters:

Parameter

Description

Level string *

Define in dot of slash notation, the path to the element on which to split. An asterisk character (*) specifies any tag at that element.

Sequence

If set to true, a count attribute is set into each root.

Example:

  1. Select the XML Splitter (com.ibi.preparsers.XDXMLSplit) preparser from the Type drop-down list and click Next.

    The configuration parameters pane opens.

  2. Enter /a/b in the Level string field.
  3. Click Next.

    The name and description pane opens.

  4. Enter a name (for example, PO.XMLSplit.Preparser) and an optional description.
  5. Click Finish.
  6. Construct an inlet, for example, OIA.861.PO.Split.Inlet, which is associated with a file listener and the new splitter preparser (PO.XMLSplit.Preparser).
  7. Define a simple move route and a default outlet for the channel.
  8. Build, deploy, and start the channel.
  9. Create a simple input text document (for example, a.xml), which contains the following:
    <a>
     <b name="b1">
       <c>value of input element a/b@name=b1/c is 1</c>
       <c>value of input element a/b@name=b1/c is 2</c>
     </b>
     <b name="b2">
       <c>value of input element a/b@name=b2/c is 3</c>
       <c>value of input element a/b@name=b2/c is 4</c>
     </b>
    </a>

    When this input document is processed by the channel, the following output XML documents are generated:

    <?xml version="1.0" encoding="ISO-8859-1" ?><a><b
     name="b1"><c>value of input element a/b@name=b1/c is 1</c><c>value of
     input element a/b@name=b1/c is 2</c></b></a>
    <?xml version="1.0" encoding="ISO-8859-1" ?><a><b
     name="b2"><c>value of input element a/b@name=b2/c is 3</c><c>value of
     input element a/b@name=b2/c is 4</c></b></a>
    <?xml version="1.0" encoding="ISO-8859-1" ?><batch>EOT</batch>

iWay Software