public class HasParentFilter extends java.lang.Object implements NodeFilter
Modifier and Type | Field and Description |
---|---|
protected NodeFilter |
mParentFilter
The filter to apply to the parent.
|
protected boolean |
mRecursive
Performs a recursive search up the node heirarchy if
true . |
Constructor and Description |
---|
HasParentFilter()
Creates a new instance of HasParentFilter.
|
HasParentFilter(NodeFilter filter)
Creates a new instance of HasParentFilter that accepts nodes with
the direct parent acceptable to the filter.
|
HasParentFilter(NodeFilter filter,
boolean recursive)
Creates a new instance of HasParentFilter that accepts nodes with
a parent acceptable to the filter.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Node node)
Accept tags with parent acceptable to the filter.
|
NodeFilter |
getParentFilter()
Get the filter used by this HasParentFilter.
|
boolean |
getRecursive()
Get the recusion setting for the filter.
|
void |
setParentFilter(NodeFilter filter)
Set the filter for this HasParentFilter.
|
void |
setRecursive(boolean recursive)
Sets whether the filter is recursive or not.
|
protected NodeFilter mParentFilter
protected boolean mRecursive
true
.public HasParentFilter()
false
from accept(org.htmlparser.Node)
.public HasParentFilter(NodeFilter filter)
filter
- The filter to apply to the parent.public HasParentFilter(NodeFilter filter, boolean recursive)
filter
- The filter to apply to the parent.recursive
- If true
, any enclosing node acceptable
to the given filter causes the node being tested to be accepted
(i.e. a recursive scan through the parent nodes up the node
heirarchy is performed).public NodeFilter getParentFilter()
public void setParentFilter(NodeFilter filter)
filter
- The filter to apply to parents in accept(org.htmlparser.Node)
.public boolean getRecursive()
true
if the filter is recursive
up the node heirarchy.public void setRecursive(boolean recursive)
recursive
- The recursion setting for the filter.public boolean accept(Node node)
accept
in interface NodeFilter
node
- The node to check.true
if the node has an acceptable parent,
false
otherwise.HTML Parser is an open source library released under LGPL.