Skip to content

XPath Expression Evaluator#

The XPath Expression Evaluator task evaluates XPath expressions against XML or HTML data structures. It enables navigation, querying, and extraction of elements, attributes, or values from structured XML/HTML documents. This makes it useful for data extraction, transformation, and validation tasks involving hierarchical data.

mainImage

Note

This task results from a split of the Expression Evaluator task. It can be used along with Generic Expression Evaluator and Regular Expression Evaluator.

Workflows#

Data Flow Control Flow

Inputs#

Name Data Type Description
data String The XML document, as text, that the expressions are evaluated against
Activate any Triggers task execution

Note

The task takes a single fixed input. For upgrade guidance, see the XPath and Regular Expression Evaluator migration guide ↗.

Outputs#

Name Data Type Description
<custom list> <custom> Defines the output values generated by the evaluation
Success Boolean Returns true if the task completes successfully
Error Error Contains information about any error that occurs

Settings#

The General tab includes standard task settings and the following parameter:

Name Data Type Values Default Value Description
Evaluator Behavior enum EvaluateAll
EvaluateUntilTrue
EvaluateAll Defines whether all expressions are evaluated or evaluation stops after the first true result

settings

The Outputs Tab includes the following settings:

Name Data Type Description
Name String Output Name
Friendly Name String The displayed output name
Type Long
Decimal
DateTime
Boolean
String
Integer
Defines the data type of the output
Expression Text XPath expression applied to the input data

outputs

Evaluator Behavior#

The XPath Expression Evaluator parses the data input as an XML document and evaluates each configured XPath expression against it. The value that each output emits depends on the result:

  • When the expression returns a scalar value, for example from the count or string XPath functions, the output emits that value.
  • When the expression matches a single node, the output emits the attribute value or the text content of that node.
  • When the expression matches multiple nodes, the output emits an array with the attribute value or the text content of each node.
  • When the expression matches nothing, the output does not emit and the task still emits Success.

The Evaluator Behavior setting controls how the configured expressions are processed:

  • EvaluateUntilTrue: Evaluates the outputs in order and stops at the first expression whose result converts to Boolean true, emitting only that output.
  • EvaluateAll: Evaluates every configured expression and emits each result on its own output.

An expression that fails does not stop the other expressions. The task emits the error on Error only when no output has a result, and then still emits Success.

Examples#

The following examples evaluate XPath expressions against this XML document received in the data input:

<root><item>A</item><item>B</item></root>
Name Type Expression Emits
firstItem String //item[1]/text() A
allItems String //item/text() ["A", "B"]
itemCount Integer count(/root/item) 2