XML - Evaluate Xpath

Declaration

<AMXMLEVALUATEXPATHEXPR XPATH="text" RESULTVARIABLE="varname"/>

Description: Evaluates an XPath expression using XPath functions. Note that this action takes an XPath expression, evaluates it, and returns a typed result of Boolean (Boolean), Number (Double), String (String), or Node Set (XPathNodeIterator).

IMPORTANT: Use of XML activities require a basic understanding of XML and related terms, such as XPath, DTD and XSLT.

Practical Usage

See Description.

Parameters

Session

Property

Type

Required

Default

Markup

Description

Session

Text

Yes

XMLSession1

SESSIONNAME="myXMLSession"

The name of an existing session in which to associate this activity with. As a safety measure, when a session is created, the XML file bound by that session is saved in memory and the original file is locked. Any modifications by subsequent XML steps are performed on a copy of the XML data saved to memory. Linking several activities to a single session eliminates redundancy. Additionally, a single task supports simultaneous execution of multiple sessions, improving overall efficiency. Use the XML - Output file or XML - Save activity to output the in-memory representation of the XML session to a file or variable. To end the session, use the XML - End session activity. 

Node

Property

Type

Required

Default

Markup

Description

XPath Expression

Text

Yes

(Empty)

XPATH="/BookStore/Books/Price"

The Xpath Expression from the current XML document to use to evaluate a value.

Populate Variable with value

Text

Yes

(Empty)

XMLATTRIBUTE="Price"

The name of an existing variable to receive the evaluated Xpath expression's value.

Description

Error Causes

On Error

Example

NOTE: The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

Description: Evaluate XPath expression "sum(//price/text())" and store the result into variable "TotalPrice". Session "XmlSession1".

<AMXMLEVALUATEXPATHEXPR XPATH="sum(//price/text())" RESULTVARIABLE="TotalPrice" />