XML DOM iterateNext() method

Definition and usage

The iterateNext() method returns the next node that matches an XPath query.

Syntax:

iterateNext()

Return value

Returns the next node in the list of matching nodes, or null if there are no other nodes.

Throw

Since XPathResult is returned, if the document has been modified, this method will throw an exception. An exception will also be thrown if the method is called when resultType is not UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE.

Description

The iterateNext() method returns the next node that matches the XPath query, or null if all matching nodes have been returned.

Use this method when XPathResult is UNORDERED_NODE_ITERATOR_TYPE or ORDERED_NODE_ITERATOR_TYPE. If the type is ordered, nodes are returned in the order they appear in the document; otherwise, they are returned in any order.

If the invalidIteratorState property is true, the document has been modified, and this method throws an exception.