TreeWalker object
Provides an object that can be used to traverse filtered lists of nodes or elements in a document. This object is ideal for navigating a representation of the document's tree structure.
![]() ![]() |
Members
The TreeWalker object has these types of members:
Methods
The TreeWalker object has these methods.
| Method | Description |
|---|---|
| firstChild |
Retrieves a reference to the first child of the current node of the filtered TreeWalker hierarchy and updates currentNode. |
| lastChild |
Retrieves a reference to the last child of the current node of the filtered TreeWalker hierarchy and updates currentNode. |
| nextNode |
Returns the next node in the NodeIterator or TreeWalker list and updates currentNode. |
| nextSibling |
Retrieves the next sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode. |
| parentNode |
Retrieves the parent object in the document hierarchy relative to the current node and updates currentNode. |
| previousNode |
Returns the previous node in the NodeIterator or TreeWalker list and updates currentNode. |
| previousSibling |
Retrieves the previous sibling of the current node in the filtered TreeWalker hierarchy and updates currentNode. |
Properties
The TreeWalker object has these properties.
| Property | Description |
|---|---|
|
Sets or retrieves where the current node in a filtered TreeWalker hierarchy is positioned. | |
|
Flag to specify whether or not the children of entity reference nodes are visible. | |
|
Gets the function object that the iterator uses to filter nodes that go into TreeWalker hierarchies or NodeIterator lists. | |
|
Gets the root node that was specified when the object was created. | |
|
Gets which node types are presented through the iterator. Nodes that are not accepted are skipped, but their children are still considered. |
Standards information
Remarks
The TreeWalker is dynamic, reflecting the state of the document as it is edited or changed.

