HTML Parser Home Page

org.htmlparser.filters
Class StringFilter

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

public class StringFilter
extends Object
implements NodeFilter

This class accepts all string nodes containing the given string.


Field Summary
protected  boolean mCaseSensitive
          Case sensitive toggle.
protected  Locale mLocale
          The locale to use converting to uppercase in the case insensitive searches.
protected  String mPattern
          The string to search for.
 
Constructor Summary
StringFilter(String pattern)
          Creates a new instance of StringFilter that accepts string nodes containing a certain string.
StringFilter(String pattern, boolean case_sensitive)
          Creates a new instance of StringFilter that accepts string nodes containing a certain string.
StringFilter(String pattern, boolean case_sensitive, Locale locale)
          Creates a new instance of StringFilter that accepts string nodes containing a certain string.
 
Method Summary
 boolean accept(Node node)
          Accept string nodes that contain the string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPattern

protected String mPattern
The string to search for.


mCaseSensitive

protected boolean mCaseSensitive
Case sensitive toggle.


mLocale

protected Locale mLocale
The locale to use converting to uppercase in the case insensitive searches.

Constructor Detail

StringFilter

public StringFilter(String pattern)
Creates a new instance of StringFilter that accepts string nodes containing a certain string. The comparison is case insensitive.

Parameters:
pattern - The pattern to search for.

StringFilter

public StringFilter(String pattern,
                    boolean case_sensitive)
Creates a new instance of StringFilter that accepts string nodes containing a certain string.

Parameters:
pattern - The pattern to search for.
case_sensitive - If true, comparisons are performed respecting case.

StringFilter

public StringFilter(String pattern,
                    boolean case_sensitive,
                    Locale locale)
Creates a new instance of StringFilter that accepts string nodes containing a certain string.

Parameters:
pattern - The pattern to search for.
case_sensitive - If true, comparisons are performed respecting case.
Method Detail

accept

public boolean accept(Node node)
Accept string nodes that contain the string.

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