dbXML API

## org.dbxml.xml.dom.traversal
Class TreeWalkerImpl

    java.lang.Object
      |
      +--org.dbxml.xml.dom.traversal.TreeWalkerImpl

All Implemented Interfaces:
  org.w3c.dom.traversal.NodeIterator, org.w3c.dom.traversal.TreeWalker

public final class TreeWalkerImpl
extends java.lang.Object
implements org.w3c.dom.traversal.TreeWalker, org.w3c.dom.traversal.NodeIterator

TreeWalkerImpl

Constructor Summary
`TreeWalkerImpl(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)`

Method Summary
`boolean` `acceptNode(org.w3c.dom.Node node)`
`void` `detach()` Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.
`org.w3c.dom.Node` `firstChild()` Moves the `TreeWalker` to the first visible child of the current node, and returns the new node.
`org.w3c.dom.Node` `getCurrentNode()` The node at which the TreeWalker is currently positioned.
`boolean` `getExpandEntityReferences()` The value of this flag determines whether the children of entity reference nodes are visible to the iterator.
`org.w3c.dom.traversal.NodeFilter` `getFilter()` The filter used to screen nodes.
`org.w3c.dom.Node` `getRoot()` The root node of the Iterator, as specified when it was created.
`int` `getShowType(org.w3c.dom.Node node)`
`int` `getWhatToShow()` This attribute determines which node types are presented via the iterator.
`org.w3c.dom.Node` `lastChild()` Moves the `TreeWalker` to the last visible child of the current node, and returns the new node.
`org.w3c.dom.Node` `nextNode()` Moves the `TreeWalker` to the next visible node in document order relative to the current node, and returns the new node.
`org.w3c.dom.Node` `nextSibling()` Moves the `TreeWalker` to the next sibling of the current node, and returns the new node.
`org.w3c.dom.Node` `parentNode()` Moves to and returns the closest visible ancestor node of the current node.
`org.w3c.dom.Node` `previousNode()` Moves the `TreeWalker` to the previous visible node in document order relative to the current node, and returns the new node.
`org.w3c.dom.Node` `previousSibling()` Moves the `TreeWalker` to the previous sibling of the current node, and returns the new node.
`void` `setCurrentNode(org.w3c.dom.Node currentNode)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TreeWalkerImpl

    public TreeWalkerImpl(org.w3c.dom.Node root,
                          int whatToShow,
                          org.w3c.dom.traversal.NodeFilter filter,
                          boolean entityReferenceExpansion)
                   throws org.w3c.dom.DOMException

Method Detail

### getShowType

    public int getShowType(org.w3c.dom.Node node)

### acceptNode

    public boolean acceptNode(org.w3c.dom.Node node)

### getRoot

    public org.w3c.dom.Node getRoot()

  The root node of the Iterator, as specified when it was created.
  Specified by:
    `getRoot` in interface `org.w3c.dom.traversal.TreeWalker`

### getWhatToShow

    public int getWhatToShow()

  This attribute determines which node types are presented via the iterator. The available set of constants is defined in the `NodeFilter` interface.
  Specified by:
    `getWhatToShow` in interface `org.w3c.dom.traversal.TreeWalker`

### getFilter

    public org.w3c.dom.traversal.NodeFilter getFilter()

  The filter used to screen nodes.
  Specified by:
    `getFilter` in interface `org.w3c.dom.traversal.TreeWalker`

### getExpandEntityReferences

    public boolean getExpandEntityReferences()

  The value of this flag determines whether the children of entity reference nodes are visible to the iterator. If false, they will be skipped over.
  To produce a view of the document that has entity references expanded and does not expose the entity reference node itself, use the whatToShow flags to hide the entity reference node and set expandEntityReferences to true when creating the iterator. To produce a view of the document that has entity reference nodes but no entity expansion, use the whatToShow flags to show the entity reference node and set expandEntityReferences to false.
  Specified by:
    `getExpandEntityReferences` in interface `org.w3c.dom.traversal.TreeWalker`

### detach

    public void detach()

  Detaches the iterator from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state. After`detach` has been invoked, calls to `nextNode` or`previousNode` will raise the exception INVALID_STATE_ERR.
  Specified by:
    `detach` in interface `org.w3c.dom.traversal.NodeIterator`

### getCurrentNode

    public org.w3c.dom.Node getCurrentNode()

  The node at which the TreeWalker is currently positioned.
  The value must not be null. Alterations to the DOM tree may cause the current node to no longer be accepted by the TreeWalker's associated filter. currentNode may also be explicitly set to any node, whether or not it is within the subtree specified by the root node or would be accepted by the filter and whatToShow flags. Further traversal occurs relative to currentNode even if it is not part of the current view by applying the filters in the requested direction (not changing currentNode where no traversal is possible).
  Specified by:
    `getCurrentNode` in interface `org.w3c.dom.traversal.TreeWalker`
  Throws:
    `org.w3c.dom.DOMException` - NOT_SUPPORTED_ERR: Raised if the specified `currentNode` is`null` .

### setCurrentNode

    public void setCurrentNode(org.w3c.dom.Node currentNode)
                        throws org.w3c.dom.DOMException

  Specified by:
    `setCurrentNode` in interface `org.w3c.dom.traversal.TreeWalker`

### parentNode

    public org.w3c.dom.Node parentNode()

  Moves to and returns the closest visible ancestor node of the current node. If the search for parentNode attempts to step upward from the TreeWalker's root node, or if it fails to find a visible ancestor node, this method retains the current position and returns null.
  Specified by:
    `parentNode` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new parent node, or null if the current node has no parent in the TreeWalker's logical view.

### firstChild

    public org.w3c.dom.Node firstChild()

  Moves the `TreeWalker` to the first visible child of the current node, and returns the new node. If the current node has no visible children, returns `null` , and retains the current node.
  Specified by:
    `firstChild` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no visible children in the TreeWalker's logical view.

### lastChild

    public org.w3c.dom.Node lastChild()

  Moves the `TreeWalker` to the last visible child of the current node, and returns the new node. If the current node has no visible children, returns `null` , and retains the current node.
  Specified by:
    `lastChild` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no children in the TreeWalker's logical view.

### previousSibling

    public org.w3c.dom.Node previousSibling()

  Moves the `TreeWalker` to the previous sibling of the current node, and returns the new node. If the current node has no visible previous sibling, returns `null` , and retains the current node.
  Specified by:
    `previousSibling` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no previous sibling in the TreeWalker's logical view.

### nextSibling

    public org.w3c.dom.Node nextSibling()

  Moves the `TreeWalker` to the next sibling of the current node, and returns the new node. If the current node has no visible next sibling, returns `null` , and retains the current node.
  Specified by:
    `nextSibling` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no next sibling in the TreeWalker's logical view.

### previousNode

    public org.w3c.dom.Node previousNode()

  Moves the `TreeWalker` to the previous visible node in document order relative to the current node, and returns the new node. If the current node has no previous node, or if the search for previousNode attempts to step upward from the TreeWalker's root node, returns `null` , and retains the current node.
  Specified by:
    `previousNode` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no previous node in the TreeWalker's logical view.

### nextNode

    public org.w3c.dom.Node nextNode()

  Moves the `TreeWalker` to the next visible node in document order relative to the current node, and returns the new node. If the current node has no next node, or if the search for nextNode attempts to step upward from the TreeWalker's root node, returns `null` , and retains the current node.
  Specified by:
    `nextNode` in interface `org.w3c.dom.traversal.TreeWalker`
  Returns:
    The new node, or `null` if the current node has no next node in the TreeWalker's logical view.

dbXML API

Copyright (c) 1999-2001 The dbXML Group, All rights reserved