XPath splitter

XPath splitter

The XPath splitter is a service which can split XML input content into multiple parts based on an XPath definition. The results of the service are multiple output messages with the result of the XPath split on the configured MessagePart. The format of the input MessagePart has to be string or document. The format of the result MessagePart depends on the input format.

In the table below, you will find an explanation of these properties. All attributes with a ‘*’ are mandatory.




By default, we fill this out with the technical ‘tag’, followed by a serial number. Changing the name is optional.


Set this value to true, if you want this service to be enabled.

XPath Expression*

Expression to use to split the XML. Should result in a nodeset.


Name of the MessagePart in a ConnectMessage where the content of the file is being stored.


Description of the specific service. This is for documentation purposes.

When you select the  behind the field XPath Expression, you will enter an XPath Tester program.

You can enter an XPATH expression and an XML example. When you press the  button the expression will be performed on the given XMl File. The result will be returned in the result field.

(I.E.: If your XML uses namespaces, the tester will return an answer, but the XPATH Splitter will not! See => XML file with namespaces)


Use the following .XML file as XML Example:

<?xml version="1.0" encoding="UTF-8"?>


<book category="cooking">
  <title lang="en">Everyday Italian</title>
  <author>Giada De Laurentiis</author>

<book category="children">
  <title lang="en">Harry Potter</title>
  <author>J K. Rowling</author>

<book category="web">
  <title lang="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>

<book category="web">
  <title lang="en">Learning XML</title>
  <author>Erik T. Ray</author>


Now use the following XPATH expressions and check the results:

XPATH Expression Result

CDATA Values

If you work with CDATA tags in your XML, after splitting the XML up into seperate parts, the CDATA tag will be removed from your new XML message. All special characters will be correctly escaped during this process.

For instance, the & character will be replaced by &amp.

XML file with namespaces

If your XML file of messagepart has namespaces, you cannot use the above syntax for the XPATH Splitter. You have to use a specific syntax to deal with this.

You can detect namespaces whan the XMLNS property is used in the tag.

          xsi:schemaLocation="http://www.connectplaza.cm.com/generic-consignment file:///A:/Projects/Order/Schemas/Customer/CP_Consumption.xsd">

If you want alle message from messages, you normally type: /Messages/* or /Message/message. But in this case you need the localname variant:



If you have an XML document with namespaces you have to declare them beforehand. That may be possible in an online parser , in our Agent it is not possible because the parser (which executes the xpaths) is already loaded. The result is that you can't do normal expressions because the parser can't find the elements (since they are loaded in a namespace).

The solution is local-name() syntax. This indicates in the expression that you are not interested in the namespace in which the element is located, but in the element itself based on its local name. Hence the expression: