Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Expand
titleContents

Table of Contents
indent15px
maxLevel45
stylenone

XMLSplitter can be used to split XML documents based on the configured XPath. This component is useful when there are repeated elements in the documents that can be processed by independently by subsequent components.

...

The following attributes can be configured in the Interaction Configuration panel as shown below.

Image RemovedImage Added
Figure 1: Interaction Configuration Properties

...

Namespace prefixes that are used instead of complete namespace in XPath expression can be specified by clicking the ellipsis button  against this property which opens a Namespaces table as shown in Ffigure 2. The namespaces present in the input schema, if any, are automatically populated in the table. If the user wants to provide XPaths manually and use the namespaces which are not present in the schema provided , they can be added using the namespaces tab

Image Modified
Figure 2: Namespace Table

...

The operation that has to be performed on the input XML message which is categorised categorized as:

  • Split
  • Group
Split

Splits the input XML at XPath defined and sends out output XMLs. The number of output XMLs is equal to the number of times the element/attribute defined by the property XPath is present in the input message.

Note

When the XPath is specified as an attribute, then the value of the attribute is sent as the output message.

Example: If the input contains all the Employees details conforming to schema as shown in figure 3 and if it is required to split individual Employee details into separate messages then configure 'XPath' to ns1:Employee_Schema/ns1:Employee and select 'Operation' as Split. Refer to scenario 1 under Functional demonstration section. 

Image Modified
Figure 3: Schema for Employees details

...

Splits the input XML at the element whose XPath is specified by the property XPath and then regroups the split XMLs which have the same value for that element into a single message. Thus the number of messages sent onto the output port depends on the number of unique values present in XML for the element whose XPath is specified by the property XPath.

Image RemovedImage Added
Figure 4: Properties under Group operation

...

Note

If an element is selected using property XPath, then those elements having the same value will be grouped. If an attribute is selected as XPath, then those elements for which this attribute is defined and having same value for this attribute will be grouped.

Example: If the input contains all the Employees' details conforming to the schema shown in figure 4 and if it is required to group individual employee details which are in the same group (group information is stored in the attribute Group of Employee element), then configure 'XPath' to ns1:Employee_Schema/ns1:Employee/@Group and choose property 'Operation' as Group. Employee elements whose group attribute is same will be combined into a single message.


Figure 5: Schema for Employees details with a group attribute

Action if XPath not present

Action to be taken if the input message does not contain the configured XPath.

  • No Action
    Component will ignore the message.

    Note

    'No Action' is the default value.

  • Treat As Exception
    Sends an Exception to Exception port.
  • Send To Output Port
    Sends the input message to the output port as it is.

Output Schema

Schema for the output message can be specified. Schema can be specified exclusively or can be generated with the help of input schema and XPath by clicking Get schema based on input and XPath button in the schema editor. This is not guaranteed to give a valid schema always. Please verify when using this feature.

...

The XML can be read directly from the specified file by setting this property as yes. 'XML File Directory' and 'XML File Name' properties are visible when this option is set to 'yes'.

XML File Directory

Directory of the input XML file.

XML File Name

Name of the input XML file which has to be split.

  • Action if XPath not present
    Action to be taken if the input message does not contain the configured XPath.
  • No Action
    Component will ignore the message.

    Note

    'No Action' is the default value.

  • Treat As Exception
    Sends an Exception to Exception port.

...

Remove WFInstanceID property

If set to 'yes', the Workflow Instance ID will be removed and after encountering the next workflowItem config, WorkFlow_Instance_ID will be addded automatically with a new value, making split messages with unique IDs.

Cleanup resources (excluding connection) after each document

This closes all the resources except for the connection after every request. If less processing time is more important than less memory usage, then it is recommended to disable this property and vice versa.

For more details, refer to the respective section under in the Common Configurations page.

Target Namespace

Target Namespace for the request and response XML messages.

For more details, refer to the respective section under in the Common Configurations page.

Monitoring Configuration

Please refer to the Monitoring Configuration section in Common Configurations page.

Store imported schemas

Selecting "yes" stores imported schemas in Schema Repository.

Elements to Decrypt

Please refer Port Properties section in the Common Configurations page.

...

The configuration can be tested by clicking the Test button in the interaction Configuration panel.

Image Modified
Figure 6: Sample Input Message

Image Modified
Figure 7: Response Generated for XPath /ns1:BookStore/ns1:Book/ns1:Author

...

Configure the XMLSplitter as shown in the figure below.

Image Modified
Figure 8: configuration for scenario 1

Use feeder and display component to send sample input and to check the response respectively. In the example given below, the split Split element selected is Author.

...

This operation splits the XML by the path configured for the Group and accommodates all the  the messages having same Xpath value into a single message under the value configured for the group. So, the number of messages depend upon the number of distinct values configured for XPath.

 

Note

Xpath value should be a subpart(or could be same) of the Configured Group value., else an Exception "SelectPath should be the part of Grouping Xpath" is thrown.

 

In this example, 'Title' is one of the children of 'Book'.

...

  • The output schema can be computed from the input schema and the XPath used to split the XML document using the GetSchemabasedonInputand Get Schema based on Input and XPath  button in the schema editor for property OutputSchema. This is not guaranteed to give a valid schema always. Please verify when using this feature.
  • Prefer XSLT for simple split paths and XPath for complex paths. All kinds of split paths may not be supported by XSLT.
  • When component configuration sends multiple messages, messages contain the following JMS properties to identify first and last messages.
    • First document: START_EVENT=true
    • All documents: RECORD_INDEX=<index of output message>
    • Last document: CLOSE_EVENT=true
  • When the input XML does not contain the element specified at Xpath, splitting/grouping is not performed and there will be no output messages in this case.
  • The output generated has the same instance id for all the split elements. This causes issues when document tracking, if you try to track both documents on the output of the splitter, you only get a single entry (due to the duplicate instance ID's).
  • To have different Instance Ids for different documents, workflow items in the flow have to be set properly.
  • The Instance ID is set at the first "Workflow Item" encountered in the event process, so if the 1st workflow item is set before OUT_PORT of XMLSplitter then there will be only one "Instance ID" for all splitted messages, however, all splitted messages can have different "Document ID". On the other hand, if the first "Workflow Item" is set at OUT_PORT of XMLSplitter each element will have a different "Instance ID".

...

Adaptavist ThemeBuilder EngineAtlassian Confluence