xml.DomDocument.selectByXPath
Returns a DomNodeList object containing all DomNode objects matching a XPath 1.0 expression.
Syntax
selectByXPath(
expr STRING
[
, args ]
)
RETURNS xml.DomNodeList
- expr defines the XPath 1.0 expression.
- args is a variable list of parameters, to define a list of prefixes bound to namespaces in order to resolve qualified names in the XPath expression.
Usage
This method returns a DomNodeList object containing all DomNode
objects matching an XPath 1.0
expression.
Important:
This method is not part of W3C standard API.
args is a variable list of parameters, that defines a set of prefix/namespace
pairs, used to resolve qualified names in the XPath expression. You must provide an even number of
method parameters, representing the prefix and its corresponding
namespace:
selectByXPath( expr,
"prefix-1", "namespace-1",
"prefix-2", "namespace-2",
"prefix-3", "namespace-3",
... )
A namespace must be an absolute URI ( ex: 'http://', 'file://' ).
If args is
NULL
, the prefixes and namespaces defined in the
document itself are used when
available:selectByXPath( expr, NULL )
In case of error, the method throws an exception and sets the
status
variable. Depending on the error, a human-readable description of the
problem is available in the sqlca.sqlerrm
register. See Error handling in GWS calls (status).
Example
selectByXPath( "../../d:Record/*[last()]",
"d", "http://defaultnamespace" )
selectByXPath( "ns:Record", NULL )
selectByXPath( "ns1:Records/ns2:Record",
"ns1", "http://namespace1",
"ns2", "http://namespace2" )
Invalid example:
selectByXPath( "ns1:Record", "ns1" )