Package org.htmlparser.filters
Class LinkStringFilter
- java.lang.Object
-
- org.htmlparser.filters.LinkStringFilter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,NodeFilter
public class LinkStringFilter extends java.lang.Object implements NodeFilter
This class accepts tags of class LinkTag that contain a link matching a given pattern string. Use this filter to extract LinkTag nodes with URLs containing the desired string.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanmCaseSensitiveFlag indicating case sensitive/insensitive search.protected java.lang.StringmPatternThe pattern to search for in the link.
-
Constructor Summary
Constructors Constructor Description LinkStringFilter(java.lang.String pattern)Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern.LinkStringFilter(java.lang.String pattern, boolean caseSensitive)Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(Node node)Accept nodes that are a LinkTag and have a URL that matches the pattern supplied in the constructor.
-
-
-
Constructor Detail
-
LinkStringFilter
public LinkStringFilter(java.lang.String pattern)
Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern. The match is case insensitive.- Parameters:
pattern- The pattern to match.
-
LinkStringFilter
public LinkStringFilter(java.lang.String pattern, boolean caseSensitive)Creates a LinkStringFilter that accepts LinkTag nodes containing a URL that matches the supplied pattern.- Parameters:
pattern- The pattern to match.caseSensitive- Specifies case sensitivity for the matching process.
-
-
Method Detail
-
accept
public boolean accept(Node node)
Accept nodes that are a LinkTag and have a URL that matches the pattern supplied in the constructor.- Specified by:
acceptin interfaceNodeFilter- Parameters:
node- The node to check.- Returns:
trueif the node is a link with the pattern.
-
-