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.

Attribute

Description

Name*

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

Enabled

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.

MessagePart

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

Description

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.

Example

Use the following .XML file as XML Example:

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

<bookstore>

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

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

<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>
  <year>2003</year>
  <price>49.99</price>
</book>

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

</bookstore>

Now use the following XPATH expressions and check the results:

XPATH Expression Result
/bookstore/book[1]/title
/bookstore/book[1]/title/text()
/bookstore/book[price>35]/title

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.