Package org.jsoup.select
Class NodeTraversor
java.lang.Object
org.jsoup.select.NodeTraversor
public class NodeTraversor extends Object
Depth-first node traversor. Use to iterate through all nodes under and including the specified root node.
This implementation does not use recursion, so a deep DOM does not risk blowing the stack.
-
Constructor Summary
Constructors Constructor Description NodeTraversor(NodeVisitor visitor)Deprecated.Just use the staticfilter(NodeFilter, Node)method. -
Method Summary
Modifier and Type Method Description static NodeFilter.FilterResultfilter(NodeFilter filter, Node root)Start a depth-first filtering of the root and all of its descendants.static voidfilter(NodeFilter filter, Elements elements)Start a depth-first filtering of all elements.voidtraverse(Node root)Deprecated.Just use the staticfilter(NodeFilter, Node)method.static voidtraverse(NodeVisitor visitor, Node root)Start a depth-first traverse of the root and all of its descendants.static voidtraverse(NodeVisitor visitor, Elements elements)Start a depth-first traverse of all elements.
-
Constructor Details
-
NodeTraversor
Deprecated.Just use the staticfilter(NodeFilter, Node)method.Create a new traversor.- Parameters:
visitor- a class implementing theNodeVisitorinterface, to be called when visiting each node.
-
-
Method Details
-
traverse
Deprecated.Just use the staticfilter(NodeFilter, Node)method.Start a depth-first traverse of the root and all of its descendants.- Parameters:
root- the root node point to traverse.
-
traverse
Start a depth-first traverse of the root and all of its descendants.- Parameters:
visitor- Node visitor.root- the root node point to traverse.
-
traverse
Start a depth-first traverse of all elements.- Parameters:
visitor- Node visitor.elements- Elements to filter.
-
filter
Start a depth-first filtering of the root and all of its descendants.- Parameters:
filter- Node visitor.root- the root node point to traverse.- Returns:
- The filter result of the root node, or
NodeFilter.FilterResult.STOP.
-
filter
Start a depth-first filtering of all elements.- Parameters:
filter- Node filter.elements- Elements to filter.
-