30 August 2001

Appendix C: ECMAScript Language Binding

This appendix contains the complete ECMAScript [ECMAScript] binding for the Level 3 Document Object Model XPath definitions.

Prototype Object XPathException
The XPathException class has the following constants:
XPathException.INVALID_EXPRESSION_ERR
This constant is of type Number and its value is 1.
XPathException.TYPE_ERR
This constant is of type Number and its value is 2.
Object XPathException
The XPathException object has the following properties:
code
This property is of type Number.
Object XPathEvaluator
The XPathEvaluator object has the following methods:
createExpression(expression, resolver)
This method returns a XPathExpression object.
The expression parameter is of type String.
The resolver parameter is a XPathNSResolver object.
This method can raise a XPathException object.
createResult()
This method returns a XPathResult object.
createNSResolver(nodeResolver)
This method returns a XPathNSResolver object.
The nodeResolver parameter is a Node object.
evaluate(expression, contextNode, resolver, type, result)
This method returns a XPathResult object.
The expression parameter is of type String.
The contextNode parameter is a Node object.
The resolver parameter is a XPathNSResolver object.
The type parameter is of type Number.
The result parameter is a XPathResult object.
This method can raise a XPathException object.
evaluateExpression(expression, contextNode, type, result)
This method returns a XPathResult object.
The expression parameter is a XPathExpression object.
The contextNode parameter is a Node object.
The type parameter is of type Number.
The result parameter is a XPathResult object.
This method can raise a XPathException object.
Object XPathExpression
Object XPathNSResolver
The XPathNSResolver object has the following methods:
lookupNamespaceURI(prefix)
This method returns a String.
The prefix parameter is of type String.
Prototype Object XPathResult
The XPathResult class has the following constants:
XPathResult.ANY_TYPE
This constant is of type Number and its value is 0.
XPathResult.NUMBER_TYPE
This constant is of type Number and its value is 1.
XPathResult.STRING_TYPE
This constant is of type Number and its value is 2.
XPathResult.BOOLEAN_TYPE
This constant is of type Number and its value is 3.
XPathResult.NODE_SET_TYPE
This constant is of type Number and its value is 4.
XPathResult.SINGLE_NODE_TYPE
This constant is of type Number and its value is 5.
Object XPathResult
The XPathResult object has the following properties:
resultType
This read-only property is of type Number.
numberValue
This read-only property is a double object and can raise a XPathException object on retrieval.
stringValue
This read-only property is of type String and can raise a XPathException object on retrieval.
booleanValue
This read-only property is of type Boolean and can raise a XPathException object on retrieval.
singleNodeValue
This read-only property is a Node object and can raise a XPathException object on retrieval.
The XPathResult object has the following methods:
getSetIterator(ordered)
This method returns a XPathSetIterator object.
The ordered parameter is of type Boolean.
This method can raise a XPathException object or a DOMException object.
getSetSnapshot(ordered)
This method returns a XPathSetSnapshot object.
The ordered parameter is of type Boolean.
This method can raise a XPathException object or a DOMException object.
Object XPathSetIterator
The XPathSetIterator object has the following methods:
nextNode()
This method returns a Node object.
This method can raise a DOMException object.
Object XPathSetSnapshot
The XPathSetSnapshot object has the following properties:
length
This read-only property is of type Number.
The XPathSetSnapshot object has the following methods:
item(index)
This method returns a Node object.
The index parameter is of type Number.
Note: This object can also be dereferenced using square bracket notation (e.g. obj[1]). Dereferencing with an integer index is equivalent to invoking the item method with that index.
Prototype Object XPathNamespace
The XPathNamespace class has the following constants:
XPathNamespace.XPATH_NAMESPACE_NODE
This constant is of type Number and its value is 13.
Object XPathNamespace
XPathNamespace has the all the properties and methods of the Node object as well as the properties and methods defined below.
The XPathNamespace object has the following properties:
ownerElement
This read-only property is a Element object.