nsIDOMXPathResult

This interface describes an XPath result returned by  nsIDOMXPathEvaluator or document.evaluate
Inherits from: nsISupports Last changed in Gecko 1.7

Method overview

nsIDOMNode iterateNext();
nsIDOMNode snapshotItem(in unsigned long index);

Attributes

Attribute Type Description
booleanValue boolean If resultType is BOOLEAN_TYPE, the boolean value. Read only.
invalidIteratorState boolean true if the iterator state has become invalid. For example, modifying a node invalidates the iterator. Read only.
numberValue double If resultType is NUMBER_TYPE, the numeric value of the XPath value. Read only.
resultType unsigned short The type of result; can be any of the Type constants except ANY_TYPE. Read only.
singleNodeValue nsIDOMNode If resultType is ANY_UNORDERED_NODE_TYPE or FIRST_ORDERED_NODE_TYPE, a single DOM Node. Read only.
snapshotLength unsigned long If resultType is UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE, the length of the snapshort array. Read only.
stringValue DOMString If resultType is STRING_TYPE, the boolean value. Read only.

Constants

Type constants

Constant Value Description
ANY_TYPE 0 Used when evaluating an XPath expression; the evaluator will return the most appropriate type.
NUMBER_TYPE 1 Type is a single number.
STRING_TYPE 2 Type is a single string.
BOOLEAN_TYPE 3 Type is a single boolean value.
UNORDERED_NODE_ITERATOR_TYPE 4 Type is a reference to all the nodes matching the expression used in the evaluator. The nodes may not necessarily be in the same order that they appear in the document.
ORDERED_NODE_ITERATOR_TYPE 5 Type is a reference to all the nodes matching the expression used in the evaluator. The nodes in the result set are in the same order that they appear in the document.
UNORDERED_NODE_SNAPSHOT_TYPE 6 Type is a node-set containing snapshots of all the nodes matching the expression used in the evaluator. The nodes may not necessarily be in the same order that they appear in the document.
ORDERED_NODE_SNAPSHOT_TYPE 7 Type is a node-set containing snapshots of all the nodes matching the expression used in the evaluator. The nodes in the result set are in the same order that they appear in the document.
ANY_UNORDERED_NODE_TYPE 8 Type is a single node that matches the expression. The node is not necessarily the first node in the document that matches the expression used in the evaluator.
FIRST_ORDERED_NODE_TYPE 9 Type is the first node in the document that matches the expression used in the evaluator.

Methods

iterateNext()

Iterates through the available nodes of an UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE result.

nsIDOMNode iterateNext();
Parameters

None.

Return value

A DOM node.

snapshotItem()

Returns the specified node from what is essentially an array of resulting DOM nodes. Is only available if the result type is UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE.

nsIDOMNode snapshotItem(
  in unsigned long index
);
Parameters
index
The index of the DOM node to return.
Return value

A DOM node.

See also

Document Tags and Contributors

 Contributors to this page: Sheppy, fscholz, trevorh
 Last updated by: Sheppy,