HTML Parser Home Page

org.htmlparser.filters
Class HasAttributeFilter

java.lang.Object
  extended byorg.htmlparser.filters.HasAttributeFilter
All Implemented Interfaces:
NodeFilter

public class HasAttributeFilter
extends Object
implements NodeFilter

This class accepts all tags that have a certain attribute, and optionally, with a certain value.


Field Summary
protected  String mAttribute
          The attribute to check for.
protected  String mValue
          The value to check for.
 
Constructor Summary
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.
 
Method Summary
 boolean accept(Node node)
          Accept tags with a certain attribute.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mAttribute

protected String mAttribute
The attribute to check for.


mValue

protected String mValue
The value to check for.

Constructor Detail

HasAttributeFilter

public HasAttributeFilter(String attribute)
Creates a new instance of HasAttributeFilter that accepts tags with the given attribute.

Parameters:
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.

Parameters:
attribute - The attribute to search for.
value - The value that must be matched, or null if any value will match.
Method Detail

accept

public boolean accept(Node node)
Accept tags with a certain attribute.

Specified by:
accept in interface NodeFilter
Parameters:
node - The node to check.
Returns:
true if the node is to be kept, false if it is to be discarded.

© 2004 Somik Raha
Mar 14, 2004

HTML Parser is an open source library released under LGPL.
SourceForge.net