DB2 Version 9.7 for Linux, UNIX, and Windows

XPath expressions for filtering output

You can use an XPath expression to filter the XML output returned by a common SQL API stored procedure.

To filter the output, specify a valid XPath query string in the xml_filter parameter of the procedure. The following restrictions apply to the XPath expression that you specify:

Tip: If the stored procedure operates in complete mode, do not apply filtering, or a SQLCODE (+20458) is raised.

For better control over processing the XML document returned in the xml_output parameter, you can use the XMLPARSE function available with DB2® pureXML®.

Example

The following XPath expression selects the value for the Data Server Product Version key from an XML output document:

 /plist/dict/key[.='Data Server Product Version']following-sibling::string[1]

The procedure returns the string 8.1.0.356 in the xml_output parameter. Therefore, the procedure call returns a single value rather than an XML document.