XPATH
The XPATH function uses path expressions to navigate to nodes in an XML document.
Syntax
XPATH (sourceXml, xpathExpression)
Remarks
• The first argument is the name of an XML document.
• The second argument is a string value containing an XPATH expression.
• The function evaluates the XPATH expression against the supplied XML value and returns the results as an XML value.
Example
PROCEDURE XpathFunctionExample (OUT resultXml XML)
BEGIN
DECLARE sourceXml XML;
DECLARE xpathExpression VARCHAR(4096);
-- Create an XML value to use in the XPATH function.
SET sourceXml = '<Book><Chapter>Test Data</Chapter></Book>';
-- Create an XPATH expression to evaluate.
SET xpathExpression = '//Chapter';
-- Evaluate the XPATH expression against the source XML value.
SET resultXml = XPATH (sourceXml, xpathExpression);
END