Path: blob/aarch64-shenandoah-jdk8u272-b10/jaxp/src/org/w3c/dom/traversal/NodeIterator.java
86410 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/*25* This file is available under and governed by the GNU General Public26* License version 2 only, as published by the Free Software Foundation.27* However, the following notice accompanied the original version of this28* file and, per its terms, should not be removed:29*30* Copyright (c) 2000 World Wide Web Consortium,31* (Massachusetts Institute of Technology, Institut National de32* Recherche en Informatique et en Automatique, Keio University). All33* Rights Reserved. This program is distributed under the W3C's Software34* Intellectual Property License. This program is distributed in the35* hope that it will be useful, but WITHOUT ANY WARRANTY; without even36* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR37* PURPOSE.38* See W3C License http://www.w3.org/Consortium/Legal/ for more details.39*/4041package org.w3c.dom.traversal;4243import org.w3c.dom.Node;44import org.w3c.dom.DOMException;4546/**47* <code>NodeIterators</code> are used to step through a set of nodes, e.g.48* the set of nodes in a <code>NodeList</code>, the document subtree49* governed by a particular <code>Node</code>, the results of a query, or50* any other set of nodes. The set of nodes to be iterated is determined by51* the implementation of the <code>NodeIterator</code>. DOM Level 252* specifies a single <code>NodeIterator</code> implementation for53* document-order traversal of a document subtree. Instances of these54* <code>NodeIterators</code> are created by calling55* <code>DocumentTraversal</code><code>.createNodeIterator()</code>.56* <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>.57* @since DOM Level 258*/59public interface NodeIterator {60/**61* The root node of the <code>NodeIterator</code>, as specified when it62* was created.63*/64public Node getRoot();6566/**67* This attribute determines which node types are presented via the68* <code>NodeIterator</code>. The available set of constants is defined69* in the <code>NodeFilter</code> interface. Nodes not accepted by70* <code>whatToShow</code> will be skipped, but their children may still71* be considered. Note that this skip takes precedence over the filter,72* if any.73*/74public int getWhatToShow();7576/**77* The <code>NodeFilter</code> used to screen nodes.78*/79public NodeFilter getFilter();8081/**82* The value of this flag determines whether the children of entity83* reference nodes are visible to the <code>NodeIterator</code>. If84* false, these children and their descendants will be rejected. Note85* that this rejection takes precedence over <code>whatToShow</code> and86* the filter. Also note that this is currently the only situation where87* <code>NodeIterators</code> may reject a complete subtree rather than88* skipping individual nodes.89* <br>90* <br> To produce a view of the document that has entity references91* expanded and does not expose the entity reference node itself, use92* the <code>whatToShow</code> flags to hide the entity reference node93* and set <code>expandEntityReferences</code> to true when creating the94* <code>NodeIterator</code>. To produce a view of the document that has95* entity reference nodes but no entity expansion, use the96* <code>whatToShow</code> flags to show the entity reference node and97* set <code>expandEntityReferences</code> to false.98*/99public boolean getExpandEntityReferences();100101/**102* Returns the next node in the set and advances the position of the103* <code>NodeIterator</code> in the set. After a104* <code>NodeIterator</code> is created, the first call to105* <code>nextNode()</code> returns the first node in the set.106* @return The next <code>Node</code> in the set being iterated over, or107* <code>null</code> if there are no more members in that set.108* @exception DOMException109* INVALID_STATE_ERR: Raised if this method is called after the110* <code>detach</code> method was invoked.111*/112public Node nextNode()113throws DOMException;114115/**116* Returns the previous node in the set and moves the position of the117* <code>NodeIterator</code> backwards in the set.118* @return The previous <code>Node</code> in the set being iterated over,119* or <code>null</code> if there are no more members in that set.120* @exception DOMException121* INVALID_STATE_ERR: Raised if this method is called after the122* <code>detach</code> method was invoked.123*/124public Node previousNode()125throws DOMException;126127/**128* Detaches the <code>NodeIterator</code> from the set which it iterated129* over, releasing any computational resources and placing the130* <code>NodeIterator</code> in the INVALID state. After131* <code>detach</code> has been invoked, calls to <code>nextNode</code>132* or <code>previousNode</code> will raise the exception133* INVALID_STATE_ERR.134*/135public void detach();136137}138139140