For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.

Interface XPathResult

The XPathResult interface represents the results generated by evaluating an XPath expression within the context of a given node.

MDN Reference

interface XPathResult {
    ANY_TYPE: 0;
    ANY_UNORDERED_NODE_TYPE: 8;
    BOOLEAN_TYPE: 3;
    booleanValue: boolean;
    FIRST_ORDERED_NODE_TYPE: 9;
    invalidIteratorState: boolean;
    NUMBER_TYPE: 1;
    numberValue: number;
    ORDERED_NODE_ITERATOR_TYPE: 5;
    ORDERED_NODE_SNAPSHOT_TYPE: 7;
    resultType: number;
    singleNodeValue: Node | null;
    snapshotLength: number;
    STRING_TYPE: 2;
    stringValue: string;
    UNORDERED_NODE_ITERATOR_TYPE: 4;
    UNORDERED_NODE_SNAPSHOT_TYPE: 6;
    iterateNext(): Node | null;
    snapshotItem(index: number): Node | null;
}
Index

Properties

ANY_TYPE: 0
ANY_UNORDERED_NODE_TYPE: 8
BOOLEAN_TYPE: 3
booleanValue: boolean

The read-only booleanValue property of the The return value is the boolean value of the XPathResult returned by In case XPathResult.resultType is not BOOLEAN_TYPE, a The following example shows the use of the booleanValue property.

MDN Reference

FIRST_ORDERED_NODE_TYPE: 9
invalidIteratorState: boolean

The read-only invalidIteratorState property of the is true if XPathResult.resultType is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE and the document has been modified since this result was returned.

MDN Reference

NUMBER_TYPE: 1
numberValue: number

The read-only numberValue property of the The return value is the numeric value of the XPathResult returned by In case XPathResult.resultType is not NUMBER_TYPE, a The following example shows the use of the numberValue property.

MDN Reference

ORDERED_NODE_ITERATOR_TYPE: 5
ORDERED_NODE_SNAPSHOT_TYPE: 7
resultType: number

The read-only resultType property of the the type constants.

MDN Reference

singleNodeValue: Node | null

The read-only singleNodeValue property of the null in case no node was matched of a result with FIRST_ORDERED_NODE_TYPE.

MDN Reference

snapshotLength: number

The read-only snapshotLength property of the snapshot.

MDN Reference

STRING_TYPE: 2
stringValue: string

The read-only stringValue property of the The return value is the string value of the XPathResult returned by In case XPathResult.resultType is not STRING_TYPE, a The following example shows the use of the stringValue property.

MDN Reference

UNORDERED_NODE_ITERATOR_TYPE: 4
UNORDERED_NODE_SNAPSHOT_TYPE: 6

Methods

  • The iterateNext() method of the next node from it or null if there are no more nodes.

    MDN Reference

    Returns Node | null

  • The snapshotItem() method of the null in case the index is not within the range of nodes.

    MDN Reference

    Parameters

    • index: number

    Returns Node | null

Was this helpful?