org.htmlparser.filters
Class HasChildFilter
- Cloneable, NodeFilter, Serializable
public class HasChildFilter
This class accepts all tags that have a child acceptable to the filter.
It can be set to operate recursively, that is perform a scan down
through the node heirarchy in a breadth first traversal looking for any
descendant that matches the predicate filter (which stops the search).
HasChildFilter() - Creates a new instance of a HasChildFilter.
|
HasChildFilter(NodeFilter filter) - Creates a new instance of HasChildFilter that accepts nodes
with a direct child acceptable to the filter.
|
HasChildFilter(NodeFilter filter, boolean recursive) - Creates a new instance of HasChildFilter that accepts nodes
with a child acceptable to the filter.
|
mChildFilter
protected NodeFilter mChildFilter
The filter to apply to children.
mRecursive
protected boolean mRecursive
Performs a recursive search down the node heirarchy if true
.
HasChildFilter
public HasChildFilter()
Creates a new instance of a HasChildFilter.
With no child filter, this would always return
false
from
accept(Node)
.
HasChildFilter
public HasChildFilter(NodeFilter filter)
Creates a new instance of HasChildFilter that accepts nodes
with a direct child acceptable to the filter.
filter
- The filter to apply to the children.
HasChildFilter
public HasChildFilter(NodeFilter filter,
boolean recursive)
Creates a new instance of HasChildFilter that accepts nodes
with a child acceptable to the filter.
Of necessity, this applies only to composite tags, i.e. those that can
contain other nodes, for example <HTML></HTML>.
filter
- The filter to apply to children.recursive
- If true
, any enclosed node acceptable
to the given filter causes the node being tested to be accepted
(i.e. a recursive scan through the child nodes down the node
heirarchy is performed).
accept
public boolean accept(Node node)
Accept tags with children acceptable to the filter.
- accept in interface NodeFilter
node
- The node to check.
true
if the node has an acceptable child,
false
otherwise.
getChildFilter
public NodeFilter getChildFilter()
Get the filter used by this HasParentFilter.
- The filter to apply to parents.
getRecursive
public boolean getRecursive()
Get the recusion setting for the filter.
- Returns
true
if the filter is recursive
up the node heirarchy.
setChildFilter
public void setChildFilter(NodeFilter filter)
Set the filter for this HasParentFilter.
setRecursive
public void setRecursive(boolean recursive)
Sets whether the filter is recursive or not.
recursive
- The recursion setting for the filter.
| © 2005 Derrick Oswald Mai 08, 2008 |
HTML Parser is an open source library released under LGPL. |  |