public class NodeSelector
extends java.lang.Object
CSS3 selectors
.
Group of queries are supported.Constructor and Description |
---|
NodeSelector(Node rootNode) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
filter(java.util.List<Node> currentResults,
Node node,
CssSelector cssSelector,
int index)
Filter nodes.
|
protected void |
processSelectors(java.util.List<Node> results,
java.util.List<CssSelector> selectors)
Process selectors and keep adding results.
|
java.util.List<Node> |
select(java.util.Collection<java.util.List<CssSelector>> selectorsCollection)
Selected nodes using pre-parsed CSS selectors.
|
java.util.List<Node> |
select(NodeFilter nodeFilter)
Selects nodes using
node filter . |
protected java.util.List<Node> |
select(Node rootNode,
java.util.List<CssSelector> selectors) |
java.util.List<Node> |
select(java.lang.String query)
Selects nodes using CSS3 selector query.
|
protected void |
selectAndAdd(Node node,
CssSelector cssSelector,
java.util.List<Node> result)
Selects single node for single selector and appends it to the results.
|
Node |
selectFirst(NodeFilter nodeFilter)
Selects nodes using
node filter and return the very first one. |
Node |
selectFirst(java.lang.String query)
Selects nodes using CSS3 selector query and returns the very first one.
|
protected void |
walk(Node rootNode,
CssSelector cssSelector,
java.util.List<Node> result)
Finds nodes in the tree that matches single selector.
|
protected void |
walk(Node rootNode,
NodeFilter nodeFilter,
java.util.List<Node> result) |
protected void |
walkDescendantsIteratively(java.util.LinkedList<Node> nodes,
CssSelector cssSelector,
java.util.List<Node> result)
Walks over the child notes, maintaining the tree order and not using recursion.
|
protected final Node rootNode
public NodeSelector(Node rootNode)
public java.util.List<Node> select(java.lang.String query)
public java.util.List<Node> select(java.util.Collection<java.util.List<CssSelector>> selectorsCollection)
protected void processSelectors(java.util.List<Node> results, java.util.List<CssSelector> selectors)
public Node selectFirst(java.lang.String query)
public java.util.List<Node> select(NodeFilter nodeFilter)
node filter
.public Node selectFirst(NodeFilter nodeFilter)
node filter
and return the very first one.protected void walk(Node rootNode, NodeFilter nodeFilter, java.util.List<Node> result)
protected java.util.List<Node> select(Node rootNode, java.util.List<CssSelector> selectors)
protected void walkDescendantsIteratively(java.util.LinkedList<Node> nodes, CssSelector cssSelector, java.util.List<Node> result)
protected void walk(Node rootNode, CssSelector cssSelector, java.util.List<Node> result)
protected void selectAndAdd(Node node, CssSelector cssSelector, java.util.List<Node> result)
protected boolean filter(java.util.List<Node> currentResults, Node node, CssSelector cssSelector, int index)
Copyright © 2003-present Jodd Team