FarragoXPathUDR
From Eigenpedia
Contents |
Syntax
SYS_BOOT.MGMT.XPATH_EVALUATE( xpath_expression, xml_content, delimiter ) SYS_BOOT.MGMT.XPATH_EVALUATE( xpath_expression, xml_content )
Purpose
Evaluates the supplied XPath expression in the context of the supplied xml content, and returns the result as a string. If the expression evaluation results in multiple nodes, the nodes are concatenated into the returned string and separated by the supplied delimiter. If no delimiter is supplied, the empty string is used.
Inputs
- xpath_expression: [VARCHAR(65535)] The XPath expression to be evaluated
- xml_content: [VARCHAR(65535)] The XML content against which the XPath expression is to be evaluated
- delimiter: [VARCHAR(5)] Text to be used as a delimiter between nodes in the result string
Output
- A string representation of the XPath evaluation results, as follows:
- If the evaluation does not succeed in selecting any nodes, the result is null
- If the evaluation selects exactly one node, a string representing that node will be returned
- If the evaluation selects more than one node, the string representations of each node will be concatenated into the result, separated by the supplied delimiter
- if no delimiter is supplied, then the empty string is used as a delimiter
Examples
XPath expression returning 0 nodes
VALUES (SYS_MGMT.XPATH_EVALUATE( ''//@bar' , '<foo id="5"></foo>' );
Returns:
(evaluates to NULL)
XPath expression returning a single node with empty contents
VALUES (SYS_MGMT.XPATH_EVALUATE( ''//@bar' , '<foo bar=""></foo>' );
Returns:
(empty string, i.e. "")
XPath expression returning a single node with non-empty contents
VALUES (SYS_MGMT.XPATH_EVALUATE( ''//@id' , '<foo id="5"></foo>' );
Returns:
5
XPath expression returning multiple nodes, no delimiter
VALUES (SYS_MGMT.XPATH_EVALUATE( ''//@id' , '<foo id="5"><bar id="24"/></foo>' );
Returns:
524
XPath expression returning multiple nodes, comma as delimiter
VALUES (SYS_MGMT.XPATH_EVALUATE( ''//@id' , '<foo id="5"><bar id="24"/></foo>' , ',');
Returns:
5,24
Implementation notes
Java implementation
To be located in net.sf.farrago.syslib.FarragoXPathUDR
Dependencies
javax.xml.xpath

