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 traversal, structural changes to nodes are supported (e.g. {Node.replaceWith(Node)
, Node.remove()
}
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic NodeFilter.FilterResult
filter
(NodeFilter filter, Node root) Run a depth-first filtered traversal of the root and all of its descendants.static void
filter
(NodeFilter filter, Elements elements) Run a depth-first filtered traversal of each Element.static void
traverse
(NodeVisitor visitor, Node root) Run a depth-first traverse of the root and all of its descendants.static void
traverse
(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 filtered 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 filtered traversal of each Element.- Parameters:
-
filter
- NodeFilter visitor. - See Also:
-