java.io.Serializable, java.lang.Cloneable, NodeFilterpublic class HasAttributeFilter extends java.lang.Object implements NodeFilter
| Modifier and Type | Field | Description |
|---|---|---|
protected java.lang.String |
mAttribute |
The attribute to check for.
|
protected java.lang.String |
mValue |
The value to check for.
|
| Constructor | Description |
|---|---|
HasAttributeFilter() |
Creates a new instance of HasAttributeFilter.
|
HasAttributeFilter(java.lang.String attribute) |
Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute.
|
HasAttributeFilter(java.lang.String attribute,
java.lang.String value) |
Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute and value.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
accept(Node node) |
Accept tags with a certain attribute.
|
java.lang.String |
getAttributeName() |
Get the attribute name.
|
java.lang.String |
getAttributeValue() |
Get the attribute value.
|
void |
setAttributeName(java.lang.String name) |
Set the attribute name.
|
void |
setAttributeValue(java.lang.String value) |
Set the attribute value.
|
protected java.lang.String mAttribute
protected java.lang.String mValue
public HasAttributeFilter()
false
from accept(org.htmlparser.Node).public HasAttributeFilter(java.lang.String attribute)
attribute - The attribute to search for.public HasAttributeFilter(java.lang.String attribute,
java.lang.String value)
attribute - The attribute to search for.value - The value that must be matched,
or null if any value will match.public java.lang.String getAttributeName()
public void setAttributeName(java.lang.String name)
name - The name of the attribute to accept.public java.lang.String getAttributeValue()
public void setAttributeValue(java.lang.String value)
value - The value of the attribute to accept.
If null, any tag with the attribute,
no matter what it's value is acceptable.public boolean accept(Node node)
accept in interface NodeFilternode - The node to check.true if the node has the attribute
(and value if that is being checked too), false otherwise.HTML Parser is an open source library released under LGPL.