XML functions

SQL Function Description

XPATHS(xml[, key, xPathExpression]*)

Extract values out of a XML with XPath expressions.

This function returns a map where the keys are the key arguments and the values are the data extracted from the XML by the paired xPathExpression argument.

For example:

  • XPATHS('<foo><bar id="1">baz</bar></foo>', 'extractedId', '/foo/bar/@id,'value', '/foo/bar/text()')

returns:

  • {'extractedId': '1', 'value': baz}