This commit was manufactured by cvs2svn to create branch 'gomp-branch'.
[official-gcc.git] / libjava / org / w3c / dom / traversal / NodeIterator.java
blob3563e80a8ddfd5256fc566c1721d1120bf409d22
1 /*
2 * Copyright (c) 2000 World Wide Web Consortium,
3 * (Massachusetts Institute of Technology, Institut National de
4 * Recherche en Informatique et en Automatique, Keio University). All
5 * Rights Reserved. This program is distributed under the W3C's Software
6 * Intellectual Property License. This program is distributed in the
7 * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9 * PURPOSE.
10 * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
13 package org.w3c.dom.traversal;
15 import org.w3c.dom.Node;
16 import org.w3c.dom.DOMException;
18 /**
19 * <code>Iterators</code> are used to step through a set of nodes, e.g. the
20 * set of nodes in a <code>NodeList</code>, the document subtree governed by
21 * a particular <code>Node</code>, the results of a query, or any other set
22 * of nodes. The set of nodes to be iterated is determined by the
23 * implementation of the <code>NodeIterator</code>. DOM Level 2 specifies a
24 * single <code>NodeIterator</code> implementation for document-order
25 * traversal of a document subtree. Instances of these iterators are created
26 * by calling <code>DocumentTraversal</code>
27 * <code>.createNodeIterator()</code>.
28 * <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>.
29 * @since DOM Level 2
31 public interface NodeIterator {
32 /**
33 * The root node of the <code>NodeIterator</code>, as specified when it
34 * was created.
36 public Node getRoot();
38 /**
39 * This attribute determines which node types are presented via the
40 * iterator. The available set of constants is defined in the
41 * <code>NodeFilter</code> interface. Nodes not accepted by
42 * <code>whatToShow</code> will be skipped, but their children may still
43 * be considered. Note that this skip takes precedence over the filter,
44 * if any.
46 public int getWhatToShow();
48 /**
49 * The <code>NodeFilter</code> used to screen nodes.
51 public NodeFilter getFilter();
53 /**
54 * The value of this flag determines whether the children of entity
55 * reference nodes are visible to the iterator. If false, they and
56 * their descendants will be rejected. Note that this rejection takes
57 * precedence over <code>whatToShow</code> and the filter. Also note
58 * that this is currently the only situation where
59 * <code>NodeIterators</code> may reject a complete subtree rather than
60 * skipping individual nodes.
61 * <br>
62 * <br> To produce a view of the document that has entity references
63 * expanded and does not expose the entity reference node itself, use
64 * the <code>whatToShow</code> flags to hide the entity reference node
65 * and set <code>expandEntityReferences</code> to true when creating the
66 * iterator. To produce a view of the document that has entity reference
67 * nodes but no entity expansion, use the <code>whatToShow</code> flags
68 * to show the entity reference node and set
69 * <code>expandEntityReferences</code> to false.
71 public boolean getExpandEntityReferences();
73 /**
74 * Returns the next node in the set and advances the position of the
75 * iterator in the set. After a <code>NodeIterator</code> is created,
76 * the first call to <code>nextNode()</code> returns the first node in
77 * the set.
78 * @return The next <code>Node</code> in the set being iterated over, or
79 * <code>null</code> if there are no more members in that set.
80 * @exception DOMException
81 * INVALID_STATE_ERR: Raised if this method is called after the
82 * <code>detach</code> method was invoked.
84 public Node nextNode()
85 throws DOMException;
87 /**
88 * Returns the previous node in the set and moves the position of the
89 * <code>NodeIterator</code> backwards in the set.
90 * @return The previous <code>Node</code> in the set being iterated over,
91 * or <code>null</code> if there are no more members in that set.
92 * @exception DOMException
93 * INVALID_STATE_ERR: Raised if this method is called after the
94 * <code>detach</code> method was invoked.
96 public Node previousNode()
97 throws DOMException;
99 /**
100 * Detaches the <code>NodeIterator</code> from the set which it iterated
101 * over, releasing any computational resources and placing the iterator
102 * in the INVALID state. After <code>detach</code> has been invoked,
103 * calls to <code>nextNode</code> or <code>previousNode</code> will
104 * raise the exception INVALID_STATE_ERR.
106 public void detach();