XPath

Description

Extracts part of an XML document using an XPath expression.

Syntax

XPath(xml_string, xpath_string[, cache_xml_doc[, namespaces]])

Arguments

  xml_string  - string expression representing a well-formed XML.

  xpath_string - string expression representing an XPath expression.

  cache_xml_doc (optional) - boolean flag cache last xml doc (better performance when using the function multiple times on the same XML doc). True by default.

  namespaces (optional)- (string) an xml element that defines namespaces for the XPath engine to use. e.g. <root xmlns:h="http://www.w3.org/TR/html4/" xmlns:f="https://www.w3schools.com/furniture"/>

Examples

XPath('<customer><firstname>John</firstname><lastname>Doe</lastname></customer>','/customer/firstname')returns: <firstname>John</firstname>.

Return value datatype

String

Impact of null value

If any of the inputs is null, returns null.

Feedback and Knowledge Base