XPath
The XPath() function reads data from the given XML string for the provided xpath expression. If there are multiple nodes returned then only value from the first node is retrieved.
Syntax
XPath(xml,xpath);
Function arguments
- xml – (String) XML string with data;
- xpath – (String) xpath expression.
Return value
This function returns String.
It returns a result of the given xpath expression.
Examples
Example 1:
XPath() returns inner text from the first number tag inside the first invoice tag from an xml string stored in [XML] field.
XPath([XML], "/invoice/number");
Example 2:
XPath() returns a value of the number attribute from the first invoice tag from an xml string stored in [XML] field.
XPath([XML], "/invoice/@number");
Example 3:
XPath() returns inner text from price tag from the invoice tag with number attribute equal 1 from an xml string stored in [XML] field.
XPath([XML], "/invoice[@number='1']/price");