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.

XPath Expression Evaluator screenshot

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
<custom list> <custom> Defines the input values used in the evaluation
Activate any Triggers task execution

The XPath expressions are applied to the XML document received by the first input defined on the Inputs tab. Additional inputs can be defined, but their values are not used in the evaluation.

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 parameters:

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
Clear Inputs Boolean false When enabled, clears input values after task execution

XPath Expression Evaluator General Settings screenshot

The Inputs Tab includes the following settings:

Name Data Type Description
Name String Input Name
Friendly Name String The displayed input name
Type Long
Decimal
DateTime
Boolean
String
Integer
Defines the data type of the input
Default Value any Default value assigned to the input parameter
Required Boolean Indicates if input is required

XPath Expression Evaluator Input Settings screenshot

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

XPath Expression Evaluator Output Settings screenshot

Behavior#

The task runs when the Activate input is triggered and every input defined on the Inputs tab has a value: required inputs must receive one, and optional inputs can fall back to their default value. The value of the first configured input is parsed as an XML document and each output expression is evaluated against it. The value that each output emits depends on the result of the expression:

  • When the expression returns a scalar value, for example from a comparison or from XPath functions such as count or string, 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.

The result is converted to the Type configured for the output. When the conversion fails, only that output does not emit and the remaining expressions are still evaluated.

The Evaluator Behavior setting defines how the configured output expressions are processed:

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

When the Clear Inputs setting is enabled, the received input values are cleared when the task executes, so the next execution requires new values instead of reusing the previous ones.

Examples#

The following examples define one required String input named xmlData on the Inputs tab and evaluate expressions against the XML document it receives.

Extract a list of attribute values#

With xmlData receiving <X><Counters><Counter CounterID='1'/><Counter CounterID='2'/><Counter CounterID='3'/></Counters></X>, configure the Outputs tab with:

Name Type Expression
counterIds Object //Counter/@CounterID

The expression matches multiple attribute nodes, so the counterIds output emits the array ["1", "2", "3"].

Extract a typed value#

With xmlData receiving <a><b attr='00123'/></a>, configure the Outputs tab with:

Name Type Expression
numericValue Integer //a/b/@attr
textValue String //a/b/@attr

The same match is converted to each output Type: the numericValue output emits 123 and the textValue output emits 00123. Element text content works the same way, for example //a/b against <a><b>00123</b></a>.

Stop at the first true expression#

Set the Evaluator Behavior setting on the General tab to EvaluateUntilTrue. With xmlData receiving <a><b attr1='a.b.c.00123' attr2='1' attr3='00123'/></a>, configure the Outputs tab with:

Name Type Expression
first Integer //a/b/@attr1
second Integer //a/b/@attr2
third Integer //a/b/@attr3

The first result does not convert to true, the second result is 1, which converts to true, so only the second output emits 1 and the third expression is never evaluated.