xml.DomDocument.selectByXPath

Returns a DomNodeList object containing all DomNode objects matching an XPath 1.0 expression.

Syntax

selectByXPath(
   expr STRING,
   nslist ... )
  RETURNING list xml.DomNodeList
  1. expr is the XPath1.0 expression
  2. nslist is a list of prefixes bounded to namespaces in order to resolve qualified names in the XPath expression.

Usage

Returns a xml.DomNodeList object containing all DomNode objects matching an XPath 1.0 expression.expr is the XPath1.0 expression, nslist is a list of prefixes bounded to namespaces in order to resolve qualified names in the XPath expression. This list must be filled with an even number of arguments, representing the prefix and its corresponding namespace.

CAUTION:
Not part of W3C API.
Valid example:
selectByXPath(
  "//d:Record", 
  "d", 
  "http://defaultnamespace")
selectByXPath(
  "//ns1:Record", 
  NULL)
selectByXPath(
  "//ns1:Records/ns2:Record", 
  "ns1",
  "http://namespace1", 
  "ns2", 
  "http://namespace2")

Invalid example:

selectByXPath(
  "//ns1:Record", 
  "ns1")
This example is invalid because the namespace definition is missing.

If the namespaces list is NULL, the prefixes and namespaces defined in the document itself are used if available.

A namespace must be an absolute URI (ex 'http://', 'file://').

In case of error, the method throws an exception and sets the STATUS variable with the appropriate error number.