|
HTML Parser Home Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.htmlparser.filters.StringFilter
public class StringFilter
This class accepts all string nodes containing the given string.
This is a fairly simplistic filter, so for more sophisticated
string matching, for example newline and whitespace handling,
use a RegexFilter
instead.
Field Summary | |
---|---|
protected boolean |
mCaseSensitive
Case sensitive toggle. |
protected Locale |
mLocale
The locale to use converting to uppercase in case insensitive searches. |
protected String |
mPattern
The string to search for. |
protected String |
mUpperPattern
The string to really search for (converted to uppercase if necessary). |
Constructor Summary | |
---|---|
StringFilter()
Creates a new instance of StringFilter that accepts all string nodes. |
|
StringFilter(String pattern)
Creates a StringFilter that accepts text nodes containing a string. |
|
StringFilter(String pattern,
boolean sensitive)
Creates a StringFilter that accepts text nodes containing a string. |
|
StringFilter(String pattern,
boolean sensitive,
Locale locale)
Creates a StringFilter that accepts text nodes containing a string. |
Method Summary | |
---|---|
boolean |
accept(Node node)
Accept string nodes that contain the string. |
boolean |
getCaseSensitive()
Get the case sensitivity. |
Locale |
getLocale()
Get the locale for uppercase conversion. |
String |
getPattern()
Get the search pattern. |
void |
setCaseSensitive(boolean sensitive)
Set case sensitivity on or off. |
void |
setLocale(Locale locale)
Set the locale for uppercase conversion. |
void |
setPattern(String pattern)
Set the search pattern. |
protected void |
setUpperPattern()
Set the real (upper case) comparison string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String mPattern
protected String mUpperPattern
protected boolean mCaseSensitive
true
strings are compared with case sensitivity.
protected Locale mLocale
Constructor Detail |
---|
public StringFilter()
public StringFilter(String pattern)
Locale
.
pattern
- The pattern to search for.public StringFilter(String pattern, boolean sensitive)
pattern
- The pattern to search for.sensitive
- If true
, comparisons are performed
respecting case, with conversions done using the default
Locale
.public StringFilter(String pattern, boolean sensitive, Locale locale)
pattern
- The pattern to search for.sensitive
- If true
, comparisons are performed
respecting case.locale
- The locale to use when converting to uppercase.
If null
, the default Locale
is used.Method Detail |
---|
protected void setUpperPattern()
public boolean getCaseSensitive()
public void setCaseSensitive(boolean sensitive)
sensitive
- If false
searches for the
string are case insensitive.public Locale getLocale()
public void setLocale(Locale locale)
locale
- The locale to set.public String getPattern()
public void setPattern(String pattern)
pattern
- The pattern to set.public boolean accept(Node node)
accept
in interface NodeFilter
node
- The node to check.
true
if node
is a Text
node
and contains the pattern string, false
otherwise.
|
© 2006 Derrick Oswald Sep 17, 2006
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
HTML Parser is an open source library released under Common Public License. |