ECMAScript Language Binding

26 February 2004

# Appendix C: ECMAScript Language Binding

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

Properties of the XPathException Constructor function:
  XPathException.INVALID_EXPRESSION_ERR
    The value of the constant XPathException.INVALID_EXPRESSION_ERR is 51.
  XPathException.TYPE_ERR
    The value of the constant XPathException.TYPE_ERR is 52.
Objects that implement the XPathException interface:
  Properties of objects that implement the XPathException interface:
    code
      This property is a Number.
Objects that implement the XPathEvaluator interface:
  Functions of objects that implement the XPathEvaluator interface:
    createExpression(expression, resolver)
      This function returns an object that implements the XPathExpression interface.
      The expression parameter is a String.
      The resolver parameter is an object that implements the XPathNSResolver interface.
      This function can raise an object that implements the XPathException interface or the DOMException interface.
    createNSResolver(nodeResolver)
      This function returns an object that implements the XPathNSResolver interface.
      The nodeResolver parameter is an object that implements the Node interface.
    evaluate(expression, contextNode, resolver, type, result)
      This function returns an object that implements the Object interface.
      The expression parameter is a String.
      The contextNode parameter is an object that implements the Node interface.
      The resolver parameter is an object that implements the XPathNSResolver interface.
      The type parameter is a Number.
      The result parameter is an object that implements the Object interface.
      This function can raise an object that implements the XPathException interface or the DOMException interface.
Objects that implement the XPathExpression interface:
  Functions of objects that implement the XPathExpression interface:
    evaluate(contextNode, type, result)
      This function returns an object that implements the Object interface.
      The contextNode parameter is an object that implements the Node interface.
      The type parameter is a Number.
      The result parameter is an object that implements the Object interface.
      This function can raise an object that implements the XPathException interface or the DOMException interface.
Objects that implement the XPathNSResolver interface:
  Functions of objects that implement the XPathNSResolver interface:
    lookupNamespaceURI(prefix)
      This function returns a String.
      The prefix parameter is a String.
Properties of the XPathResult Constructor function:
  XPathResult.ANY_TYPE
    The value of the constant XPathResult.ANY_TYPE is 0.
  XPathResult.NUMBER_TYPE
    The value of the constant XPathResult.NUMBER_TYPE is 1.
  XPathResult.STRING_TYPE
    The value of the constant XPathResult.STRING_TYPE is 2.
  XPathResult.BOOLEAN_TYPE
    The value of the constant XPathResult.BOOLEAN_TYPE is 3.
  XPathResult.UNORDERED_NODE_ITERATOR_TYPE
    The value of the constant XPathResult.UNORDERED_NODE_ITERATOR_TYPE is 4.
  XPathResult.ORDERED_NODE_ITERATOR_TYPE
    The value of the constant XPathResult.ORDERED_NODE_ITERATOR_TYPE is 5.
  XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE
    The value of the constant XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 6.
  XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
    The value of the constant XPathResult.ORDERED_NODE_SNAPSHOT_TYPE is 7.
  XPathResult.ANY_UNORDERED_NODE_TYPE
    The value of the constant XPathResult.ANY_UNORDERED_NODE_TYPE is 8.
  XPathResult.FIRST_ORDERED_NODE_TYPE
    The value of the constant XPathResult.FIRST_ORDERED_NODE_TYPE is 9.
Objects that implement the XPathResult interface:
  Properties of objects that implement the XPathResult interface:
    resultType
      This read-only property is a Number.
    numberValue
      This read-only property is a Number and can raise an object that implements the XPathException interface on retrieval.
    stringValue
      This read-only property is a String and can raise an object that implements the XPathException interface on retrieval.
    booleanValue
      This read-only property is a Boolean and can raise an object that implements the XPathException interface on retrieval.
    singleNodeValue
      This read-only property is an object that implements the Node interface and can raise an object that implements the XPathException interface on retrieval.
    invalidIteratorState
      This read-only property is a Boolean.
    snapshotLength
      This read-only property is a Number and can raise an object that implements the XPathException interface on retrieval.
  Functions of objects that implement the XPathResult interface:
    iterateNext()
      This function returns an object that implements the Node interface.
      This function can raise an object that implements the XPathException interface or the DOMException interface.
    snapshotItem(index)
      This function returns an object that implements the Node interface.
      The index parameter is a Number.
      This function can raise an object that implements the XPathException interface.
Properties of the XPathNamespace Constructor function:
  XPathNamespace.XPATH_NAMESPACE_NODE
    The value of the constant XPathNamespace.XPATH_NAMESPACE_NODE is 13.
Objects that implement the XPathNamespace interface:
  Objects that implement the XPathNamespace interface have all properties and functions of the Node interface as well as the properties and functions defined below.
  Properties of objects that implement the XPathNamespace interface:
    ownerElement
      This read-only property is an object that implements the Element interface.

Note: The parameter `resolver` of the method `XPathEvaluator.evaluate` is specified as an object that implements the `XPathNSResolver` interface. ECMAScript users can also pass to this method a function which returns a `String` and takes a `String` parameter instead of the `resolver` parameter.