---
title: "XPathResult | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/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](https://developer.mozilla.org/docs/Web/API/XPathResult)

interface XPathResult {  
    [ANY\_TYPE](#any_type): 0;  
    [ANY\_UNORDERED\_NODE\_TYPE](#any_unordered_node_type): 8;  
    [BOOLEAN\_TYPE](#boolean_type): 3;  
    [booleanValue](#booleanvalue): boolean;  
    [FIRST\_ORDERED\_NODE\_TYPE](#first_ordered_node_type): 9;  
    [invalidIteratorState](#invaliditeratorstate): boolean;  
    [NUMBER\_TYPE](#number_type): 1;  
    [numberValue](#numbervalue): number;  
    [ORDERED\_NODE\_ITERATOR\_TYPE](#ordered_node_iterator_type): 5;  
    [ORDERED\_NODE\_SNAPSHOT\_TYPE](#ordered_node_snapshot_type): 7;  
    [resultType](#resulttype): number;  
    [singleNodeValue](#singlenodevalue): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null;  
    [snapshotLength](#snapshotlength): number;  
    [STRING\_TYPE](#string_type): 2;  
    [stringValue](#stringvalue): string;  
    [UNORDERED\_NODE\_ITERATOR\_TYPE](#unordered_node_iterator_type): 4;  
    [UNORDERED\_NODE\_SNAPSHOT\_TYPE](#unordered_node_snapshot_type): 6;  
    [iterateNext](#iteratenext-1)(): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null;  
    [snapshotItem](#snapshotitem-1)(index: number): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null;  
}

##### Index

### Properties[](#properties)

[ANY\_TYPE](#any_type) [ANY\_UNORDERED\_NODE\_TYPE](#any_unordered_node_type) [BOOLEAN\_TYPE](#boolean_type) [booleanValue](#booleanvalue) [FIRST\_ORDERED\_NODE\_TYPE](#first_ordered_node_type) [invalidIteratorState](#invaliditeratorstate) [NUMBER\_TYPE](#number_type) [numberValue](#numbervalue) [ORDERED\_NODE\_ITERATOR\_TYPE](#ordered_node_iterator_type) [ORDERED\_NODE\_SNAPSHOT\_TYPE](#ordered_node_snapshot_type) [resultType](#resulttype) [singleNodeValue](#singlenodevalue) [snapshotLength](#snapshotlength) [STRING\_TYPE](#string_type) [stringValue](#stringvalue) [UNORDERED\_NODE\_ITERATOR\_TYPE](#unordered_node_iterator_type) [UNORDERED\_NODE\_SNAPSHOT\_TYPE](#unordered_node_snapshot_type)

### Methods[](#methods)

[iterateNext](#iteratenext) [snapshotItem](#snapshotitem)

## Properties[](#properties-1)

### `Readonly`ANY\_TYPE[](#any_type)

ANY\_TYPE: 0

### `Readonly`ANY\_UNORDERED\_NODE\_TYPE[](#any_unordered_node_type)

ANY\_UNORDERED\_NODE\_TYPE: 8

### `Readonly`BOOLEAN\_TYPE[](#boolean_type)

BOOLEAN\_TYPE: 3

### `Readonly`booleanValue[](#booleanvalue)

booleanValue: boolean

The read-only **`booleanValue`** property of the XPathResult interface returns the boolean value of a result with XPathResult.resultType being BOOLEAN\_TYPE.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/booleanValue)

### `Readonly`FIRST\_ORDERED\_NODE\_TYPE[](#first_ordered_node_type)

FIRST\_ORDERED\_NODE\_TYPE: 9

### `Readonly`invalidIteratorState[](#invaliditeratorstate)

invalidIteratorState: boolean

The read-only **`invalidIteratorState`** property of the XPathResult interface signifies that the iterator has become invalid. It 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](https://developer.mozilla.org/docs/Web/API/XPathResult/invalidIteratorState)

### `Readonly`NUMBER\_TYPE[](#number_type)

NUMBER\_TYPE: 1

### `Readonly`numberValue[](#numbervalue)

numberValue: number

The read-only **`numberValue`** property of the XPathResult interface returns the numeric value of a result with XPathResult.resultType being NUMBER\_TYPE.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/numberValue)

### `Readonly`ORDERED\_NODE\_ITERATOR\_TYPE[](#ordered_node_iterator_type)

ORDERED\_NODE\_ITERATOR\_TYPE: 5

### `Readonly`ORDERED\_NODE\_SNAPSHOT\_TYPE[](#ordered_node_snapshot_type)

ORDERED\_NODE\_SNAPSHOT\_TYPE: 7

### `Readonly`resultType[](#resulttype)

resultType: number

The read-only **`resultType`** property of the XPathResult interface represents the type of the result, as defined by the type constants.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/resultType)

### `Readonly`singleNodeValue[](#singlenodevalue)

singleNodeValue: [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null

The read-only **`singleNodeValue`** property of the XPathResult interface returns a Node value or null in case no node was matched of a result with XPathResult.resultType being ANY\_UNORDERED\_NODE\_TYPE or FIRST\_ORDERED\_NODE\_TYPE.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/singleNodeValue)

### `Readonly`snapshotLength[](#snapshotlength)

snapshotLength: number

The read-only **`snapshotLength`** property of the XPathResult interface represents the number of nodes in the result snapshot.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/snapshotLength)

### `Readonly`STRING\_TYPE[](#string_type)

STRING\_TYPE: 2

### `Readonly`stringValue[](#stringvalue)

stringValue: string

The read-only **`stringValue`** property of the XPathResult interface returns the string value of a result with XPathResult.resultType being STRING\_TYPE.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/stringValue)

### `Readonly`UNORDERED\_NODE\_ITERATOR\_TYPE[](#unordered_node_iterator_type)

UNORDERED\_NODE\_ITERATOR\_TYPE: 4

### `Readonly`UNORDERED\_NODE\_SNAPSHOT\_TYPE[](#unordered_node_snapshot_type)

UNORDERED\_NODE\_SNAPSHOT\_TYPE: 6

## Methods[](#methods-1)

### iterateNext[](#iteratenext)

-   iterateNext(): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null[](#iteratenext-1)
    
    The **`iterateNext()`** method of the XPathResult interface iterates over a node set result and returns the next node from it or null if there are no more nodes.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/iterateNext)
    
    #### Returns [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null
    

### snapshotItem[](#snapshotitem)

-   snapshotItem(index: number): [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null[](#snapshotitem-1)
    
    The **`snapshotItem()`** method of the XPathResult interface returns an item of the snapshot collection or null in case the index is not within the range of nodes. Unlike the iterator result, the snapshot does not become invalid, but may not correspond to the current document if it is mutated.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/XPathResult/snapshotItem)
    
    #### Parameters
    
    -   index: number
    
    #### Returns [Node](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Node/) | null
