Package org.htmlparser.filters
Class HasSiblingFilter
- java.lang.Object
-
- org.htmlparser.filters.HasSiblingFilter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,NodeFilter
public class HasSiblingFilter extends java.lang.Object implements NodeFilter
This class accepts all tags that have a sibling acceptable to another filter. End tags are not considered to be siblings of any tag.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected NodeFiltermSiblingFilterThe filter to apply to the sibling.
-
Constructor Summary
Constructors Constructor Description HasSiblingFilter()Creates a new instance of HasSiblingFilter.HasSiblingFilter(NodeFilter filter)Creates a new instance of HasSiblingFilter that accepts nodes with sibling acceptable to the filter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccept(Node node)Accept tags with a sibling acceptable to the filter.NodeFiltergetSiblingFilter()Get the filter used by this HasSiblingFilter.voidsetSiblingFilter(NodeFilter filter)Set the filter for this HasSiblingFilter.
-
-
-
Field Detail
-
mSiblingFilter
protected NodeFilter mSiblingFilter
The filter to apply to the sibling.
-
-
Constructor Detail
-
HasSiblingFilter
public HasSiblingFilter()
Creates a new instance of HasSiblingFilter. With no sibling filter, this would always returnfalsefromaccept(org.htmlparser.Node).
-
HasSiblingFilter
public HasSiblingFilter(NodeFilter filter)
Creates a new instance of HasSiblingFilter that accepts nodes with sibling acceptable to the filter.- Parameters:
filter- The filter to apply to the sibling.
-
-
Method Detail
-
getSiblingFilter
public NodeFilter getSiblingFilter()
Get the filter used by this HasSiblingFilter.- Returns:
- The filter to apply to siblings.
-
setSiblingFilter
public void setSiblingFilter(NodeFilter filter)
Set the filter for this HasSiblingFilter.- Parameters:
filter- The filter to apply to siblings inaccept(org.htmlparser.Node).
-
accept
public boolean accept(Node node)
Accept tags with a sibling acceptable to the filter.- Specified by:
acceptin interfaceNodeFilter- Parameters:
node- The node to check.- Returns:
trueif the node has an acceptable sibling,falseotherwise.
-
-