Package org.jsoup.select
Class NodeTraversor
java.lang.Object
org.jsoup.select.NodeTraversor
public class NodeTraversor
extends Object
A depth-first node traversor. Use to walk through all nodes under and including the specified root node, in document
order. The
NodeVisitor.head( Node, int) and NodeVisitor.tail( Node, int) methods will be called for
each node.
During the head( visit, DOM structural changes around the node currently being visited are
supported, including Node.replaceWith( and Node.remove(. See
head( for the traversal contract after mutation. Other non-structural node
changes are also supported.
DOM structural changes to the current node are not supported during the tail( visit.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NodeFilter.FilterResultfilter(NodeFilter filter, Node root) Run a depth-first controllable traversal of the root and all of its descendants.static voidfilter(NodeFilter filter, Elements elements) Run a depth-first controllable traversal of each Element.static voidtraverse(NodeVisitor visitor, Node root) Run a depth-first traverse of the root and all of its descendants.static voidtraverse(NodeVisitor visitor, Elements elements) Run a depth-first traversal of each Element.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Method Details
-
traverse
Run a depth-first traverse of the root and all of its descendants.- Parameters:
visitor- Node visitor.root- the initial node point to traverse.- See Also:
-
traverse
Run a depth-first traversal of each Element.- Parameters:
visitor- Node visitor.elements- Elements to traverse.
-
filter
Run a depth-first controllable traversal of the root and all of its descendants.- Parameters:
filter- NodeFilter visitor.root- the root node point to traverse.- Returns:
- The filter result of the root node, or
NodeFilter.FilterResult.STOP. - See Also:
-
filter
Run a depth-first controllable traversal of each Element.- Parameters:
filter- NodeFilter visitor.- See Also:
-