public class HasAttributeFilter extends java.lang.Object implements NodeFilter
构造器和说明 |
---|
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.
|
限定符和类型 | 方法和说明 |
---|---|
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.
|
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
在接口中 NodeFilter
node
- The node to check.true
if the node has the attribute
(and value if that is being checked too), false
otherwise.