+++ /dev/null
-/*\r
- * Copyright (c) 2000 World Wide Web Consortium,\r
- * (Massachusetts Institute of Technology, Institut National de\r
- * Recherche en Informatique et en Automatique, Keio University). All\r
- * Rights Reserved. This program is distributed under the W3C's Software\r
- * Intellectual Property License. This program is distributed in the\r
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even\r
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
- * PURPOSE.\r
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.\r
- */\r
-\r
-package org.w3c.dom.traversal;\r
-\r
-import org.w3c.dom.Node;\r
-import org.w3c.dom.DOMException;\r
-\r
-/**\r
- * <code>TreeWalker</code> objects are used to navigate a document tree or \r
- * subtree using the view of the document defined by their \r
- * <code>whatToShow</code> flags and filter (if any). Any function which \r
- * performs navigation using a <code>TreeWalker</code> will automatically \r
- * support any view defined by a <code>TreeWalker</code>.\r
- * <p>Omitting nodes from the logical view of a subtree can result in a \r
- * structure that is substantially different from the same subtree in the \r
- * complete, unfiltered document. Nodes that are siblings in the \r
- * <code>TreeWalker</code> view may be children of different, widely \r
- * separated nodes in the original view. For instance, consider a \r
- * <code>NodeFilter</code> that skips all nodes except for Text nodes and \r
- * the root node of a document. In the logical view that results, all text \r
- * nodes will be siblings and appear as direct children of the root node, no \r
- * matter how deeply nested the structure of the original document.\r
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.\r
- * @since DOM Level 2\r
- */\r
-public interface TreeWalker {\r
- /**\r
- * The <code>root</code> node of the <code>TreeWalker</code>, as specified \r
- * when it was created.\r
- */\r
- public Node getRoot();\r
-\r
- /**\r
- * This attribute determines which node types are presented via the \r
- * <code>TreeWalker</code>. The available set of constants is defined in \r
- * the <code>NodeFilter</code> interface. Nodes not accepted by \r
- * <code>whatToShow</code> will be skipped, but their children may still \r
- * be considered. Note that this skip takes precedence over the filter, \r
- * if any. \r
- */\r
- public int getWhatToShow();\r
-\r
- /**\r
- * The filter used to screen nodes.\r
- */\r
- public NodeFilter getFilter();\r
-\r
- /**\r
- * The value of this flag determines whether the children of entity \r
- * reference nodes are visible to the <code>TreeWalker</code>. If false, \r
- * they and their descendants will be rejected. Note that this \r
- * rejection takes precedence over <code>whatToShow</code> and the \r
- * filter, if any. \r
- * <br> To produce a view of the document that has entity references \r
- * expanded and does not expose the entity reference node itself, use \r
- * the <code>whatToShow</code> flags to hide the entity reference node \r
- * and set <code>expandEntityReferences</code> to true when creating the \r
- * <code>TreeWalker</code>. To produce a view of the document that has \r
- * entity reference nodes but no entity expansion, use the \r
- * <code>whatToShow</code> flags to show the entity reference node and \r
- * set <code>expandEntityReferences</code> to false.\r
- */\r
- public boolean getExpandEntityReferences();\r
-\r
- /**\r
- * The node at which the <code>TreeWalker</code> is currently positioned.\r
- * <br>Alterations to the DOM tree may cause the current node to no longer \r
- * be accepted by the <code>TreeWalker</code>'s associated filter. \r
- * <code>currentNode</code> may also be explicitly set to any node, \r
- * whether or not it is within the subtree specified by the \r
- * <code>root</code> node or would be accepted by the filter and \r
- * <code>whatToShow</code> flags. Further traversal occurs relative to \r
- * <code>currentNode</code> even if it is not part of the current view, \r
- * by applying the filters in the requested direction; if no traversal \r
- * is possible, <code>currentNode</code> is not changed. \r
- * @exception DOMException\r
- * NOT_SUPPORTED_ERR: Raised if an attempt is made to set \r
- * <code>currentNode</code> to <code>null</code>.\r
- */\r
- public Node getCurrentNode();\r
- public void setCurrentNode(Node currentNode)\r
- throws DOMException;\r
-\r
- /**\r
- * Moves to and returns the closest visible ancestor node of the current \r
- * node. If the search for <code>parentNode</code> attempts to step \r
- * upward from the <code>TreeWalker</code>'s <code>root</code> node, or \r
- * if it fails to find a visible ancestor node, this method retains the \r
- * current position and returns <code>null</code>.\r
- * @return The new parent node, or <code>null</code> if the current node \r
- * has no parent in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node parentNode();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the first visible child of the \r
- * current node, and returns the new node. If the current node has no \r
- * visible children, returns <code>null</code>, and retains the current \r
- * node.\r
- * @return The new node, or <code>null</code> if the current node has no \r
- * visible children in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node firstChild();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the last visible child of the \r
- * current node, and returns the new node. If the current node has no \r
- * visible children, returns <code>null</code>, and retains the current \r
- * node.\r
- * @return The new node, or <code>null</code> if the current node has no \r
- * children in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node lastChild();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the previous sibling of the \r
- * current node, and returns the new node. If the current node has no \r
- * visible previous sibling, returns <code>null</code>, and retains the \r
- * current node.\r
- * @return The new node, or <code>null</code> if the current node has no \r
- * previous sibling. in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node previousSibling();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the next sibling of the current \r
- * node, and returns the new node. If the current node has no visible \r
- * next sibling, returns <code>null</code>, and retains the current node.\r
- * @return The new node, or <code>null</code> if the current node has no \r
- * next sibling. in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node nextSibling();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the previous visible node in \r
- * document order relative to the current node, and returns the new \r
- * node. If the current node has no previous node, or if the search for \r
- * <code>previousNode</code> attempts to step upward from the \r
- * <code>TreeWalker</code>'s <code>root</code> node, returns \r
- * <code>null</code>, and retains the current node. \r
- * @return The new node, or <code>null</code> if the current node has no \r
- * previous node in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node previousNode();\r
-\r
- /**\r
- * Moves the <code>TreeWalker</code> to the next visible node in document \r
- * order relative to the current node, and returns the new node. If the \r
- * current node has no next node, or if the search for nextNode attempts \r
- * to step upward from the <code>TreeWalker</code>'s <code>root</code> \r
- * node, returns <code>null</code>, and retains the current node.\r
- * @return The new node, or <code>null</code> if the current node has no \r
- * next node in the <code>TreeWalker</code>'s logical view. \r
- */\r
- public Node nextNode();\r
-\r
-}\r