org.htmlparser.filters
Class HasAttributeFilter
- Cloneable, NodeFilter, Serializable
public class HasAttributeFilter
This class accepts all tags that have a certain attribute,
and optionally, with a certain value.
protected String | mAttribute- The attribute to check for.
|
protected String | mValue- The value to check for.
|
HasAttributeFilter()- Creates a new instance of HasAttributeFilter.
|
HasAttributeFilter(String attribute)- Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute.
|
HasAttributeFilter(String attribute, String value)- Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute and value.
|
mAttribute
protected String mAttribute
The attribute to check for.
mValue
protected String mValue
The value to check for.
HasAttributeFilter
public HasAttributeFilter()
Creates a new instance of HasAttributeFilter.
With no attribute name, this would always return
false
from
accept(Node).
HasAttributeFilter
public HasAttributeFilter(String attribute)
Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute.
attribute - The attribute to search for.
HasAttributeFilter
public HasAttributeFilter(String attribute,
String value) Creates a new instance of HasAttributeFilter that accepts tags
with the given attribute and value.
attribute - The attribute to search for.value - The value that must be matched,
or null if any value will match.
accept
public boolean accept(Node node)
Accept tags with a certain attribute.
- accept in interface NodeFilter
node - The node to check.
true if the node has the attribute
(and value if that is being checked too), false otherwise.
getAttributeName
public String getAttributeName()
Get the attribute name.
- Returns the name of the attribute that is acceptable.
getAttributeValue
public String getAttributeValue()
Get the attribute value.
- Returns the value of the attribute that is acceptable.
setAttributeName
public void setAttributeName(String name)
Set the attribute name.
name - The name of the attribute to accept.
setAttributeValue
public void setAttributeValue(String value)
Set the attribute value.
value - The value of the attribute to accept.
If null, any tag with the attribute,
no matter what it's value is acceptable.
| © 2005 Derrick Oswald Mai 08, 2008 |
| HTML Parser is an open source library released under LGPL. |  |