Package org.htmlparser.filters
Class TagNameFilter
- java.lang.Object
-
- org.htmlparser.filters.TagNameFilter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,NodeFilter
public class TagNameFilter extends java.lang.Object implements NodeFilter
This class accepts all tags matching the tag name.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringmNameThe tag name to match.
-
Constructor Summary
Constructors Constructor Description TagNameFilter()Creates a new instance of TagNameFilter.TagNameFilter(java.lang.String name)Creates a TagNameFilter that accepts tags with the given name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(Node node)Accept nodes that are tags and have a matching tag name.java.lang.StringgetName()Get the tag name.voidsetName(java.lang.String name)Set the tag name.
-
-
-
Constructor Detail
-
TagNameFilter
public TagNameFilter()
Creates a new instance of TagNameFilter. With no name, this would always returnfalsefromaccept(org.htmlparser.Node).
-
TagNameFilter
public TagNameFilter(java.lang.String name)
Creates a TagNameFilter that accepts tags with the given name.- Parameters:
name- The tag name to match.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the tag name.- Returns:
- Returns the name of acceptable tags.
-
setName
public void setName(java.lang.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:
acceptin interfaceNodeFilter- Parameters:
node- The node to check.- Returns:
trueif the tag name matches,falseotherwise.
-
-