public class XMLTreeWalker
extends java.lang.Object
Constructor and Description |
---|
XMLTreeWalker(XMLNode rootNode)
Create a new XMLTreeWalker.
|
Modifier and Type | Method and Description |
---|---|
void |
addToParentFilters(XMLNode node)
Add a node to the parent tags.
|
XMLNode |
firstChild()
Moves the TreeWalker to the first visible child of the current node, and returns the new node.
|
java.lang.String |
getCurrentFilterName()
Return the filter name for the current node.
|
XMLNode |
getCurrentNode()
Return the node at which the TreeWalker is currently positioned.
|
int |
getLevel()
Return the level in the XML subtree, the 0 value designing the root Node.
|
java.util.Map<java.lang.String,java.lang.Boolean> |
getParentFilterStates()
Return the states of the parent tags.
|
XMLNode |
getRoot()
The root node of the TreeWalker, as specified when it was created.
|
boolean |
hasCurrentFilterName()
Return true if there is a filter name for the current node.
|
boolean |
hasNext()
Return true if there is a next node.
|
boolean |
inParentFilter(java.lang.String filterName)
Return true if the current node is inside the specified parent filter.
|
XMLNode |
lastChild()
Moves the TreeWalker to the last visible child of the current node, and returns the new node.
|
XMLNode |
nextNode()
Moves the TreeWalker to the next visible node in document order relative to the current node, and returns the new
node.
|
XMLNode |
nextSibling()
Moves the TreeWalker to the next sibling of the current node, and returns the new node.
|
XMLNode |
parentNode()
Moves to and returns the closest visible ancestor node of the current node.
|
XMLNode |
previousNode()
Moves the TreeWalker to the previous visible node in document order relative to the current node, and returns the
new node.
|
XMLNode |
previousSibling()
Moves the TreeWalker to the previous sibling of the current node, and returns the new node.
|
void |
setCurrentNode(XMLNode node)
Set the current Node.
|
void |
setParentFilters(java.util.Map<java.lang.String,NodeFilter> parentFilters)
Set the parent filters to check.
|
void |
setParentFilters(NodeFilter... filters)
Set the filters to check.
|
public XMLTreeWalker(XMLNode rootNode)
rootNode
- the root Node of this walkerpublic final void setParentFilters(NodeFilter... filters)
filters
- the filterspublic final void setParentFilters(java.util.Map<java.lang.String,NodeFilter> parentFilters)
parentFilters
- the filterspublic boolean hasCurrentFilterName()
public java.lang.String getCurrentFilterName()
public java.util.Map<java.lang.String,java.lang.Boolean> getParentFilterStates()
public void addToParentFilters(XMLNode node)
node
- the nodepublic boolean inParentFilter(java.lang.String filterName)
filterName
- the filter namepublic void setCurrentNode(XMLNode node)
node
- the nodepublic int getLevel()
public XMLNode firstChild()
public XMLNode getCurrentNode()
public XMLNode getRoot()
public XMLNode lastChild()
public XMLNode nextNode()
public boolean hasNext()
public XMLNode nextSibling()
public XMLNode previousSibling()
public XMLNode parentNode()
public XMLNode previousNode()
Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence