KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > google > gwt > xml > client > Node


1 /*
2  * Copyright 2006 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */

16 package com.google.gwt.xml.client;
17
18 /**
19  * This is the base interface for DOM nodes, as obtained from using
20  * <code>XMLParser</code> methods. Methods for iterating over and accessing
21  * values from nodes are supplied here.
22  */

23 public interface Node {
24   /**
25    * The constant 1 denotes DOM nodes of type Element.
26    */

27   public static final short ELEMENT_NODE = 1;
28
29   /**
30    * The constant 2 denotes DOM nodes of type Attribute.
31    */

32   public static final short ATTRIBUTE_NODE = 2;
33
34   /**
35    * The constant 3 denotes DOM nodes of type Text.
36    */

37   public static final short TEXT_NODE = 3;
38
39   /**
40    * The constant 4 denotes DOM nodes of type CdataSection.
41    */

42   public static final short CDATA_SECTION_NODE = 4;
43
44   /**
45    * The constant 5 denotes DOM nodes of type EntityReference.
46    */

47   public static final short ENTITY_REFERENCE_NODE = 5;
48
49   /**
50    * The constant 6 denotes DOM nodes of type Entity.
51    */

52   public static final short ENTITY_NODE = 6;
53
54   /**
55    * The constant 7 denotes DOM nodes of type ProcessingInstruction.
56    */

57   public static final short PROCESSING_INSTRUCTION_NODE = 7;
58
59   /**
60    * The constant 8 denotes DOM nodes of type Comment.
61    */

62   public static final short COMMENT_NODE = 8;
63
64   /**
65    * The constant 9 denotes DOM nodes of type Document.
66    */

67   public static final short DOCUMENT_NODE = 9;
68
69   /**
70    * The constant 10 denotes DOM nodes of type DocumentType.
71    */

72   public static final short DOCUMENT_TYPE_NODE = 10;
73
74   /**
75    * The constant 11 denotes DOM nodes of type DocumentFragment.
76    */

77   public static final short DOCUMENT_FRAGMENT_NODE = 11;
78
79   /**
80    * The constant 12 denotes DOM nodes of type Notation.
81    */

82   public static final short NOTATION_NODE = 12;
83
84   /**
85    * This method appends child <code>newChild</code>.
86    *
87    * @param newChild the <code>Node</code> to be added
88    * @return the child <code>Node</code> appended
89    */

90   public Node appendChild(Node newChild);
91
92   /**
93    * This method copies this <code>Node</code>.
94    *
95    * @param deep whether to recurse to children
96    * @return <code>Node</code> cloned
97    */

98   public Node cloneNode(boolean deep);
99
100   /**
101    * This method retrieves the attributes.
102    *
103    * @return the attributes of this <code>Node</code>
104    */

105   public NamedNodeMap getAttributes();
106
107   /**
108    * This method retrieves the child nodes.
109    *
110    * @return the child nodes of this <code>Node</code>
111    */

112   public NodeList getChildNodes();
113
114   /**
115    * This method retrieves the first child.
116    *
117    * @return the first child of this <code>Node</code>
118    */

119   public Node getFirstChild();
120
121   /**
122    * This method retrieves the last child.
123    *
124    * @return the last child of this <code>Node</code>
125    */

126   public Node getLastChild();
127
128   /**
129    * This method retrieves the namespace URI.
130    *
131    * @return the namespace URI of this <code>Node</code>
132    */

133   public String JavaDoc getNamespaceURI();
134
135   /**
136    * This method retrieves the next sibling.
137    *
138    * @return the next sibling of this <code>Node</code>
139    */

140   public Node getNextSibling();
141
142   /**
143    * This method retrieves the name.
144    *
145    * @return the name of this <code>Node</code>
146    */

147   public String JavaDoc getNodeName();
148
149   /**
150    * This method retrieves the type.
151    *
152    * @return the type of this <code>Node</code>
153    */

154   public short getNodeType();
155
156   /**
157    * This method retrieves the value.
158    *
159    * @return the value of this <code>Node</code>
160    */

161   public String JavaDoc getNodeValue();
162
163   /**
164    * This method retrieves the owner document.
165    *
166    * @return the owner document of this <code>Node</code>
167    */

168   public Document getOwnerDocument();
169
170   /**
171    * This method retrieves the parent.
172    *
173    * @return the parent of this <code>Node</code>
174    */

175   public Node getParentNode();
176
177   /**
178    * This method retrieves the prefix.
179    *
180    * @return the prefix of this <code>Node</code>
181    */

182   public String JavaDoc getPrefix();
183
184   /**
185    * This method retrieves the previous sibling.
186    *
187    * @return the previous sibling of this <code>Node</code>
188    */

189   public Node getPreviousSibling();
190
191   /**
192    * This method determines whether this <code>Node</code> has any attributes.
193    *
194    * @return <code>true</code> if this <code>Node</code> has any attributes
195    */

196   public boolean hasAttributes();
197
198   /**
199    * This method determines whether this <code>Node</code> has any child
200    * nodes.
201    *
202    * @return <code>true</code> if this <code>Node</code> has any child nodes
203    */

204   public boolean hasChildNodes();
205
206   /**
207    * This method inserts before <code>newChild</code>.
208    *
209    * @param newChild the <code>Node</code> to be added
210    * @param refChild the <code>Node</code> which determines the position to
211    * insert
212    * @return the before <code>Node</code> inserted
213    */

214   public Node insertBefore(Node newChild, Node refChild);
215
216   /**
217    * This method may collapse adjacent text nodes into one text node, depending
218    * on the implementation.
219    */

220   public void normalize();
221
222   /**
223    * This method removes child <code>oldChild</code>.
224    *
225    * @param oldChild the <code>Node</code> to be removed
226    * @return the child <code>Node</code> removed
227    */

228   public Node removeChild(Node oldChild);
229
230   /**
231    * This method replaces the child <code>oldChild</code> with
232    * <code>newChild</code>.
233    *
234    * @param newChild the <code>Node</code> to be added
235    * @param oldChild the <code>Node</code> to be removed
236    * @return the child <code>Node</code> replaced
237    */

238   public Node replaceChild(Node newChild, Node oldChild);
239
240   /**
241    * This method sets the value to <code>nodeValue</code>.
242    *
243    * @param nodeValue the new value
244    */

245   public void setNodeValue(String JavaDoc nodeValue);
246
247 }
Popular Tags