TreeWalker objects are used to navigate a document tree or
subtree using the view of the document defined by their
whatToShow flags and filter (if any). Any function which
performs navigation using a TreeWalker will automatically
support any view defined by a TreeWalker.
Omitting nodes from the logical view of a subtree can result in a
structure that is substantially different from the same subtree in the
complete, unfiltered document. Nodes that are siblings in the
TreeWalker view may be children of different, widely
separated nodes in the original view. For instance, consider a
NodeFilter that skips all nodes except for Text nodes and
the root node of a document. In the logical view that results, all text
nodes will be siblings and appear as direct children of the root node, no
matter how deeply nested the structure of the original document.
See also the Document Object Model (DOM) Level 2 Traversal and Range Specification.
| Modifier and Type | Method and Description |
|---|---|
| public Node | Returns: The new node, ornull if the current node has no
visible children in the TreeWalker's logical view.Moves the |
| public Node | |
| public boolean | getExpandEntityReferences()
The value of this flag determines whether the children of entity
reference nodes are visible to the |
| public NodeFilter | |
| public Node | |
| public int | |
| public Node | Returns: The new node, ornull if the current node has no
children in the TreeWalker's logical view.Moves the |
| public Node | Returns: The new node, ornull if the current node has no
next node in the TreeWalker's logical view.Moves the |
| public Node | Returns: The new node, ornull if the current node has no
next sibling. in the TreeWalker's logical view.Moves the |
| public Node | Returns: The new parent node, ornull if the current node
has no parent in the TreeWalker's logical view.Moves to and returns the closest visible ancestor node of the current node. |
| public Node | Returns: The new node, ornull if the current node has no
previous node in the TreeWalker's logical view.Moves the |
| public Node | Returns: The new node, ornull if the current node has no
previous sibling. in the TreeWalker's logical view.Moves the |
| public void |
| firstChild | back to summary |
|---|---|
| public Node firstChild() Moves the
| |
| getCurrentNode | back to summary |
|---|---|
| public Node getCurrentNode() The node at which the | |
| getExpandEntityReferences | back to summary |
|---|---|
| public boolean getExpandEntityReferences() The value of this flag determines whether the children of entity
reference nodes are visible to the | |
| getFilter | back to summary |
|---|---|
| public NodeFilter getFilter() The filter used to screen nodes. | |
| getRoot | back to summary |
|---|---|
| public Node getRoot() The | |
| getWhatToShow | back to summary |
|---|---|
| public int getWhatToShow() This attribute determines which node types are presented via the
| |
| lastChild | back to summary |
|---|---|
| public Node lastChild() Moves the
| |
| nextNode | back to summary |
|---|---|
| public Node nextNode() Moves the
| |
| nextSibling | back to summary |
|---|---|
| public Node nextSibling() Moves the
| |
| parentNode | back to summary |
|---|---|
| public Node parentNode() Moves to and returns the closest visible ancestor node of the current
node. If the search for
| |
| previousNode | back to summary |
|---|---|
| public Node previousNode() Moves the
| |
| previousSibling | back to summary |
|---|---|
| public Node previousSibling() Moves the
| |
| setCurrentNode | back to summary |
|---|---|
| public void setCurrentNode(Node currentNode) throws DOMException The node at which the
| |