Package org.htmlunit.html
Class HtmlDomTreeWalker
java.lang.Object
org.htmlunit.html.HtmlDomTreeWalker
- All Implemented Interfaces:
Serializable
In general this is an implementation of org.w3c.dom.traversal.TreeWalker.
The class org.w3c.dom.traversal.TreeWalker is not available on Android
therefore we have this impl as backend.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionHtmlDomTreeWalker
(DomNode root, int whatToShow, NodeFilter filter, boolean expandEntityReferences) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static int
getFlagForNode
(Node node) INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Given aNode
, return the appropriate constant for whatToShow.getRoot()
int
nextNode()
void
setCurrentNode
(Node currentNode)
-
Constructor Details
-
HtmlDomTreeWalker
public HtmlDomTreeWalker(DomNode root, int whatToShow, NodeFilter filter, boolean expandEntityReferences) throws DOMException Creates an instance.- Parameters:
root
- The root node of the TreeWalker. Must not benull
.whatToShow
- Flag specifying which types of nodes appear in the logical view of the TreeWalker. SeeNodeFilter
for the set of possible Show_ values.filter
- TheNodeFilter
to be used with this TreeWalker, ornull
to indicate no filter.expandEntityReferences
- If false, the contents of EntityReference nodes are not present in the logical view.- Throws:
DOMException
- on attempt to create a TreeWalker with a root that isnull
.
-
-
Method Details
-
getRoot
- Returns:
- the root node
- See Also:
-
getWhatToShow
public int getWhatToShow()- Returns:
- NodeFilter constant
- See Also:
-
getFilter
- Returns:
- the filter
- See Also:
-
getExpandEntityReferences
public boolean getExpandEntityReferences()- Returns:
- the ExpandEntityReferences setting
- See Also:
-
getCurrentNode
- Returns:
- the current node
- See Also:
-
setCurrentNode
- Parameters:
currentNode
- the current node- Throws:
DOMException
- if the current node provides is null- See Also:
-
nextNode
- Returns:
- the next node
- See Also:
-
getFlagForNode
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Given aNode
, return the appropriate constant for whatToShow.- Parameters:
node
- the node- Returns:
- the whatToShow constant for the type of specified node
-
nextSibling
- Returns:
- the next sibling node
- See Also:
-
parentNode
- Returns:
- the parent node
- See Also:
-
previousSibling
- Returns:
- the previous sibling node
- See Also:
-
lastChild
- Returns:
- the last child node
- See Also:
-
previousNode
- Returns:
- the previous node
- See Also:
-
firstChild
- Returns:
- the first child node
- See Also:
-