The XPathResult2
interface represents the result of the
evaluation of an XPath 2.0 expression within the context of a particular
node. Since evaluation of an XPath 2.0 expression can result in various
result types, this object makes it possible to discover and manipulate the
type and value of the result.
interface XPathResult2 {
// XPathResultType2
const unsigned short FIRST_RESULT = 100;
const unsigned short ITERATOR_RESULT = 101;
const unsigned short SNAPSHOT_RESULT = 102;
readonly attribute unsigned short resultType;
readonly attribute boolean isNode;
readonly attribute TypeInfo typeInfo;
readonly attribute double asDouble;
// raises(XPathException, DOMException) on retrieval
readonly attribute int asInt;
// raises(XPathException, DOMException) on retrieval
readonly attribute DOMString asString;
// raises(XPathException, DOMException) on retrieval
readonly attribute boolean asBoolean;
// raises(XPathException, DOMException) on retrieval
readonly attribute Node asNode;
// raises(XPathException, DOMException) on retrieval
readonly attribute boolean invalidIteratorState;
readonly attribute unsigned long snapshotLength;
// raises(XPathException) on retrieval
boolean iterateNext()
raises(XPathException,
DOMException);
boolean snapshotItem(in unsigned long index)
raises(XPathException);
};
An integer indicating what type of result this is.
FIRST_RESULT
ITERATOR-RESULT
SNAPSHOT-RESULT
asBoolean
of type boolean
,
readonly
TYPE_ERR: raised if cannot be properly converted to
boolean |
|
|
INVALID_STATE_ERR: There is no current result in the result. |
asDouble
of type double
,
readonly
TYPE_ERR: raised if current result cannot be properly converted
to double |
|
|
INVALID_STATE_ERR: There is no current result in the result. |
asInt
of type int
, readonly
TYPE_ERR: raised if current result cannot be properly converted
to int |
|
|
INVALID_STATE_ERR: There is no current result in the result. |
asNode
of type Node
,
readonly
TYPE_ERR: raised if current result is not a node |
|
|
INVALID_STATE_ERR: There is no current result in the result. |
asString
of type DOMString
,
readonly
TYPE_ERR: raised if current result cannot be properly converted
to string |
|
|
INVALID_STATE_ERR: There is no current result in the result. |
invalidIteratorState
of type boolean
, readonlyisNode
of type boolean
,
readonlyresultType
of type unsigned
short
, readonlysnapshotLength
of type unsigned long
, readonly0
to snapshotLength-1
inclusive.
TYPE_ERR: raised if |
typeInfo
of type TypeInfo
,
readonlyiterateNext
if there are no more
items.
|
True if the current result is the next item from the sequence
or false |
TYPE_ERR: raised if |
|
|
INVALID_STATE_ERR: The document has been mutated since the result was returned. |
snapshotItem
index
th
item in the snapshot collection. If index
is greater than or
equal to the number of items in the list, this method returns false
.
Unlike the iterator result, the snapshot does not become invalid, but may
not correspond to the current document if it is mutated.
index
of type unsigned
long
|
True if the current result is the |
TYPE_ERR: raised if |