org.htmlparser.filters

Class HasSiblingFilter

Implemented Interfaces:
Cloneable, NodeFilter, Serializable

public class HasSiblingFilter
extends 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.

Field Summary

protected NodeFilter
mSiblingFilter
The filter to apply to the sibling.

Constructor Summary

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

boolean
accept(Node node)
Accept tags with a sibling acceptable to the filter.
NodeFilter
getSiblingFilter()
Get the filter used by this HasSiblingFilter.
void
setSiblingFilter(NodeFilter filter)
Set the filter for this HasSiblingFilter.

Field Details

mSiblingFilter

protected NodeFilter mSiblingFilter
The filter to apply to the sibling.

Constructor Details

HasSiblingFilter

public HasSiblingFilter()

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 Details

accept

public boolean accept(Node node)
Accept tags with a sibling acceptable to the filter.
Specified by:
accept in interface NodeFilter
Parameters:
node - The node to check.
Returns:
true if the node has an acceptable sibling, false otherwise.

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 in accept(Node).

HTML Parser is an open source library released under LGPL. SourceForge.net