Package org.htmlunit.html

# Class HtmlDomTreeWalker

java.lang.Object
org.htmlunit.html.HtmlDomTreeWalker

All Implemented Interfaces:
  `Serializable`

public class HtmlDomTreeWalker extends Object implements 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:
  - DOM-Level-2-Traversal-Range
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HtmlDomTreeWalker(DomNode root, int whatToShow, NodeFilter filter, boolean expandEntityReferences)`
  Creates an instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `DomNode`
  `firstChild()`
  `DomNode`
  `getCurrentNode()`
  `boolean`
  `getExpandEntityReferences()`
  `NodeFilter`
  `getFilter()`
  `static int`
  `getFlagForNode(Node node)`
  INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
  Given a `Node`, return the appropriate constant for whatToShow.
  `DomNode`
  `getRoot()`
  `int`
  `getWhatToShow()`
  `DomNode`
  `lastChild()`
  `DomNode`
  `nextNode()`
  `DomNode`
  `nextSibling()`
  `DomNode`
  `parentNode()`
  `DomNode`
  `previousNode()`
  `DomNode`
  `previousSibling()`
  `void`
  `setCurrentNode(Node currentNode)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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 be `null`.
      `whatToShow` - Flag specifying which types of nodes appear in the logical view of the TreeWalker. See `NodeFilter` for the set of possible Show_ values.
      `filter` - The `NodeFilter` to be used with this TreeWalker, or `null` 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 is `null`.

- ## Method Details

  - ### getRoot

    public DomNode getRoot()
    Returns:
      the root node
    See Also:
      - `TreeWalker.getRoot()`

  - ### getWhatToShow

    public int getWhatToShow()
    Returns:
      NodeFilter constant
    See Also:
      - `TreeWalker.getWhatToShow()`

  - ### getFilter

    public NodeFilter getFilter()
    Returns:
      the filter
    See Also:
      - `TreeWalker.getFilter()`

  - ### getExpandEntityReferences

    public boolean getExpandEntityReferences()
    Returns:
      the ExpandEntityReferences setting
    See Also:
      - `TreeWalker.getExpandEntityReferences()`

  - ### getCurrentNode

    public DomNode getCurrentNode()
    Returns:
      the current node
    See Also:
      - `TreeWalker.getCurrentNode()`

  - ### setCurrentNode

    public void setCurrentNode(Node currentNode) throws DOMException
    Parameters:
      `currentNode` - the current node
    Throws:
      `DOMException` - if the current node provides is null
    See Also:
      - `TreeWalker.setCurrentNode(Node)`

  - ### nextNode

    public DomNode nextNode()
    Returns:
      the next node
    See Also:
      - `TreeWalker.nextNode()`

  - ### getFlagForNode

    public static int getFlagForNode(Node node)
    INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
    Given a `Node`, return the appropriate constant for whatToShow.
    Parameters:
      `node` - the node
    Returns:
      the whatToShow constant for the type of specified node

  - ### nextSibling

    public DomNode nextSibling()
    Returns:
      the next sibling node
    See Also:
      - `TreeWalker.nextSibling()`

  - ### parentNode

    public DomNode parentNode()
    Returns:
      the parent node
    See Also:
      - `TreeWalker.parentNode()`

  - ### previousSibling

    public DomNode previousSibling()
    Returns:
      the previous sibling node
    See Also:
      - `TreeWalker.previousSibling()`

  - ### lastChild

    public DomNode lastChild()
    Returns:
      the last child node
    See Also:
      - `TreeWalker.lastChild()`

  - ### previousNode

    public DomNode previousNode()
    Returns:
      the previous node
    See Also:
      - `TreeWalker.previousNode()`

  - ### firstChild

    public DomNode firstChild()
    Returns:
      the first child node
    See Also:
      - `TreeWalker.firstChild()`