oid_xpath_string
oid_xpath_string (oid, expr[, nsOid])
This function evaluates an XPath expression with respect to an OID and returns the result of expr converted to a string.
• oid — The object to use as the context node.
• expr — A valid XPath expression.
Do not use expressions that contain position() or last(). They do not work in this context. Use the preceding-sibling or following-sibling axes instead to achieve the desired results. For example:
◦ count(preceding-sibling::*)=0 will test that the context node is the first child of its parent.
◦ count(preceding-sibling::para)=1 will test that the context node is the second para child of its parent.
◦ count(following-sibling::*)=0 is a viable alternative to position()=last()
• nsOid (optional) — The node used for resolving namespace prefixes in the XPath expression.
The nsOid parameter is useful when you need to evaluate the same XPath expression against many XML documents. Those documents might use a different namespace prefix than the XPath expression. If you provide an OID where the namespace prefix is declared, its URI can be matched up with the document instances regardless of the namespace prefixes they used. For example, you might have a configuration file that uses XPath expressions to specify naming rules with namespace prefixes declared on its root element.
Non-string results are converted to strings using standard XPath rules:
• Boolean expressions are converted to the string “true” or “false”
• Node set expressions return the string value of the first node, or an empty string if the node set is empty.
• Numbers are not specially formatted.
To handle errors, call this function from within a catch.
Related Topics