xml.DomNode.selectByXPath

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

Syntax

selectByXPath(
   expr STRING,
   args ...)
  RETURNS xml.DomNodeList
  1. expr defines the XPath 1.0 expression.
  2. args defines 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; expr is the XPath 1.0 expression, args is a list of prefixes bound 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 it corresponding namespace.

Important: This method is not part of W3C standard API.

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")

selectByXPath("ns1:Record", "ns1") 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://').