Source Code Cross Referenced for Document.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>Document</code> interface represents the entire HTML or XML 
046         * document. Conceptually, it is the root of the document tree, and provides 
047         * the primary access to the document's data.
048         * <p>Since elements, text nodes, comments, processing instructions, etc. 
049         * cannot exist outside the context of a <code>Document</code>, the 
050         * <code>Document</code> interface also contains the factory methods needed 
051         * to create these objects. The <code>Node</code> objects created have a 
052         * <code>ownerDocument</code> attribute which associates them with the 
053         * <code>Document</code> within whose context they were created.
054         * <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>.
055         */
056        public interface Document extends Node {
057            /**
058             * The Document Type Declaration (see <code>DocumentType</code>) 
059             * associated with this document. For XML documents without a document 
060             * type declaration this returns <code>null</code>. For HTML documents, 
061             * a <code>DocumentType</code> object may be returned, independently of 
062             * the presence or absence of document type declaration in the HTML 
063             * document.
064             * <br>This provides direct access to the <code>DocumentType</code> node, 
065             * child node of this <code>Document</code>. This node can be set at 
066             * document creation time and later changed through the use of child 
067             * nodes manipulation methods, such as <code>Node.insertBefore</code>, 
068             * or <code>Node.replaceChild</code>. Note, however, that while some 
069             * implementations may instantiate different types of 
070             * <code>Document</code> objects supporting additional features than the 
071             * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
072             * , based on the <code>DocumentType</code> specified at creation time, 
073             * changing it afterwards is very unlikely to result in a change of the 
074             * features supported.
075             *
076             * @since DOM Level 3
077             */
078            public DocumentType getDoctype();
079
080            /**
081             * The <code>DOMImplementation</code> object that handles this document. A 
082             * DOM application may use objects from multiple implementations.
083             */
084            public DOMImplementation getImplementation();
085
086            /**
087             * This is a convenience attribute that allows direct access to the child 
088             * node that is the document element of the document.
089             */
090            public Element getDocumentElement();
091
092            /**
093             * Creates an element of the type specified. Note that the instance 
094             * returned implements the <code>Element</code> interface, so attributes 
095             * can be specified directly on the returned object.
096             * <br>In addition, if there are known attributes with default values, 
097             * <code>Attr</code> nodes representing them are automatically created 
098             * and attached to the element.
099             * <br>To create an element with a qualified name and namespace URI, use 
100             * the <code>createElementNS</code> method.
101             * @param tagName The name of the element type to instantiate. For XML, 
102             *   this is case-sensitive, otherwise it depends on the 
103             *   case-sensitivity of the markup language in use. In that case, the 
104             *   name is mapped to the canonical form of that markup by the DOM 
105             *   implementation.
106             * @return A new <code>Element</code> object with the 
107             *   <code>nodeName</code> attribute set to <code>tagName</code>, and 
108             *   <code>localName</code>, <code>prefix</code>, and 
109             *   <code>namespaceURI</code> set to <code>null</code>.
110             * @exception DOMException
111             *   INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 
112             *   name according to the XML version in use specified in the 
113             *   <code>Document.xmlVersion</code> attribute.
114             */
115            public Element createElement(String tagName) throws DOMException;
116
117            /**
118             * Creates an empty <code>DocumentFragment</code> object.
119             * @return A new <code>DocumentFragment</code>.
120             */
121            public DocumentFragment createDocumentFragment();
122
123            /**
124             * Creates a <code>Text</code> node given the specified string.
125             * @param data The data for the node.
126             * @return The new <code>Text</code> object.
127             */
128            public Text createTextNode(String data);
129
130            /**
131             * Creates a <code>Comment</code> node given the specified string.
132             * @param data The data for the node.
133             * @return The new <code>Comment</code> object.
134             */
135            public Comment createComment(String data);
136
137            /**
138             * Creates a <code>CDATASection</code> node whose value is the specified 
139             * string.
140             * @param data The data for the <code>CDATASection</code> contents.
141             * @return The new <code>CDATASection</code> object.
142             * @exception DOMException
143             *   NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
144             */
145            public CDATASection createCDATASection(String data)
146                    throws DOMException;
147
148            /**
149             * Creates a <code>ProcessingInstruction</code> node given the specified 
150             * name and data strings.
151             * @param target The target part of the processing instruction.Unlike 
152             *   <code>Document.createElementNS</code> or 
153             *   <code>Document.createAttributeNS</code>, no namespace well-formed 
154             *   checking is done on the target name. Applications should invoke 
155             *   <code>Document.normalizeDocument()</code> with the parameter "
156             *   namespaces" set to <code>true</code> in order to ensure that the 
157             *   target name is namespace well-formed. 
158             * @param data The data for the node.
159             * @return The new <code>ProcessingInstruction</code> object.
160             * @exception DOMException
161             *   INVALID_CHARACTER_ERR: Raised if the specified target is not an XML 
162             *   name according to the XML version in use specified in the 
163             *   <code>Document.xmlVersion</code> attribute.
164             *   <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
165             */
166            public ProcessingInstruction createProcessingInstruction(
167                    String target, String data) throws DOMException;
168
169            /**
170             * Creates an <code>Attr</code> of the given name. Note that the 
171             * <code>Attr</code> instance can then be set on an <code>Element</code> 
172             * using the <code>setAttributeNode</code> method. 
173             * <br>To create an attribute with a qualified name and namespace URI, use 
174             * the <code>createAttributeNS</code> method.
175             * @param name The name of the attribute.
176             * @return A new <code>Attr</code> object with the <code>nodeName</code> 
177             *   attribute set to <code>name</code>, and <code>localName</code>, 
178             *   <code>prefix</code>, and <code>namespaceURI</code> set to 
179             *   <code>null</code>. The value of the attribute is the empty string.
180             * @exception DOMException
181             *   INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 
182             *   name according to the XML version in use specified in the 
183             *   <code>Document.xmlVersion</code> attribute.
184             */
185            public Attr createAttribute(String name) throws DOMException;
186
187            /**
188             * Creates an <code>EntityReference</code> object. In addition, if the 
189             * referenced entity is known, the child list of the 
190             * <code>EntityReference</code> node is made the same as that of the 
191             * corresponding <code>Entity</code> node.
192             * <p ><b>Note:</b> If any descendant of the <code>Entity</code> node has 
193             * an unbound namespace prefix, the corresponding descendant of the 
194             * created <code>EntityReference</code> node is also unbound; (its 
195             * <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and 
196             * 3 do not support any mechanism to resolve namespace prefixes in this 
197             * case.
198             * @param name The name of the entity to reference.Unlike 
199             *   <code>Document.createElementNS</code> or 
200             *   <code>Document.createAttributeNS</code>, no namespace well-formed 
201             *   checking is done on the entity name. Applications should invoke 
202             *   <code>Document.normalizeDocument()</code> with the parameter "
203             *   namespaces" set to <code>true</code> in order to ensure that the 
204             *   entity name is namespace well-formed. 
205             * @return The new <code>EntityReference</code> object.
206             * @exception DOMException
207             *   INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 
208             *   name according to the XML version in use specified in the 
209             *   <code>Document.xmlVersion</code> attribute.
210             *   <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
211             */
212            public EntityReference createEntityReference(String name)
213                    throws DOMException;
214
215            /**
216             * Returns a <code>NodeList</code> of all the <code>Elements</code> in 
217             * document order with a given tag name and are contained in the 
218             * document.
219             * @param tagname  The name of the tag to match on. The special value "*" 
220             *   matches all tags. For XML, the <code>tagname</code> parameter is 
221             *   case-sensitive, otherwise it depends on the case-sensitivity of the 
222             *   markup language in use. 
223             * @return A new <code>NodeList</code> object containing all the matched 
224             *   <code>Elements</code>.
225             */
226            public NodeList getElementsByTagName(String tagname);
227
228            /**
229             * Imports a node from another document to this document, without altering 
230             * or removing the source node from the original document; this method 
231             * creates a new copy of the source node. The returned node has no 
232             * parent; (<code>parentNode</code> is <code>null</code>).
233             * <br>For all nodes, importing a node creates a node object owned by the 
234             * importing document, with attribute values identical to the source 
235             * node's <code>nodeName</code> and <code>nodeType</code>, plus the 
236             * attributes related to namespaces (<code>prefix</code>, 
237             * <code>localName</code>, and <code>namespaceURI</code>). As in the 
238             * <code>cloneNode</code> operation, the source node is not altered. 
239             * User data associated to the imported node is not carried over. 
240             * However, if any <code>UserDataHandlers</code> has been specified 
241             * along with the associated data these handlers will be called with the 
242             * appropriate parameters before this method returns.
243             * <br>Additional information is copied as appropriate to the 
244             * <code>nodeType</code>, attempting to mirror the behavior expected if 
245             * a fragment of XML or HTML source was copied from one document to 
246             * another, recognizing that the two documents may have different DTDs 
247             * in the XML case. The following list describes the specifics for each 
248             * type of node. 
249             * <dl>
250             * <dt>ATTRIBUTE_NODE</dt>
251             * <dd>The <code>ownerElement</code> attribute 
252             * is set to <code>null</code> and the <code>specified</code> flag is 
253             * set to <code>true</code> on the generated <code>Attr</code>. The 
254             * descendants of the source <code>Attr</code> are recursively imported 
255             * and the resulting nodes reassembled to form the corresponding subtree.
256             * Note that the <code>deep</code> parameter has no effect on 
257             * <code>Attr</code> nodes; they always carry their children with them 
258             * when imported.</dd>
259             * <dt>DOCUMENT_FRAGMENT_NODE</dt>
260             * <dd>If the <code>deep</code> option 
261             * was set to <code>true</code>, the descendants of the source 
262             * <code>DocumentFragment</code> are recursively imported and the 
263             * resulting nodes reassembled under the imported 
264             * <code>DocumentFragment</code> to form the corresponding subtree. 
265             * Otherwise, this simply generates an empty 
266             * <code>DocumentFragment</code>.</dd>
267             * <dt>DOCUMENT_NODE</dt>
268             * <dd><code>Document</code> 
269             * nodes cannot be imported.</dd>
270             * <dt>DOCUMENT_TYPE_NODE</dt>
271             * <dd><code>DocumentType</code> 
272             * nodes cannot be imported.</dd>
273             * <dt>ELEMENT_NODE</dt>
274             * <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated 
275             * <code>Attr</code> nodes are attached to the generated 
276             * <code>Element</code>. Default attributes are <em>not</em> copied, though if the document being imported into defines default 
277             * attributes for this element name, those are assigned. If the 
278             * <code>importNode</code> <code>deep</code> parameter was set to 
279             * <code>true</code>, the descendants of the source element are 
280             * recursively imported and the resulting nodes reassembled to form the 
281             * corresponding subtree.</dd>
282             * <dt>ENTITY_NODE</dt>
283             * <dd><code>Entity</code> nodes can be 
284             * imported, however in the current release of the DOM the 
285             * <code>DocumentType</code> is readonly. Ability to add these imported 
286             * nodes to a <code>DocumentType</code> will be considered for addition 
287             * to a future release of the DOM.On import, the <code>publicId</code>, 
288             * <code>systemId</code>, and <code>notationName</code> attributes are 
289             * copied. If a <code>deep</code> import is requested, the descendants 
290             * of the the source <code>Entity</code> are recursively imported and 
291             * the resulting nodes reassembled to form the corresponding subtree.</dd>
292             * <dt>
293             * ENTITY_REFERENCE_NODE</dt>
294             * <dd>Only the <code>EntityReference</code> itself is 
295             * copied, even if a <code>deep</code> import is requested, since the 
296             * source and destination documents might have defined the entity 
297             * differently. If the document being imported into provides a 
298             * definition for this entity name, its value is assigned.</dd>
299             * <dt>NOTATION_NODE</dt>
300             * <dd>
301             * <code>Notation</code> nodes can be imported, however in the current 
302             * release of the DOM the <code>DocumentType</code> is readonly. Ability 
303             * to add these imported nodes to a <code>DocumentType</code> will be 
304             * considered for addition to a future release of the DOM.On import, the 
305             * <code>publicId</code> and <code>systemId</code> attributes are copied.
306             * Note that the <code>deep</code> parameter has no effect on this type 
307             * of nodes since they cannot have any children.</dd>
308             * <dt>
309             * PROCESSING_INSTRUCTION_NODE</dt>
310             * <dd>The imported node copies its 
311             * <code>target</code> and <code>data</code> values from those of the 
312             * source node.Note that the <code>deep</code> parameter has no effect 
313             * on this type of nodes since they cannot have any children.</dd>
314             * <dt>TEXT_NODE, 
315             * CDATA_SECTION_NODE, COMMENT_NODE</dt>
316             * <dd>These three types of nodes inheriting 
317             * from <code>CharacterData</code> copy their <code>data</code> and 
318             * <code>length</code> attributes from those of the source node.Note 
319             * that the <code>deep</code> parameter has no effect on these types of 
320             * nodes since they cannot have any children.</dd>
321             * </dl> 
322             * @param importedNode The node to import.
323             * @param deep If <code>true</code>, recursively import the subtree under 
324             *   the specified node; if <code>false</code>, import only the node 
325             *   itself, as explained above. This has no effect on nodes that cannot 
326             *   have any children, and on <code>Attr</code>, and 
327             *   <code>EntityReference</code> nodes.
328             * @return The imported node that belongs to this <code>Document</code>.
329             * @exception DOMException
330             *   NOT_SUPPORTED_ERR: Raised if the type of node being imported is not 
331             *   supported.
332             *   <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not 
333             *   an XML name according to the XML version in use specified in the 
334             *   <code>Document.xmlVersion</code> attribute. This may happen when 
335             *   importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element 
336             *   into an XML 1.0 document, for instance.
337             * @since DOM Level 2
338             */
339            public Node importNode(Node importedNode, boolean deep)
340                    throws DOMException;
341
342            /**
343             * Creates an element of the given qualified name and namespace URI.
344             * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
345             * , applications must use the value <code>null</code> as the 
346             * namespaceURI parameter for methods if they wish to have no namespace.
347             * @param namespaceURI The namespace URI of the element to create.
348             * @param qualifiedName The qualified name of the element type to 
349             *   instantiate.
350             * @return A new <code>Element</code> object with the following 
351             *   attributes:
352             * <table border='1' cellpadding='3'>
353             * <tr>
354             * <th>Attribute</th>
355             * <th>Value</th>
356             * </tr>
357             * <tr>
358             * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
359             * <td valign='top' rowspan='1' colspan='1'>
360             *   <code>qualifiedName</code></td>
361             * </tr>
362             * <tr>
363             * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
364             * <td valign='top' rowspan='1' colspan='1'>
365             *   <code>namespaceURI</code></td>
366             * </tr>
367             * <tr>
368             * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
369             * <td valign='top' rowspan='1' colspan='1'>prefix, extracted 
370             *   from <code>qualifiedName</code>, or <code>null</code> if there is 
371             *   no prefix</td>
372             * </tr>
373             * <tr>
374             * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
375             * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 
376             *   <code>qualifiedName</code></td>
377             * </tr>
378             * <tr>
379             * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
380             * <td valign='top' rowspan='1' colspan='1'>
381             *   <code>qualifiedName</code></td>
382             * </tr>
383             * </table>
384             * @exception DOMException
385             *   INVALID_CHARACTER_ERR: Raised if the specified 
386             *   <code>qualifiedName</code> is not an XML name according to the XML 
387             *   version in use specified in the <code>Document.xmlVersion</code> 
388             *   attribute.
389             *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 
390             *   malformed qualified name, if the <code>qualifiedName</code> has a 
391             *   prefix and the <code>namespaceURI</code> is <code>null</code>, or 
392             *   if the <code>qualifiedName</code> has a prefix that is "xml" and 
393             *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
394             *   http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
395             *   , or if the <code>qualifiedName</code> or its prefix is "xmlns" and 
396             *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns".
397             *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 
398             *   support the <code>"XML"</code> feature, since namespaces were 
399             *   defined by XML.
400             * @since DOM Level 2
401             */
402            public Element createElementNS(String namespaceURI,
403                    String qualifiedName) throws DOMException;
404
405            /**
406             * Creates an attribute of the given qualified name and namespace URI.
407             * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
408             * , applications must use the value <code>null</code> as the 
409             * <code>namespaceURI</code> parameter for methods if they wish to have 
410             * no namespace.
411             * @param namespaceURI The namespace URI of the attribute to create.
412             * @param qualifiedName The qualified name of the attribute to 
413             *   instantiate.
414             * @return A new <code>Attr</code> object with the following attributes:
415             * <table border='1' cellpadding='3'>
416             * <tr>
417             * <th>
418             *   Attribute</th>
419             * <th>Value</th>
420             * </tr>
421             * <tr>
422             * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
423             * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
424             * </tr>
425             * <tr>
426             * <td valign='top' rowspan='1' colspan='1'>
427             *   <code>Node.namespaceURI</code></td>
428             * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
429             * </tr>
430             * <tr>
431             * <td valign='top' rowspan='1' colspan='1'>
432             *   <code>Node.prefix</code></td>
433             * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from 
434             *   <code>qualifiedName</code>, or <code>null</code> if there is no 
435             *   prefix</td>
436             * </tr>
437             * <tr>
438             * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
439             * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 
440             *   <code>qualifiedName</code></td>
441             * </tr>
442             * <tr>
443             * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
444             * <td valign='top' rowspan='1' colspan='1'>
445             *   <code>qualifiedName</code></td>
446             * </tr>
447             * <tr>
448             * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
449             * <td valign='top' rowspan='1' colspan='1'>the empty 
450             *   string</td>
451             * </tr>
452             * </table>
453             * @exception DOMException
454             *   INVALID_CHARACTER_ERR: Raised if the specified 
455             *   <code>qualifiedName</code> is not an XML name according to the XML 
456             *   version in use specified in the <code>Document.xmlVersion</code> 
457             *   attribute.
458             *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 
459             *   malformed qualified name, if the <code>qualifiedName</code> has a 
460             *   prefix and the <code>namespaceURI</code> is <code>null</code>, if 
461             *   the <code>qualifiedName</code> has a prefix that is "xml" and the 
462             *   <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
463             *   http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the 
464             *   <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>" and neither the <code>qualifiedName</code> nor its prefix is "xmlns".
465             *   <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 
466             *   support the <code>"XML"</code> feature, since namespaces were 
467             *   defined by XML.
468             * @since DOM Level 2
469             */
470            public Attr createAttributeNS(String namespaceURI,
471                    String qualifiedName) throws DOMException;
472
473            /**
474             * Returns a <code>NodeList</code> of all the <code>Elements</code> with a 
475             * given local name and namespace URI in document order.
476             * @param namespaceURI The namespace URI of the elements to match on. The 
477             *   special value <code>"*"</code> matches all namespaces.
478             * @param localName The local name of the elements to match on. The 
479             *   special value "*" matches all local names.
480             * @return A new <code>NodeList</code> object containing all the matched 
481             *   <code>Elements</code>.
482             * @since DOM Level 2
483             */
484            public NodeList getElementsByTagNameNS(String namespaceURI,
485                    String localName);
486
487            /**
488             * Returns the <code>Element</code> that has an ID attribute with the 
489             * given value. If no such element exists, this returns <code>null</code>
490             * . If more than one element has an ID attribute with that value, what 
491             * is returned is undefined. 
492             * <br> The DOM implementation is expected to use the attribute 
493             * <code>Attr.isId</code> to determine if an attribute is of type ID. 
494             * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type 
495             * ID unless so defined.
496             * @param elementId The unique <code>id</code> value for an element.
497             * @return The matching element or <code>null</code> if there is none.
498             * @since DOM Level 2
499             */
500            public Element getElementById(String elementId);
501
502            /**
503             * An attribute specifying the encoding used for this document at the time 
504             * of the parsing. This is <code>null</code> when it is not known, such 
505             * as when the <code>Document</code> was created in memory.
506             * @since DOM Level 3
507             */
508            public String getInputEncoding();
509
510            /**
511             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the encoding of this document. This is <code>null</code> when 
512             * unspecified or when it is not known, such as when the 
513             * <code>Document</code> was created in memory.
514             * @since DOM Level 3
515             */
516            public String getXmlEncoding();
517
518            /**
519             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when 
520             * unspecified.
521             * <p ><b>Note:</b>  No verification is done on the value when setting 
522             * this attribute. Applications should use 
523             * <code>Document.normalizeDocument()</code> with the "validate" 
524             * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity 
525             * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. 
526             * @since DOM Level 3
527             */
528            public boolean getXmlStandalone();
529
530            /**
531             * An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, whether this document is standalone. This is <code>false</code> when 
532             * unspecified.
533             * <p ><b>Note:</b>  No verification is done on the value when setting 
534             * this attribute. Applications should use 
535             * <code>Document.normalizeDocument()</code> with the "validate" 
536             * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity 
537             * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. 
538             * @exception DOMException
539             *    NOT_SUPPORTED_ERR: Raised if this document does not support the 
540             *   "XML" feature. 
541             * @since DOM Level 3
542             */
543            public void setXmlStandalone(boolean xmlStandalone)
544                    throws DOMException;
545
546            /**
547             *  An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if 
548             * this document supports the "XML" feature, the value is 
549             * <code>"1.0"</code>. If this document does not support the "XML" 
550             * feature, the value is always <code>null</code>. Changing this 
551             * attribute will affect methods that check for invalid characters in 
552             * XML names. Application should invoke 
553             * <code>Document.normalizeDocument()</code> in order to check for 
554             * invalid characters in the <code>Node</code>s that are already part of 
555             * this <code>Document</code>. 
556             * <br> DOM applications may use the 
557             * <code>DOMImplementation.hasFeature(feature, version)</code> method 
558             * with parameter values "XMLVersion" and "1.0" (respectively) to 
559             * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM 
560             * applications may use the same method with parameter values 
561             * "XMLVersion" and "1.1" (respectively) to determine if an 
562             * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both 
563             * cases, in order to support XML, an implementation must also support 
564             * the "XML" feature defined in this specification. <code>Document</code>
565             *  objects supporting a version of the "XMLVersion" feature must not 
566             * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version 
567             * number when using <code>Document.xmlVersion</code>. 
568             * @since DOM Level 3
569             */
570            public String getXmlVersion();
571
572            /**
573             *  An attribute specifying, as part of the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'>XML declaration</a>, the version number of this document. If there is no declaration and if 
574             * this document supports the "XML" feature, the value is 
575             * <code>"1.0"</code>. If this document does not support the "XML" 
576             * feature, the value is always <code>null</code>. Changing this 
577             * attribute will affect methods that check for invalid characters in 
578             * XML names. Application should invoke 
579             * <code>Document.normalizeDocument()</code> in order to check for 
580             * invalid characters in the <code>Node</code>s that are already part of 
581             * this <code>Document</code>. 
582             * <br> DOM applications may use the 
583             * <code>DOMImplementation.hasFeature(feature, version)</code> method 
584             * with parameter values "XMLVersion" and "1.0" (respectively) to 
585             * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM 
586             * applications may use the same method with parameter values 
587             * "XMLVersion" and "1.1" (respectively) to determine if an 
588             * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both 
589             * cases, in order to support XML, an implementation must also support 
590             * the "XML" feature defined in this specification. <code>Document</code>
591             *  objects supporting a version of the "XMLVersion" feature must not 
592             * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version 
593             * number when using <code>Document.xmlVersion</code>. 
594             * @exception DOMException
595             *    NOT_SUPPORTED_ERR: Raised if the version is set to a value that is 
596             *   not supported by this <code>Document</code> or if this document 
597             *   does not support the "XML" feature. 
598             * @since DOM Level 3
599             */
600            public void setXmlVersion(String xmlVersion) throws DOMException;
601
602            /**
603             * An attribute specifying whether error checking is enforced or not. When 
604             * set to <code>false</code>, the implementation is free to not test 
605             * every possible error case normally defined on DOM operations, and not 
606             * raise any <code>DOMException</code> on DOM operations or report 
607             * errors while using <code>Document.normalizeDocument()</code>. In case 
608             * of error, the behavior is undefined. This attribute is 
609             * <code>true</code> by default.
610             * @since DOM Level 3
611             */
612            public boolean getStrictErrorChecking();
613
614            /**
615             * An attribute specifying whether error checking is enforced or not. When 
616             * set to <code>false</code>, the implementation is free to not test 
617             * every possible error case normally defined on DOM operations, and not 
618             * raise any <code>DOMException</code> on DOM operations or report 
619             * errors while using <code>Document.normalizeDocument()</code>. In case 
620             * of error, the behavior is undefined. This attribute is 
621             * <code>true</code> by default.
622             * @since DOM Level 3
623             */
624            public void setStrictErrorChecking(boolean strictErrorChecking);
625
626            /**
627             *  The location of the document or <code>null</code> if undefined or if 
628             * the <code>Document</code> was created using 
629             * <code>DOMImplementation.createDocument</code>. No lexical checking is 
630             * performed when setting this attribute; this could result in a 
631             * <code>null</code> value returned when using <code>Node.baseURI</code>
632             * . 
633             * <br> Beware that when the <code>Document</code> supports the feature 
634             * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
635             * , the href attribute of the HTML BASE element takes precedence over 
636             * this attribute when computing <code>Node.baseURI</code>. 
637             * @since DOM Level 3
638             */
639            public String getDocumentURI();
640
641            /**
642             *  The location of the document or <code>null</code> if undefined or if 
643             * the <code>Document</code> was created using 
644             * <code>DOMImplementation.createDocument</code>. No lexical checking is 
645             * performed when setting this attribute; this could result in a 
646             * <code>null</code> value returned when using <code>Node.baseURI</code>
647             * . 
648             * <br> Beware that when the <code>Document</code> supports the feature 
649             * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
650             * , the href attribute of the HTML BASE element takes precedence over 
651             * this attribute when computing <code>Node.baseURI</code>. 
652             * @since DOM Level 3
653             */
654            public void setDocumentURI(String documentURI);
655
656            /**
657             *  Attempts to adopt a node from another document to this document. If 
658             * supported, it changes the <code>ownerDocument</code> of the source 
659             * node, its children, as well as the attached attribute nodes if there 
660             * are any. If the source node has a parent it is first removed from the 
661             * child list of its parent. This effectively allows moving a subtree 
662             * from one document to another (unlike <code>importNode()</code> which 
663             * create a copy of the source node instead of moving it). When it 
664             * fails, applications should use <code>Document.importNode()</code> 
665             * instead. Note that if the adopted node is already part of this 
666             * document (i.e. the source and target document are the same), this 
667             * method still has the effect of removing the source node from the 
668             * child list of its parent, if any. The following list describes the 
669             * specifics for each type of node. 
670             * <dl>
671             * <dt>ATTRIBUTE_NODE</dt>
672             * <dd>The 
673             * <code>ownerElement</code> attribute is set to <code>null</code> and 
674             * the <code>specified</code> flag is set to <code>true</code> on the 
675             * adopted <code>Attr</code>. The descendants of the source 
676             * <code>Attr</code> are recursively adopted.</dd>
677             * <dt>DOCUMENT_FRAGMENT_NODE</dt>
678             * <dd>The 
679             * descendants of the source node are recursively adopted.</dd>
680             * <dt>DOCUMENT_NODE</dt>
681             * <dd>
682             * <code>Document</code> nodes cannot be adopted.</dd>
683             * <dt>DOCUMENT_TYPE_NODE</dt>
684             * <dd>
685             * <code>DocumentType</code> nodes cannot be adopted.</dd>
686             * <dt>ELEMENT_NODE</dt>
687             * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes 
688             * are discarded, though if the document being adopted into defines 
689             * default attributes for this element name, those are assigned. The 
690             * descendants of the source element are recursively adopted.</dd>
691             * <dt>ENTITY_NODE</dt>
692             * <dd>
693             * <code>Entity</code> nodes cannot be adopted.</dd>
694             * <dt>ENTITY_REFERENCE_NODE</dt>
695             * <dd>Only 
696             * the <code>EntityReference</code> node itself is adopted, the 
697             * descendants are discarded, since the source and destination documents 
698             * might have defined the entity differently. If the document being 
699             * imported into provides a definition for this entity name, its value 
700             * is assigned.</dd>
701             * <dt>NOTATION_NODE</dt>
702             * <dd><code>Notation</code> nodes cannot be 
703             * adopted.</dd>
704             * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, 
705             * COMMENT_NODE</dt>
706             * <dd>These nodes can all be adopted. No specifics.</dd>
707             * </dl> 
708             * <p ><b>Note:</b>  Since it does not create new nodes unlike the 
709             * <code>Document.importNode()</code> method, this method does not raise 
710             * an <code>INVALID_CHARACTER_ERR</code> exception, and applications 
711             * should use the <code>Document.normalizeDocument()</code> method to 
712             * check if an imported name is not an XML name according to the XML 
713             * version in use. 
714             * @param source The node to move into this document.
715             * @return The adopted node, or <code>null</code> if this operation 
716             *   fails, such as when the source node comes from a different 
717             *   implementation.
718             * @exception DOMException
719             *   NOT_SUPPORTED_ERR: Raised if the source node is of type 
720             *   <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
721             *   <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is 
722             *   readonly.
723             * @since DOM Level 3
724             */
725            public Node adoptNode(Node source) throws DOMException;
726
727            /**
728             *  The configuration used when <code>Document.normalizeDocument()</code> 
729             * is invoked. 
730             * @since DOM Level 3
731             */
732            public DOMConfiguration getDomConfig();
733
734            /**
735             *  This method acts as if the document was going through a save and load 
736             * cycle, putting the document in a "normal" form. As a consequence, 
737             * this method updates the replacement tree of 
738             * <code>EntityReference</code> nodes and normalizes <code>Text</code> 
739             * nodes, as defined in the method <code>Node.normalize()</code>. 
740             * <br> Otherwise, the actual result depends on the features being set on 
741             * the <code>Document.domConfig</code> object and governing what 
742             * operations actually take place. Noticeably this method could also 
743             * make the document namespace well-formed according to the algorithm 
744             * described in , check the character normalization, remove the 
745             * <code>CDATASection</code> nodes, etc. See 
746             * <code>DOMConfiguration</code> for details. 
747             * <pre>// Keep in the document 
748             * the information defined // in the XML Information Set (Java example) 
749             * DOMConfiguration docConfig = myDocument.getDomConfig(); 
750             * docConfig.setParameter("infoset", Boolean.TRUE); 
751             * myDocument.normalizeDocument();</pre>
752             * 
753             * <br>Mutation events, when supported, are generated to reflect the 
754             * changes occurring on the document.
755             * <br> If errors occur during the invocation of this method, such as an 
756             * attempt to update a read-only node or a <code>Node.nodeName</code> 
757             * contains an invalid character according to the XML version in use, 
758             * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or 
759             * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the 
760             * <code>DOMErrorHandler</code> object associated with the "error-handler
761             * " parameter. Note this method might also report fatal errors (
762             * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation 
763             * cannot recover from an error. 
764             * @since DOM Level 3
765             */
766            public void normalizeDocument();
767
768            /**
769             * Rename an existing node of type <code>ELEMENT_NODE</code> or 
770             * <code>ATTRIBUTE_NODE</code>.
771             * <br>When possible this simply changes the name of the given node, 
772             * otherwise this creates a new node with the specified name and 
773             * replaces the existing node with the new node as described below.
774             * <br>If simply changing the name of the given node is not possible, the 
775             * following operations are performed: a new node is created, any 
776             * registered event listener is registered on the new node, any user 
777             * data attached to the old node is removed from that node, the old node 
778             * is removed from its parent if it has one, the children are moved to 
779             * the new node, if the renamed node is an <code>Element</code> its 
780             * attributes are moved to the new node, the new node is inserted at the 
781             * position the old node used to have in its parent's child nodes list 
782             * if it has one, the user data that was attached to the old node is 
783             * attached to the new node.
784             * <br>When the node being renamed is an <code>Element</code> only the 
785             * specified attributes are moved, default attributes originated from 
786             * the DTD are updated according to the new element name. In addition, 
787             * the implementation may update default attributes from other schemas. 
788             * Applications should use <code>Document.normalizeDocument()</code> to 
789             * guarantee these attributes are up-to-date.
790             * <br>When the node being renamed is an <code>Attr</code> that is 
791             * attached to an <code>Element</code>, the node is first removed from 
792             * the <code>Element</code> attributes map. Then, once renamed, either 
793             * by modifying the existing node or creating a new one as described 
794             * above, it is put back.
795             * <br>In addition,
796             * <ul>
797             * <li> a user data event <code>NODE_RENAMED</code> is fired, 
798             * </li>
799             * <li> 
800             * when the implementation supports the feature "MutationNameEvents", 
801             * each mutation operation involved in this method fires the appropriate 
802             * event, and in the end the event {
803             * <code>http://www.w3.org/2001/xml-events</code>, 
804             * <code>DOMElementNameChanged</code>} or {
805             * <code>http://www.w3.org/2001/xml-events</code>, 
806             * <code>DOMAttributeNameChanged</code>} is fired. 
807             * </li>
808             * </ul>
809             * @param n The node to rename.
810             * @param namespaceURI The new namespace URI.
811             * @param qualifiedName The new qualified name.
812             * @return The renamed node. This is either the specified node or the new 
813             *   node that was created to replace the specified node.
814             * @exception DOMException
815             *   NOT_SUPPORTED_ERR: Raised when the type of the specified node is 
816             *   neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>, 
817             *   or if the implementation does not support the renaming of the 
818             *   document element.
819             *   <br>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an 
820             *   XML name according to the XML version in use specified in the 
821             *   <code>Document.xmlVersion</code> attribute.
822             *   <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created 
823             *   from a different document than this document.
824             *   <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 
825             *   malformed qualified name, if the <code>qualifiedName</code> has a 
826             *   prefix and the <code>namespaceURI</code> is <code>null</code>, or 
827             *   if the <code>qualifiedName</code> has a prefix that is "xml" and 
828             *   the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
829             *   http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
830             *   . Also raised, when the node being renamed is an attribute, if the 
831             *   <code>qualifiedName</code>, or its prefix, is "xmlns" and the 
832             *   <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>".
833             * @since DOM Level 3
834             */
835            public Node renameNode(Node n, String namespaceURI,
836                    String qualifiedName) throws DOMException;
837
838        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.