XPath expressions for filtering output
You can use an XPath expression to filter the XML output that is returned by the GET_CONFIG, GET_MESSAGE, and GET_SYSTEM_INFO stored procedures.
To filter the output, specify a valid XPath query string in the xml_filter parameter of the stored procedure.
The following restrictions apply to the XPath expression that you specify:
- The XPath expression must reference a single value.
- The XPath expression must always be absolute from the root node.
For example, the following path expressions are allowed: /,
nodename,., and... The following expressions are not allowed://and@ - The only predicates allowed are
[path='value']and[n]. - The only axis allowed is
following-sibling. - The XPath expression must end with one of the following, and,
if necessary, be appended with the predicate [1]:
following-sibling::string,following-sibling:: data,following-sibling::date,following-sibling::real, orfollowing-sibling::integer. - Unless the
axis is found at the end of the XPath expression, it
must be followed by a
::dict,::string,::data,::date,::real, or::integer, and if necessary, be appended with the predicate [1]. - The only supported XPath operator is
=. - The XPath expression cannot contain a function, namespace, processing instruction, or comment.
Tip: If the stored procedure
operates in complete mode,
do not apply filtering, or an SQLCODE (+20458) is raised.
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 stored procedure returns the string 9.1.5 in
the xml_output parameter if the value of the Data
Server Product Version is 9.1.5. Therefore, the stored
procedure call returns a single value rather than an XML document.