public class CssSelector extends java.lang.Object implements NodeFilter
Modifier and Type | Field and Description |
---|---|
protected Combinator |
combinator |
protected java.lang.String |
element |
protected CssSelector |
nextCssSelector |
protected CssSelector |
prevCssSelector |
protected java.util.List<Selector> |
selectors |
Constructor and Description |
---|
CssSelector() |
CssSelector(java.lang.String element) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.util.List<Node> currentResults,
Node node,
int index)
Accepts node within current results.
|
boolean |
accept(Node node)
Accepts single node.
|
void |
addAttributeSelector(java.lang.String attribute) |
void |
addClassSelector(java.lang.String clazz) |
void |
addIdSelector(java.lang.String id) |
void |
addPseudoClassSelector(java.lang.String pseudoClass) |
void |
addPseudoFunctionSelector(java.lang.String pseudoFunction,
java.lang.String expression) |
Combinator |
getCombinator()
Returns combinator, may be
null . |
java.lang.String |
getElement()
Returns selector element name.
|
CssSelector |
getNextCssSelector()
Returns next
CssSelector . |
CssSelector |
getPrevCssSelector()
Returns previous
CssSelector . |
Selector |
getSelector(int index)
Returns selector for given index.
|
protected boolean |
matchElement(Node node)
Matches element to css selector.
|
int |
selectorsCount()
Returns number of selectors.
|
void |
setCombinator(Combinator combinator)
Sets combinator.
|
java.lang.String |
toString()
Generates CSS selector for the output.
|
protected java.lang.String |
unescape(java.lang.String value)
Unescapes CSS string by removing all backslash characters from it.
|
protected CssSelector prevCssSelector
protected CssSelector nextCssSelector
protected final java.lang.String element
protected Combinator combinator
protected java.util.List<Selector> selectors
public CssSelector()
public CssSelector(java.lang.String element)
public CssSelector getPrevCssSelector()
CssSelector
.public CssSelector getNextCssSelector()
CssSelector
.public java.lang.String getElement()
*
for
universal selectors.public Selector getSelector(int index)
public int selectorsCount()
public void setCombinator(Combinator combinator)
public Combinator getCombinator()
null
.public void addIdSelector(java.lang.String id)
public void addClassSelector(java.lang.String clazz)
public void addAttributeSelector(java.lang.String attribute)
public void addPseudoClassSelector(java.lang.String pseudoClass)
public void addPseudoFunctionSelector(java.lang.String pseudoFunction, java.lang.String expression)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean accept(Node node)
accept
in interface NodeFilter
protected boolean matchElement(Node node)
public boolean accept(java.util.List<Node> currentResults, Node node, int index)
protected java.lang.String unescape(java.lang.String value)
Copyright © 2003-present Jodd Team