HTML Parser Home Page

org.htmlparser.filters
Class TagNameFilter

java.lang.Object
  extended by org.htmlparser.filters.TagNameFilter
All Implemented Interfaces:
Serializable, Cloneable, NodeFilter

public class TagNameFilter
extends Object
implements NodeFilter

This class accepts all tags matching the tag name.

See Also:
Serialized Form

Field Summary
protected  String mName
          The tag name to match.
 
Constructor Summary
TagNameFilter()
          Creates a new instance of TagNameFilter.
TagNameFilter(String name)
          Creates a TagNameFilter that accepts tags with the given name.
 
Method Summary
 boolean accept(Node node)
          Accept nodes that are tags and have a matching tag name.
 String getName()
          Get the tag name.
 void setName(String name)
          Set the tag name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mName

protected String mName
The tag name to match.

Constructor Detail

TagNameFilter

public TagNameFilter()
Creates a new instance of TagNameFilter. With no name, this would always return false from accept(org.htmlparser.Node).


TagNameFilter

public TagNameFilter(String name)
Creates a TagNameFilter that accepts tags with the given name.

Parameters:
name - The tag name to match.
Method Detail

getName

public String getName()
Get the tag name.

Returns:
Returns the name of acceptable tags.

setName

public void setName(String name)
Set the tag name.

Parameters:
name - The name of the tag to accept.

accept

public boolean accept(Node node)
Accept nodes that are tags and have a matching tag name. This discards non-tag nodes and end tags. The end tags are available on the enclosing non-end tag.

Specified by:
accept in interface NodeFilter
Parameters:
node - The node to check.
Returns:
true if the tag name matches, false otherwise.

© 2005 Derrick Oswald
Jun 10, 2006

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