PROCESIO
OverviewPlatform ActionsIntegrations & DemosMarketplaceCustom ActionsDeveloper’s Guide

Mapper

Extracts a value or a list of values from an XML text or an XML file with an XPath expression.

The Mapper action in the XML folder reads an XML text or an XML file and returns what an XPath expression selects. When the expression matches one node you get a single value; when it matches several you get a list. Is List tells you which one you got.

Mapper was previously called XML Mapper.

Add the action

In the Process Designer toolbox, open XML and pick Mapper (or type Mapper in the search box).

The Mapper action properties: Input XML, Input XML file, XPath Expression, Is List, The resulting value and The resulting list of values

Inputs and outputs

FieldDirectionTypeRequiredWhat to put / what you get
Input XMLInputTextNo*The XML as text.
Input XML fileInputFileNo*An XML file. Used only when Input XML is empty.
XPath ExpressionInputTextYesThe XPath that selects what you need, for example /bookstore/book[1]/title.
Is ListOutputBoolean (true/false)Yestrue when the expression matched more than one node, false otherwise.
The resulting valueOutputAny typeNoThe content of the matched node, when exactly one node matched.
The resulting list of valuesOutputList of any typeNoThe content of every matched node, when more than one node matched.

* Fill one of the two: Input XML or Input XML file. With both empty, the step fails with Input xml cannot be null or empty.

Example

Input XML:

<bookstore>
  <book><title lang="en">Harry Potter</title><price>29.99</price></book>
  <book><title lang="en">Learning XML</title><price>39.95</price></book>
</bookstore>
XPath ExpressionIs ListThe resulting valueThe resulting list of values
/bookstore/book[1]/titlefalseHarry Potterempty
//titletrueempty["Harry Potter", "Learning XML"]
/bookstore/book[1]false<title lang="en">Harry Potter</title><price>29.99</price>empty
//title/@langtrueempty["en", "en"]
//author (no match)falseemptyempty

Good to know

  • The value of a matched element is its inner content. For an element with children you get the child tags as text (see /bookstore/book[1] above).
  • Select the element (//title), not its text node (//title/text()): a text node comes back empty.
  • Only one of the two value outputs is filled. Check Is List, or map both outputs.
  • A match on nothing does not fail the step; all outputs stay empty and Is List is false.
  • The expression must select nodes. A function such as count(//book) fails the step with Input XML or XPath was not valid., as does XML that is not well-formed.
  • Namespaces. For XML with a default namespace, such as <Invoice xmlns="urn:test"><ID>INV-1</ID></Invoice>, the path /Invoice/ID finds nothing. Use local-name(): //*[local-name()='ID'] returns INV-1.

On this page