Source Code Cross Referenced for Node.java in  » 6.0-JDK-Core » w3c » org » w3c » dom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » w3c » org.w3c.dom 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003         *
004         * This code is free software; you can redistribute it and/or modify it
005         * under the terms of the GNU General Public License version 2 only, as
006         * published by the Free Software Foundation.  Sun designates this
007         * particular file as subject to the "Classpath" exception as provided
008         * by Sun in the LICENSE file that accompanied this code.
009         *
010         * This code is distributed in the hope that it will be useful, but WITHOUT
011         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
013         * version 2 for more details (a copy is included in the LICENSE file that
014         * accompanied this code).
015         *
016         * You should have received a copy of the GNU General Public License version
017         * 2 along with this work; if not, write to the Free Software Foundation,
018         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019         *
020         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021         * CA 95054 USA or visit www.sun.com if you need additional information or
022         * have any questions.
023         */
024
025        /*
026         * This file is available under and governed by the GNU General Public
027         * License version 2 only, as published by the Free Software Foundation.
028         * However, the following notice accompanied the original version of this
029         * file and, per its terms, should not be removed:
030         *
031         * Copyright (c) 2004 World Wide Web Consortium,
032         *
033         * (Massachusetts Institute of Technology, European Research Consortium for
034         * Informatics and Mathematics, Keio University). All Rights Reserved. This
035         * work is distributed under the W3C(r) Software License [1] in the hope that
036         * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037         * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038         *
039         * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040         */
041
042        package org.w3c.dom;
043
044        /**
045         * The <code>Node</code> interface is the primary datatype for the entire 
046         * Document Object Model. It represents a single node in the document tree. 
047         * While all objects implementing the <code>Node</code> interface expose 
048         * methods for dealing with children, not all objects implementing the 
049         * <code>Node</code> interface may have children. For example, 
050         * <code>Text</code> nodes may not have children, and adding children to 
051         * such nodes results in a <code>DOMException</code> being raised.
052         * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and 
053         * <code>attributes</code> are included as a mechanism to get at node 
054         * information without casting down to the specific derived interface. In 
055         * cases where there is no obvious mapping of these attributes for a 
056         * specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an 
057         * <code>Element</code> or <code>attributes</code> for a <code>Comment</code>
058         * ), this returns <code>null</code>. Note that the specialized interfaces 
059         * may contain additional and more convenient mechanisms to get and set the 
060         * relevant information.
061         * <p>The values of <code>nodeName</code>, 
062         * <code>nodeValue</code>, and <code>attributes</code> vary according to the 
063         * node type as follows: 
064         * <table border='1' cellpadding='3'>
065         * <tr>
066         * <th>Interface</th>
067         * <th>nodeName</th>
068         * <th>nodeValue</th>
069         * <th>attributes</th>
070         * </tr>
071         * <tr>
072         * <td valign='top' rowspan='1' colspan='1'>
073         * <code>Attr</code></td>
074         * <td valign='top' rowspan='1' colspan='1'>same as <code>Attr.name</code></td>
075         * <td valign='top' rowspan='1' colspan='1'>same as 
076         * <code>Attr.value</code></td>
077         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
078         * </tr>
079         * <tr>
080         * <td valign='top' rowspan='1' colspan='1'><code>CDATASection</code></td>
081         * <td valign='top' rowspan='1' colspan='1'>
082         * <code>"#cdata-section"</code></td>
083         * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the 
084         * content of the CDATA Section</td>
085         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
086         * </tr>
087         * <tr>
088         * <td valign='top' rowspan='1' colspan='1'><code>Comment</code></td>
089         * <td valign='top' rowspan='1' colspan='1'>
090         * <code>"#comment"</code></td>
091         * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the 
092         * content of the comment</td>
093         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
094         * </tr>
095         * <tr>
096         * <td valign='top' rowspan='1' colspan='1'><code>Document</code></td>
097         * <td valign='top' rowspan='1' colspan='1'>
098         * <code>"#document"</code></td>
099         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
100         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
101         * </tr>
102         * <tr>
103         * <td valign='top' rowspan='1' colspan='1'>
104         * <code>DocumentFragment</code></td>
105         * <td valign='top' rowspan='1' colspan='1'><code>"#document-fragment"</code></td>
106         * <td valign='top' rowspan='1' colspan='1'>
107         * <code>null</code></td>
108         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
109         * </tr>
110         * <tr>
111         * <td valign='top' rowspan='1' colspan='1'><code>DocumentType</code></td>
112         * <td valign='top' rowspan='1' colspan='1'>same as 
113         * <code>DocumentType.name</code></td>
114         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
115         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
116         * </tr>
117         * <tr>
118         * <td valign='top' rowspan='1' colspan='1'>
119         * <code>Element</code></td>
120         * <td valign='top' rowspan='1' colspan='1'>same as <code>Element.tagName</code></td>
121         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
122         * <td valign='top' rowspan='1' colspan='1'>
123         * <code>NamedNodeMap</code></td>
124         * </tr>
125         * <tr>
126         * <td valign='top' rowspan='1' colspan='1'><code>Entity</code></td>
127         * <td valign='top' rowspan='1' colspan='1'>entity name</td>
128         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
129         * <td valign='top' rowspan='1' colspan='1'>
130         * <code>null</code></td>
131         * </tr>
132         * <tr>
133         * <td valign='top' rowspan='1' colspan='1'><code>EntityReference</code></td>
134         * <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
135         * <td valign='top' rowspan='1' colspan='1'>
136         * <code>null</code></td>
137         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
138         * </tr>
139         * <tr>
140         * <td valign='top' rowspan='1' colspan='1'><code>Notation</code></td>
141         * <td valign='top' rowspan='1' colspan='1'>notation name</td>
142         * <td valign='top' rowspan='1' colspan='1'>
143         * <code>null</code></td>
144         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
145         * </tr>
146         * <tr>
147         * <td valign='top' rowspan='1' colspan='1'><code>ProcessingInstruction</code></td>
148         * <td valign='top' rowspan='1' colspan='1'>same 
149         * as <code>ProcessingInstruction.target</code></td>
150         * <td valign='top' rowspan='1' colspan='1'>same as 
151         * <code>ProcessingInstruction.data</code></td>
152         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
153         * </tr>
154         * <tr>
155         * <td valign='top' rowspan='1' colspan='1'><code>Text</code></td>
156         * <td valign='top' rowspan='1' colspan='1'>
157         * <code>"#text"</code></td>
158         * <td valign='top' rowspan='1' colspan='1'>same as <code>CharacterData.data</code>, the content 
159         * of the text node</td>
160         * <td valign='top' rowspan='1' colspan='1'><code>null</code></td>
161         * </tr>
162         * </table> 
163         * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407'>Document Object Model (DOM) Level 3 Core Specification</a>.
164         */
165        public interface Node {
166            // NodeType
167            /**
168             * The node is an <code>Element</code>.
169             */
170            public static final short ELEMENT_NODE = 1;
171            /**
172             * The node is an <code>Attr</code>.
173             */
174            public static final short ATTRIBUTE_NODE = 2;
175            /**
176             * The node is a <code>Text</code> node.
177             */
178            public static final short TEXT_NODE = 3;
179            /**
180             * The node is a <code>CDATASection</code>.
181             */
182            public static final short CDATA_SECTION_NODE = 4;
183            /**
184             * The node is an <code>EntityReference</code>.
185             */
186            public static final short ENTITY_REFERENCE_NODE = 5;
187            /**
188             * The node is an <code>Entity</code>.
189             */
190            public static final short ENTITY_NODE = 6;
191            /**
192             * The node is a <code>ProcessingInstruction</code>.
193             */
194            public static final short PROCESSING_INSTRUCTION_NODE = 7;
195            /**
196             * The node is a <code>Comment</code>.
197             */
198            public static final short COMMENT_NODE = 8;
199            /**
200             * The node is a <code>Document</code>.
201             */
202            public static final short DOCUMENT_NODE = 9;
203            /**
204             * The node is a <code>DocumentType</code>.
205             */
206            public static final short DOCUMENT_TYPE_NODE = 10;
207            /**
208             * The node is a <code>DocumentFragment</code>.
209             */
210            public static final short DOCUMENT_FRAGMENT_NODE = 11;
211            /**
212             * The node is a <code>Notation</code>.
213             */
214            public static final short NOTATION_NODE = 12;
215
216            /**
217             * The name of this node, depending on its type; see the table above.
218             */
219            public String getNodeName();
220
221            /**
222             * The value of this node, depending on its type; see the table above. 
223             * When it is defined to be <code>null</code>, setting it has no effect, 
224             * including if the node is read-only.
225             * @exception DOMException
226             *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than 
227             *   fit in a <code>DOMString</code> variable on the implementation 
228             *   platform.
229             */
230            public String getNodeValue() throws DOMException;
231
232            /**
233             * The value of this node, depending on its type; see the table above. 
234             * When it is defined to be <code>null</code>, setting it has no effect, 
235             * including if the node is read-only.
236             * @exception DOMException
237             *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if 
238             *   it is not defined to be <code>null</code>.
239             */
240            public void setNodeValue(String nodeValue) throws DOMException;
241
242            /**
243             * A code representing the type of the underlying object, as defined above.
244             */
245            public short getNodeType();
246
247            /**
248             * The parent of this node. All nodes, except <code>Attr</code>, 
249             * <code>Document</code>, <code>DocumentFragment</code>, 
250             * <code>Entity</code>, and <code>Notation</code> may have a parent. 
251             * However, if a node has just been created and not yet added to the 
252             * tree, or if it has been removed from the tree, this is 
253             * <code>null</code>. 
254             */
255            public Node getParentNode();
256
257            /**
258             * A <code>NodeList</code> that contains all children of this node. If 
259             * there are no children, this is a <code>NodeList</code> containing no 
260             * nodes.
261             */
262            public NodeList getChildNodes();
263
264            /**
265             * The first child of this node. If there is no such node, this returns 
266             * <code>null</code>.
267             */
268            public Node getFirstChild();
269
270            /**
271             * The last child of this node. If there is no such node, this returns 
272             * <code>null</code>.
273             */
274            public Node getLastChild();
275
276            /**
277             * The node immediately preceding this node. If there is no such node, 
278             * this returns <code>null</code>.
279             */
280            public Node getPreviousSibling();
281
282            /**
283             * The node immediately following this node. If there is no such node, 
284             * this returns <code>null</code>.
285             */
286            public Node getNextSibling();
287
288            /**
289             * A <code>NamedNodeMap</code> containing the attributes of this node (if 
290             * it is an <code>Element</code>) or <code>null</code> otherwise.
291             */
292            public NamedNodeMap getAttributes();
293
294            /**
295             * The <code>Document</code> object associated with this node. This is 
296             * also the <code>Document</code> object used to create new nodes. When 
297             * this node is a <code>Document</code> or a <code>DocumentType</code> 
298             * which is not used with any <code>Document</code> yet, this is 
299             * <code>null</code>.
300             * 
301             * @since DOM Level 2
302             */
303            public Document getOwnerDocument();
304
305            /**
306             * Inserts the node <code>newChild</code> before the existing child node 
307             * <code>refChild</code>. If <code>refChild</code> is <code>null</code>, 
308             * insert <code>newChild</code> at the end of the list of children.
309             * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, 
310             * all of its children are inserted, in the same order, before 
311             * <code>refChild</code>. If the <code>newChild</code> is already in the 
312             * tree, it is first removed.
313             * <p ><b>Note:</b>  Inserting a node before itself is implementation 
314             * dependent. 
315             * @param newChild The node to insert.
316             * @param refChild The reference node, i.e., the node before which the 
317             *   new node must be inserted.
318             * @return The node being inserted.
319             * @exception DOMException
320             *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not 
321             *   allow children of the type of the <code>newChild</code> node, or if 
322             *   the node to insert is one of this node's ancestors or this node 
323             *   itself, or if this node is of type <code>Document</code> and the 
324             *   DOM application attempts to insert a second 
325             *   <code>DocumentType</code> or <code>Element</code> node.
326             *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created 
327             *   from a different document than the one that created this node.
328             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or 
329             *   if the parent of the node being inserted is readonly.
330             *   <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of 
331             *   this node.
332             *   <br>NOT_SUPPORTED_ERR: if this node is of type <code>Document</code>, 
333             *   this exception might be raised if the DOM implementation doesn't 
334             *   support the insertion of a <code>DocumentType</code> or 
335             *   <code>Element</code> node.
336             * 
337             * @since DOM Level 3
338             */
339            public Node insertBefore(Node newChild, Node refChild)
340                    throws DOMException;
341
342            /**
343             * Replaces the child node <code>oldChild</code> with <code>newChild</code>
344             *  in the list of children, and returns the <code>oldChild</code> node.
345             * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object, 
346             * <code>oldChild</code> is replaced by all of the 
347             * <code>DocumentFragment</code> children, which are inserted in the 
348             * same order. If the <code>newChild</code> is already in the tree, it 
349             * is first removed.
350             * <p ><b>Note:</b>  Replacing a node with itself is implementation 
351             * dependent. 
352             * @param newChild The new node to put in the child list.
353             * @param oldChild The node being replaced in the list.
354             * @return The node replaced.
355             * @exception DOMException
356             *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not 
357             *   allow children of the type of the <code>newChild</code> node, or if 
358             *   the node to put in is one of this node's ancestors or this node 
359             *   itself, or if this node is of type <code>Document</code> and the 
360             *   result of the replacement operation would add a second 
361             *   <code>DocumentType</code> or <code>Element</code> on the 
362             *   <code>Document</code> node.
363             *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created 
364             *   from a different document than the one that created this node.
365             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of 
366             *   the new node is readonly.
367             *   <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of 
368             *   this node.
369             *   <br>NOT_SUPPORTED_ERR: if this node is of type <code>Document</code>, 
370             *   this exception might be raised if the DOM implementation doesn't 
371             *   support the replacement of the <code>DocumentType</code> child or 
372             *   <code>Element</code> child.
373             * 
374             * @since DOM Level 3
375             */
376            public Node replaceChild(Node newChild, Node oldChild)
377                    throws DOMException;
378
379            /**
380             * Removes the child node indicated by <code>oldChild</code> from the list 
381             * of children, and returns it.
382             * @param oldChild The node being removed.
383             * @return The node removed.
384             * @exception DOMException
385             *   NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
386             *   <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of 
387             *   this node.
388             *   <br>NOT_SUPPORTED_ERR: if this node is of type <code>Document</code>, 
389             *   this exception might be raised if the DOM implementation doesn't 
390             *   support the removal of the <code>DocumentType</code> child or the 
391             *   <code>Element</code> child.
392             * 
393             * @since DOM Level 3
394             */
395            public Node removeChild(Node oldChild) throws DOMException;
396
397            /**
398             * Adds the node <code>newChild</code> to the end of the list of children 
399             * of this node. If the <code>newChild</code> is already in the tree, it 
400             * is first removed.
401             * @param newChild The node to add.If it is a 
402             *   <code>DocumentFragment</code> object, the entire contents of the 
403             *   document fragment are moved into the child list of this node
404             * @return The node added.
405             * @exception DOMException
406             *   HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not 
407             *   allow children of the type of the <code>newChild</code> node, or if 
408             *   the node to append is one of this node's ancestors or this node 
409             *   itself, or if this node is of type <code>Document</code> and the 
410             *   DOM application attempts to append a second 
411             *   <code>DocumentType</code> or <code>Element</code> node.
412             *   <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created 
413             *   from a different document than the one that created this node.
414             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or 
415             *   if the previous parent of the node being inserted is readonly.
416             *   <br>NOT_SUPPORTED_ERR: if the <code>newChild</code> node is a child 
417             *   of the <code>Document</code> node, this exception might be raised 
418             *   if the DOM implementation doesn't support the removal of the 
419             *   <code>DocumentType</code> child or <code>Element</code> child.
420             *
421             * @since DOM Level 3
422             */
423            public Node appendChild(Node newChild) throws DOMException;
424
425            /**
426             * Returns whether this node has any children.
427             * @return Returns <code>true</code> if this node has any children, 
428             *   <code>false</code> otherwise.
429             */
430            public boolean hasChildNodes();
431
432            /**
433             * Returns a duplicate of this node, i.e., serves as a generic copy 
434             * constructor for nodes. The duplicate node has no parent (
435             * <code>parentNode</code> is <code>null</code>) and no user data. User 
436             * data associated to the imported node is not carried over. However, if 
437             * any <code>UserDataHandlers</code> has been specified along with the 
438             * associated data these handlers will be called with the appropriate 
439             * parameters before this method returns.
440             * <br>Cloning an <code>Element</code> copies all attributes and their 
441             * values, including those generated by the XML processor to represent 
442             * defaulted attributes, but this method does not copy any children it 
443             * contains unless it is a deep clone. This includes text contained in 
444             * an the <code>Element</code> since the text is contained in a child 
445             * <code>Text</code> node. Cloning an <code>Attr</code> directly, as 
446             * opposed to be cloned as part of an <code>Element</code> cloning 
447             * operation, returns a specified attribute (<code>specified</code> is 
448             * <code>true</code>). Cloning an <code>Attr</code> always clones its 
449             * children, since they represent its value, no matter whether this is a 
450             * deep clone or not. Cloning an <code>EntityReference</code> 
451             * automatically constructs its subtree if a corresponding 
452             * <code>Entity</code> is available, no matter whether this is a deep 
453             * clone or not. Cloning any other type of node simply returns a copy of 
454             * this node.
455             * <br>Note that cloning an immutable subtree results in a mutable copy, 
456             * but the children of an <code>EntityReference</code> clone are readonly
457             * . In addition, clones of unspecified <code>Attr</code> nodes are 
458             * specified. And, cloning <code>Document</code>, 
459             * <code>DocumentType</code>, <code>Entity</code>, and 
460             * <code>Notation</code> nodes is implementation dependent.
461             * @param deep If <code>true</code>, recursively clone the subtree under 
462             *   the specified node; if <code>false</code>, clone only the node 
463             *   itself (and its attributes, if it is an <code>Element</code>).
464             * @return The duplicate node.
465             */
466            public Node cloneNode(boolean deep);
467
468            /**
469             *  Puts all <code>Text</code> nodes in the full depth of the sub-tree 
470             * underneath this <code>Node</code>, including attribute nodes, into a 
471             * "normal" form where only structure (e.g., elements, comments, 
472             * processing instructions, CDATA sections, and entity references) 
473             * separates <code>Text</code> nodes, i.e., there are neither adjacent 
474             * <code>Text</code> nodes nor empty <code>Text</code> nodes. This can 
475             * be used to ensure that the DOM view of a document is the same as if 
476             * it were saved and re-loaded, and is useful when operations (such as 
477             * XPointer [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>]
478             *  lookups) that depend on a particular document tree structure are to 
479             * be used. If the parameter "normalize-characters" of the 
480             * <code>DOMConfiguration</code> object attached to the 
481             * <code>Node.ownerDocument</code> is <code>true</code>, this method 
482             * will also fully normalize the characters of the <code>Text</code> 
483             * nodes. 
484             * <p ><b>Note:</b> In cases where the document contains 
485             * <code>CDATASections</code>, the normalize operation alone may not be 
486             * sufficient, since XPointers do not differentiate between 
487             * <code>Text</code> nodes and <code>CDATASection</code> nodes.
488             * 
489             * @since DOM Level 3
490             */
491            public void normalize();
492
493            /**
494             *  Tests whether the DOM implementation implements a specific feature and 
495             * that feature is supported by this node, as specified in . 
496             * @param feature  The name of the feature to test. 
497             * @param version  This is the version number of the feature to test. 
498             * @return Returns <code>true</code> if the specified feature is 
499             *   supported on this node, <code>false</code> otherwise.
500             *
501             * @since DOM Level 2
502             */
503            public boolean isSupported(String feature, String version);
504
505            /**
506             * The namespace URI of this node, or <code>null</code> if it is 
507             * unspecified (see ).
508             * <br>This is not a computed value that is the result of a namespace 
509             * lookup based on an examination of the namespace declarations in 
510             * scope. It is merely the namespace URI given at creation time.
511             * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and 
512             * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 
513             * method, such as <code>Document.createElement()</code>, this is always 
514             * <code>null</code>.
515             * <p ><b>Note:</b> Per the <em>Namespaces in XML</em> Specification [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
516             *  an attribute does not inherit its namespace from the element it is 
517             * attached to. If an attribute is not explicitly given a namespace, it 
518             * simply has no namespace.
519             *
520             * @since DOM Level 2
521             */
522            public String getNamespaceURI();
523
524            /**
525             * The namespace prefix of this node, or <code>null</code> if it is 
526             * unspecified. When it is defined to be <code>null</code>, setting it 
527             * has no effect, including if the node is read-only.
528             * <br>Note that setting this attribute, when permitted, changes the 
529             * <code>nodeName</code> attribute, which holds the qualified name, as 
530             * well as the <code>tagName</code> and <code>name</code> attributes of 
531             * the <code>Element</code> and <code>Attr</code> interfaces, when 
532             * applicable.
533             * <br>Setting the prefix to <code>null</code> makes it unspecified, 
534             * setting it to an empty string is implementation dependent.
535             * <br>Note also that changing the prefix of an attribute that is known to 
536             * have a default value, does not make a new attribute with the default 
537             * value and the original prefix appear, since the 
538             * <code>namespaceURI</code> and <code>localName</code> do not change.
539             * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and 
540             * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 
541             * method, such as <code>createElement</code> from the 
542             * <code>Document</code> interface, this is always <code>null</code>.
543             *
544             * @since DOM Level 2
545             */
546            public String getPrefix();
547
548            /**
549             * The namespace prefix of this node, or <code>null</code> if it is 
550             * unspecified. When it is defined to be <code>null</code>, setting it 
551             * has no effect, including if the node is read-only.
552             * <br>Note that setting this attribute, when permitted, changes the 
553             * <code>nodeName</code> attribute, which holds the qualified name, as 
554             * well as the <code>tagName</code> and <code>name</code> attributes of 
555             * the <code>Element</code> and <code>Attr</code> interfaces, when 
556             * applicable.
557             * <br>Setting the prefix to <code>null</code> makes it unspecified, 
558             * setting it to an empty string is implementation dependent.
559             * <br>Note also that changing the prefix of an attribute that is known to 
560             * have a default value, does not make a new attribute with the default 
561             * value and the original prefix appear, since the 
562             * <code>namespaceURI</code> and <code>localName</code> do not change.
563             * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and 
564             * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 
565             * method, such as <code>createElement</code> from the 
566             * <code>Document</code> interface, this is always <code>null</code>.
567             * @exception DOMException
568             *   INVALID_CHARACTER_ERR: Raised if the specified prefix contains an 
569             *   illegal character according to the XML version in use specified in 
570             *   the <code>Document.xmlVersion</code> attribute.
571             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
572             *   <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is 
573             *   malformed per the Namespaces in XML specification, if the 
574             *   <code>namespaceURI</code> of this node is <code>null</code>, if the 
575             *   specified prefix is "xml" and the <code>namespaceURI</code> of this 
576             *   node is different from "<a href='http://www.w3.org/XML/1998/namespace'>
577             *   http://www.w3.org/XML/1998/namespace</a>", if this node is an attribute and the specified prefix is "xmlns" and 
578             *   the <code>namespaceURI</code> of this node is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if this node is an attribute and the <code>qualifiedName</code> of 
579             *   this node is "xmlns" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
580             *   .
581             *
582             * @since DOM Level 2
583             */
584            public void setPrefix(String prefix) throws DOMException;
585
586            /**
587             * Returns the local part of the qualified name of this node.
588             * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and 
589             * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 
590             * method, such as <code>Document.createElement()</code>, this is always 
591             * <code>null</code>.
592             *
593             * @since DOM Level 2
594             */
595            public String getLocalName();
596
597            /**
598             * Returns whether this node (if it is an element) has any attributes.
599             * @return Returns <code>true</code> if this node has any attributes, 
600             *   <code>false</code> otherwise.
601             *
602             * @since DOM Level 2
603             */
604            public boolean hasAttributes();
605
606            /**
607             * The absolute base URI of this node or <code>null</code> if the 
608             * implementation wasn't able to obtain an absolute URI. This value is 
609             * computed as described in . However, when the <code>Document</code> 
610             * supports the feature "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
611             * , the base URI is computed using first the value of the href 
612             * attribute of the HTML BASE element if any, and the value of the 
613             * <code>documentURI</code> attribute from the <code>Document</code> 
614             * interface otherwise.
615             *
616             * @since DOM Level 3
617             */
618            public String getBaseURI();
619
620            // DocumentPosition
621            /**
622             * The two nodes are disconnected. Order between disconnected nodes is 
623             * always implementation-specific.
624             */
625            public static final short DOCUMENT_POSITION_DISCONNECTED = 0x01;
626            /**
627             * The second node precedes the reference node.
628             */
629            public static final short DOCUMENT_POSITION_PRECEDING = 0x02;
630            /**
631             * The node follows the reference node.
632             */
633            public static final short DOCUMENT_POSITION_FOLLOWING = 0x04;
634            /**
635             * The node contains the reference node. A node which contains is always 
636             * preceding, too.
637             */
638            public static final short DOCUMENT_POSITION_CONTAINS = 0x08;
639            /**
640             * The node is contained by the reference node. A node which is contained 
641             * is always following, too.
642             */
643            public static final short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
644            /**
645             * The determination of preceding versus following is 
646             * implementation-specific.
647             */
648            public static final short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
649
650            /**
651             * Compares the reference node, i.e. the node on which this method is 
652             * being called, with a node, i.e. the one passed as a parameter, with 
653             * regard to their position in the document and according to the 
654             * document order.
655             * @param other The node to compare against the reference node.
656             * @return Returns how the node is positioned relatively to the reference 
657             *   node.
658             * @exception DOMException
659             *   NOT_SUPPORTED_ERR: when the compared nodes are from different DOM 
660             *   implementations that do not coordinate to return consistent 
661             *   implementation-specific results.
662             *
663             * @since DOM Level 3
664             */
665            public short compareDocumentPosition(Node other)
666                    throws DOMException;
667
668            /**
669             * This attribute returns the text content of this node and its 
670             * descendants. When it is defined to be <code>null</code>, setting it 
671             * has no effect. On setting, any possible children this node may have 
672             * are removed and, if it the new string is not empty or 
673             * <code>null</code>, replaced by a single <code>Text</code> node 
674             * containing the string this attribute is set to. 
675             * <br> On getting, no serialization is performed, the returned string 
676             * does not contain any markup. No whitespace normalization is performed 
677             * and the returned string does not contain the white spaces in element 
678             * content (see the attribute 
679             * <code>Text.isElementContentWhitespace</code>). Similarly, on setting, 
680             * no parsing is performed either, the input string is taken as pure 
681             * textual content. 
682             * <br>The string returned is made of the text content of this node 
683             * depending on its type, as defined below: 
684             * <table border='1' cellpadding='3'>
685             * <tr>
686             * <th>Node type</th>
687             * <th>Content</th>
688             * </tr>
689             * <tr>
690             * <td valign='top' rowspan='1' colspan='1'>
691             * ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, 
692             * DOCUMENT_FRAGMENT_NODE</td>
693             * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code> 
694             * attribute value of every child node, excluding COMMENT_NODE and 
695             * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the 
696             * node has no children.</td>
697             * </tr>
698             * <tr>
699             * <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, 
700             * PROCESSING_INSTRUCTION_NODE</td>
701             * <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
702             * </tr>
703             * <tr>
704             * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, 
705             * DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
706             * <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
707             * </tr>
708             * </table>
709             * @exception DOMException
710             *   DOMSTRING_SIZE_ERR: Raised when it would return more characters than 
711             *   fit in a <code>DOMString</code> variable on the implementation 
712             *   platform.
713             *
714             * @since DOM Level 3
715             */
716            public String getTextContent() throws DOMException;
717
718            /**
719             * This attribute returns the text content of this node and its 
720             * descendants. When it is defined to be <code>null</code>, setting it 
721             * has no effect. On setting, any possible children this node may have 
722             * are removed and, if it the new string is not empty or 
723             * <code>null</code>, replaced by a single <code>Text</code> node 
724             * containing the string this attribute is set to. 
725             * <br> On getting, no serialization is performed, the returned string 
726             * does not contain any markup. No whitespace normalization is performed 
727             * and the returned string does not contain the white spaces in element 
728             * content (see the attribute 
729             * <code>Text.isElementContentWhitespace</code>). Similarly, on setting, 
730             * no parsing is performed either, the input string is taken as pure 
731             * textual content. 
732             * <br>The string returned is made of the text content of this node 
733             * depending on its type, as defined below: 
734             * <table border='1' cellpadding='3'>
735             * <tr>
736             * <th>Node type</th>
737             * <th>Content</th>
738             * </tr>
739             * <tr>
740             * <td valign='top' rowspan='1' colspan='1'>
741             * ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, 
742             * DOCUMENT_FRAGMENT_NODE</td>
743             * <td valign='top' rowspan='1' colspan='1'>concatenation of the <code>textContent</code> 
744             * attribute value of every child node, excluding COMMENT_NODE and 
745             * PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the 
746             * node has no children.</td>
747             * </tr>
748             * <tr>
749             * <td valign='top' rowspan='1' colspan='1'>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, 
750             * PROCESSING_INSTRUCTION_NODE</td>
751             * <td valign='top' rowspan='1' colspan='1'><code>nodeValue</code></td>
752             * </tr>
753             * <tr>
754             * <td valign='top' rowspan='1' colspan='1'>DOCUMENT_NODE, 
755             * DOCUMENT_TYPE_NODE, NOTATION_NODE</td>
756             * <td valign='top' rowspan='1' colspan='1'><em>null</em></td>
757             * </tr>
758             * </table>
759             * @exception DOMException
760             *   NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
761             *
762             * @since DOM Level 3
763             */
764            public void setTextContent(String textContent) throws DOMException;
765
766            /**
767             * Returns whether this node is the same node as the given one.
768             * <br>This method provides a way to determine whether two 
769             * <code>Node</code> references returned by the implementation reference 
770             * the same object. When two <code>Node</code> references are references 
771             * to the same object, even if through a proxy, the references may be 
772             * used completely interchangeably, such that all attributes have the 
773             * same values and calling the same DOM method on either reference 
774             * always has exactly the same effect.
775             * @param other The node to test against.
776             * @return Returns <code>true</code> if the nodes are the same, 
777             *   <code>false</code> otherwise.
778             *
779             * @since DOM Level 3
780             */
781            public boolean isSameNode(Node other);
782
783            /**
784             * Look up the prefix associated to the given namespace URI, starting from 
785             * this node. The default namespace declarations are ignored by this 
786             * method.
787             * <br>See  for details on the algorithm used by this method.
788             * @param namespaceURI The namespace URI to look for.
789             * @return Returns an associated namespace prefix if found or 
790             *   <code>null</code> if none is found. If more than one prefix are 
791             *   associated to the namespace prefix, the returned namespace prefix 
792             *   is implementation dependent.
793             *
794             * @since DOM Level 3
795             */
796            public String lookupPrefix(String namespaceURI);
797
798            /**
799             *  This method checks if the specified <code>namespaceURI</code> is the 
800             * default namespace or not. 
801             * @param namespaceURI The namespace URI to look for.
802             * @return Returns <code>true</code> if the specified 
803             *   <code>namespaceURI</code> is the default namespace, 
804             *   <code>false</code> otherwise.
805             * 
806             * @since DOM Level 3
807             */
808            public boolean isDefaultNamespace(String namespaceURI);
809
810            /**
811             * Look up the namespace URI associated to the given prefix, starting from 
812             * this node.
813             * <br>See  for details on the algorithm used by this method.
814             * @param prefix The prefix to look for. If this parameter is 
815             *   <code>null</code>, the method will return the default namespace URI 
816             *   if any.
817             * @return Returns the associated namespace URI or <code>null</code> if 
818             *   none is found.
819             *
820             * @since DOM Level 3
821             */
822            public String lookupNamespaceURI(String prefix);
823
824            /**
825             * Tests whether two nodes are equal.
826             * <br>This method tests for equality of nodes, not sameness (i.e., 
827             * whether the two nodes are references to the same object) which can be 
828             * tested with <code>Node.isSameNode()</code>. All nodes that are the 
829             * same will also be equal, though the reverse may not be true.
830             * <br>Two nodes are equal if and only if the following conditions are 
831             * satisfied: 
832             * <ul>
833             * <li>The two nodes are of the same type.
834             * </li>
835             * <li>The following string 
836             * attributes are equal: <code>nodeName</code>, <code>localName</code>, 
837             * <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>
838             * . This is: they are both <code>null</code>, or they have the same 
839             * length and are character for character identical.
840             * </li>
841             * <li>The 
842             * <code>attributes</code> <code>NamedNodeMaps</code> are equal. This 
843             * is: they are both <code>null</code>, or they have the same length and 
844             * for each node that exists in one map there is a node that exists in 
845             * the other map and is equal, although not necessarily at the same 
846             * index.
847             * </li>
848             * <li>The <code>childNodes</code> <code>NodeLists</code> are equal. 
849             * This is: they are both <code>null</code>, or they have the same 
850             * length and contain equal nodes at the same index. Note that 
851             * normalization can affect equality; to avoid this, nodes should be 
852             * normalized before being compared.
853             * </li>
854             * </ul> 
855             * <br>For two <code>DocumentType</code> nodes to be equal, the following 
856             * conditions must also be satisfied: 
857             * <ul>
858             * <li>The following string attributes 
859             * are equal: <code>publicId</code>, <code>systemId</code>, 
860             * <code>internalSubset</code>.
861             * </li>
862             * <li>The <code>entities</code> 
863             * <code>NamedNodeMaps</code> are equal.
864             * </li>
865             * <li>The <code>notations</code> 
866             * <code>NamedNodeMaps</code> are equal.
867             * </li>
868             * </ul> 
869             * <br>On the other hand, the following do not affect equality: the 
870             * <code>ownerDocument</code>, <code>baseURI</code>, and 
871             * <code>parentNode</code> attributes, the <code>specified</code> 
872             * attribute for <code>Attr</code> nodes, the <code>schemaTypeInfo</code>
873             *  attribute for <code>Attr</code> and <code>Element</code> nodes, the 
874             * <code>Text.isElementContentWhitespace</code> attribute for 
875             * <code>Text</code> nodes, as well as any user data or event listeners 
876             * registered on the nodes. 
877             * <p ><b>Note:</b>  As a general rule, anything not mentioned in the 
878             * description above is not significant in consideration of equality 
879             * checking. Note that future versions of this specification may take 
880             * into account more attributes and implementations conform to this 
881             * specification are expected to be updated accordingly. 
882             * @param arg The node to compare equality with.
883             * @return Returns <code>true</code> if the nodes are equal, 
884             *   <code>false</code> otherwise.
885             *
886             * @since DOM Level 3
887             */
888            public boolean isEqualNode(Node arg);
889
890            /**
891             *  This method returns a specialized object which implements the 
892             * specialized APIs of the specified feature and version, as specified 
893             * in . The specialized object may also be obtained by using 
894             * binding-specific casting methods but is not necessarily expected to, 
895             * as discussed in . This method also allow the implementation to 
896             * provide specialized objects which do not support the <code>Node</code>
897             *  interface. 
898             * @param feature  The name of the feature requested. Note that any plus 
899             *   sign "+" prepended to the name of the feature will be ignored since 
900             *   it is not significant in the context of this method. 
901             * @param version  This is the version number of the feature to test. 
902             * @return  Returns an object which implements the specialized APIs of 
903             *   the specified feature and version, if any, or <code>null</code> if 
904             *   there is no object which implements interfaces associated with that 
905             *   feature. If the <code>DOMObject</code> returned by this method 
906             *   implements the <code>Node</code> interface, it must delegate to the 
907             *   primary core <code>Node</code> and not return results inconsistent 
908             *   with the primary core <code>Node</code> such as attributes, 
909             *   childNodes, etc.
910             *
911             * @since DOM Level 3
912             */
913            public Object getFeature(String feature, String version);
914
915            /**
916             * Associate an object to a key on this node. The object can later be 
917             * retrieved from this node by calling <code>getUserData</code> with the 
918             * same key.
919             * @param key The key to associate the object to.
920             * @param data The object to associate to the given key, or 
921             *   <code>null</code> to remove any existing association to that key.
922             * @param handler The handler to associate to that key, or 
923             *   <code>null</code>.
924             * @return Returns the <code>DOMUserData</code> previously associated to 
925             *   the given key on this node, or <code>null</code> if there was none.
926             *
927             * @since DOM Level 3
928             */
929            public Object setUserData(String key, Object data,
930                    UserDataHandler handler);
931
932            /**
933             * Retrieves the object associated to a key on a this node. The object 
934             * must first have been set to this node by calling 
935             * <code>setUserData</code> with the same key.
936             * @param key The key the object is associated to.
937             * @return Returns the <code>DOMUserData</code> associated to the given 
938             *   key on this node, or <code>null</code> if there was none.
939             *
940             * @since DOM Level 3
941             */
942            public Object getUserData(String key);
943
944        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.