blob: 3193fa260fe3c76267f3dcfd32427ae68edde903 [file] [log] [blame]
The Android Open Source Projectadc854b2009-03-03 19:28:47 -08001/*
Jesse Wilson320c9892010-01-26 15:22:44 -08002 * Copyright (c) 2004 World Wide Web Consortium,
3 *
4 * (Massachusetts Institute of Technology, European Research Consortium for
5 * Informatics and Mathematics, Keio University). All Rights Reserved. This
6 * work is distributed under the W3C(r) Software License [1] in the hope that
7 * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
8 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 *
10 * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080011 */
12
13package org.w3c.dom;
14
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080015/**
Elliott Hughesf33eae72010-05-13 12:36:25 -070016 * The <code>Document</code> interface represents the entire HTML or XML
17 * document. Conceptually, it is the root of the document tree, and provides
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080018 * the primary access to the document's data.
Elliott Hughesf33eae72010-05-13 12:36:25 -070019 * <p>Since elements, text nodes, comments, processing instructions, etc.
20 * cannot exist outside the context of a <code>Document</code>, the
21 * <code>Document</code> interface also contains the factory methods needed
22 * to create these objects. The <code>Node</code> objects created have a
23 * <code>ownerDocument</code> attribute which associates them with the
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080024 * <code>Document</code> within whose context they were created.
Jesse Wilson320c9892010-01-26 15:22:44 -080025 * <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>.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080026 */
27public interface Document extends Node {
28 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -070029 * The Document Type Declaration (see <code>DocumentType</code>)
30 * associated with this document. For XML documents without a document
31 * type declaration this returns <code>null</code>. For HTML documents,
32 * a <code>DocumentType</code> object may be returned, independently of
33 * the presence or absence of document type declaration in the HTML
Jesse Wilson320c9892010-01-26 15:22:44 -080034 * document.
Elliott Hughesf33eae72010-05-13 12:36:25 -070035 * <br>This provides direct access to the <code>DocumentType</code> node,
36 * child node of this <code>Document</code>. This node can be set at
37 * document creation time and later changed through the use of child
38 * nodes manipulation methods, such as <code>Node.insertBefore</code>,
39 * or <code>Node.replaceChild</code>. Note, however, that while some
40 * implementations may instantiate different types of
41 * <code>Document</code> objects supporting additional features than the
Jesse Wilson320c9892010-01-26 15:22:44 -080042 * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -070043 * , based on the <code>DocumentType</code> specified at creation time,
44 * changing it afterwards is very unlikely to result in a change of the
Jesse Wilson320c9892010-01-26 15:22:44 -080045 * features supported.
46 * @version DOM Level 3
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080047 */
48 public DocumentType getDoctype();
49
50 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -070051 * The <code>DOMImplementation</code> object that handles this document. A
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080052 * DOM application may use objects from multiple implementations.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080053 */
54 public DOMImplementation getImplementation();
55
56 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -070057 * This is a convenience attribute that allows direct access to the child
Jesse Wilson320c9892010-01-26 15:22:44 -080058 * node that is the document element of the document.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080059 */
60 public Element getDocumentElement();
61
62 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -070063 * Creates an element of the type specified. Note that the instance
64 * returned implements the <code>Element</code> interface, so attributes
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080065 * can be specified directly on the returned object.
Elliott Hughesf33eae72010-05-13 12:36:25 -070066 * <br>In addition, if there are known attributes with default values,
67 * <code>Attr</code> nodes representing them are automatically created
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080068 * and attached to the element.
Elliott Hughesf33eae72010-05-13 12:36:25 -070069 * <br>To create an element with a qualified name and namespace URI, use
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080070 * the <code>createElementNS</code> method.
Elliott Hughesf33eae72010-05-13 12:36:25 -070071 * @param tagName The name of the element type to instantiate. For XML,
72 * this is case-sensitive, otherwise it depends on the
73 * case-sensitivity of the markup language in use. In that case, the
74 * name is mapped to the canonical form of that markup by the DOM
Jesse Wilson320c9892010-01-26 15:22:44 -080075 * implementation.
Elliott Hughesf33eae72010-05-13 12:36:25 -070076 * @return A new <code>Element</code> object with the
77 * <code>nodeName</code> attribute set to <code>tagName</code>, and
78 * <code>localName</code>, <code>prefix</code>, and
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080079 * <code>namespaceURI</code> set to <code>null</code>.
80 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -070081 * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
82 * name according to the XML version in use specified in the
Jesse Wilson320c9892010-01-26 15:22:44 -080083 * <code>Document.xmlVersion</code> attribute.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080084 */
85 public Element createElement(String tagName)
86 throws DOMException;
87
88 /**
Jesse Wilson320c9892010-01-26 15:22:44 -080089 * Creates an empty <code>DocumentFragment</code> object.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -080090 * @return A new <code>DocumentFragment</code>.
91 */
92 public DocumentFragment createDocumentFragment();
93
94 /**
95 * Creates a <code>Text</code> node given the specified string.
96 * @param data The data for the node.
97 * @return The new <code>Text</code> object.
98 */
99 public Text createTextNode(String data);
100
101 /**
102 * Creates a <code>Comment</code> node given the specified string.
103 * @param data The data for the node.
104 * @return The new <code>Comment</code> object.
105 */
106 public Comment createComment(String data);
107
108 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700109 * Creates a <code>CDATASection</code> node whose value is the specified
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800110 * string.
111 * @param data The data for the <code>CDATASection</code> contents.
112 * @return The new <code>CDATASection</code> object.
113 * @exception DOMException
114 * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
115 */
116 public CDATASection createCDATASection(String data)
117 throws DOMException;
118
119 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700120 * Creates a <code>ProcessingInstruction</code> node given the specified
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800121 * name and data strings.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700122 * @param target The target part of the processing instruction.Unlike
123 * <code>Document.createElementNS</code> or
124 * <code>Document.createAttributeNS</code>, no namespace well-formed
125 * checking is done on the target name. Applications should invoke
Jesse Wilson320c9892010-01-26 15:22:44 -0800126 * <code>Document.normalizeDocument()</code> with the parameter "
Elliott Hughesf33eae72010-05-13 12:36:25 -0700127 * namespaces" set to <code>true</code> in order to ensure that the
128 * target name is namespace well-formed.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800129 * @param data The data for the node.
130 * @return The new <code>ProcessingInstruction</code> object.
131 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700132 * INVALID_CHARACTER_ERR: Raised if the specified target is not an XML
133 * name according to the XML version in use specified in the
Jesse Wilson320c9892010-01-26 15:22:44 -0800134 * <code>Document.xmlVersion</code> attribute.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800135 * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
136 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700137 public ProcessingInstruction createProcessingInstruction(String target,
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800138 String data)
139 throws DOMException;
140
141 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700142 * Creates an <code>Attr</code> of the given name. Note that the
143 * <code>Attr</code> instance can then be set on an <code>Element</code>
144 * using the <code>setAttributeNode</code> method.
145 * <br>To create an attribute with a qualified name and namespace URI, use
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800146 * the <code>createAttributeNS</code> method.
147 * @param name The name of the attribute.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700148 * @return A new <code>Attr</code> object with the <code>nodeName</code>
149 * attribute set to <code>name</code>, and <code>localName</code>,
150 * <code>prefix</code>, and <code>namespaceURI</code> set to
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800151 * <code>null</code>. The value of the attribute is the empty string.
152 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700153 * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
154 * name according to the XML version in use specified in the
Jesse Wilson320c9892010-01-26 15:22:44 -0800155 * <code>Document.xmlVersion</code> attribute.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800156 */
157 public Attr createAttribute(String name)
158 throws DOMException;
159
160 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700161 * Creates an <code>EntityReference</code> object. In addition, if the
162 * referenced entity is known, the child list of the
163 * <code>EntityReference</code> node is made the same as that of the
Jesse Wilson320c9892010-01-26 15:22:44 -0800164 * corresponding <code>Entity</code> node.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700165 * <p ><b>Note:</b> If any descendant of the <code>Entity</code> node has
166 * an unbound namespace prefix, the corresponding descendant of the
167 * created <code>EntityReference</code> node is also unbound; (its
168 * <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and
169 * 3 do not support any mechanism to resolve namespace prefixes in this
Jesse Wilson320c9892010-01-26 15:22:44 -0800170 * case.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700171 * @param name The name of the entity to reference.Unlike
172 * <code>Document.createElementNS</code> or
173 * <code>Document.createAttributeNS</code>, no namespace well-formed
174 * checking is done on the entity name. Applications should invoke
Jesse Wilson320c9892010-01-26 15:22:44 -0800175 * <code>Document.normalizeDocument()</code> with the parameter "
Elliott Hughesf33eae72010-05-13 12:36:25 -0700176 * namespaces" set to <code>true</code> in order to ensure that the
177 * entity name is namespace well-formed.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800178 * @return The new <code>EntityReference</code> object.
179 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700180 * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
181 * name according to the XML version in use specified in the
Jesse Wilson320c9892010-01-26 15:22:44 -0800182 * <code>Document.xmlVersion</code> attribute.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800183 * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
184 */
185 public EntityReference createEntityReference(String name)
186 throws DOMException;
187
188 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700189 * Returns a <code>NodeList</code> of all the <code>Elements</code> in
190 * document order with a given tag name and are contained in the
Jesse Wilson320c9892010-01-26 15:22:44 -0800191 * document.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700192 * @param tagname The name of the tag to match on. The special value "*"
193 * matches all tags. For XML, the <code>tagname</code> parameter is
194 * case-sensitive, otherwise it depends on the case-sensitivity of the
195 * markup language in use.
196 * @return A new <code>NodeList</code> object containing all the matched
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800197 * <code>Elements</code>.
198 */
199 public NodeList getElementsByTagName(String tagname);
200
201 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700202 * Imports a node from another document to this document, without altering
203 * or removing the source node from the original document; this method
204 * creates a new copy of the source node. The returned node has no
Jesse Wilson320c9892010-01-26 15:22:44 -0800205 * parent; (<code>parentNode</code> is <code>null</code>).
Elliott Hughesf33eae72010-05-13 12:36:25 -0700206 * <br>For all nodes, importing a node creates a node object owned by the
207 * importing document, with attribute values identical to the source
208 * node's <code>nodeName</code> and <code>nodeType</code>, plus the
209 * attributes related to namespaces (<code>prefix</code>,
210 * <code>localName</code>, and <code>namespaceURI</code>). As in the
211 * <code>cloneNode</code> operation, the source node is not altered.
212 * User data associated to the imported node is not carried over.
213 * However, if any <code>UserDataHandlers</code> has been specified
214 * along with the associated data these handlers will be called with the
Jesse Wilson320c9892010-01-26 15:22:44 -0800215 * appropriate parameters before this method returns.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700216 * <br>Additional information is copied as appropriate to the
217 * <code>nodeType</code>, attempting to mirror the behavior expected if
218 * a fragment of XML or HTML source was copied from one document to
219 * another, recognizing that the two documents may have different DTDs
220 * in the XML case. The following list describes the specifics for each
221 * type of node.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800222 * <dl>
223 * <dt>ATTRIBUTE_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700224 * <dd>The <code>ownerElement</code> attribute
225 * is set to <code>null</code> and the <code>specified</code> flag is
226 * set to <code>true</code> on the generated <code>Attr</code>. The
227 * descendants of the source <code>Attr</code> are recursively imported
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800228 * and the resulting nodes reassembled to form the corresponding subtree.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700229 * Note that the <code>deep</code> parameter has no effect on
230 * <code>Attr</code> nodes; they always carry their children with them
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800231 * when imported.</dd>
232 * <dt>DOCUMENT_FRAGMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700233 * <dd>If the <code>deep</code> option
234 * was set to <code>true</code>, the descendants of the source
235 * <code>DocumentFragment</code> are recursively imported and the
236 * resulting nodes reassembled under the imported
237 * <code>DocumentFragment</code> to form the corresponding subtree.
238 * Otherwise, this simply generates an empty
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800239 * <code>DocumentFragment</code>.</dd>
240 * <dt>DOCUMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700241 * <dd><code>Document</code>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800242 * nodes cannot be imported.</dd>
243 * <dt>DOCUMENT_TYPE_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700244 * <dd><code>DocumentType</code>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800245 * nodes cannot be imported.</dd>
246 * <dt>ELEMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700247 * <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated
248 * <code>Attr</code> nodes are attached to the generated
249 * <code>Element</code>. Default attributes are <em>not</em> copied, though if the document being imported into defines default
250 * attributes for this element name, those are assigned. If the
251 * <code>importNode</code> <code>deep</code> parameter was set to
252 * <code>true</code>, the descendants of the source element are
253 * recursively imported and the resulting nodes reassembled to form the
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800254 * corresponding subtree.</dd>
255 * <dt>ENTITY_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700256 * <dd><code>Entity</code> nodes can be
257 * imported, however in the current release of the DOM the
258 * <code>DocumentType</code> is readonly. Ability to add these imported
259 * nodes to a <code>DocumentType</code> will be considered for addition
260 * to a future release of the DOM.On import, the <code>publicId</code>,
261 * <code>systemId</code>, and <code>notationName</code> attributes are
262 * copied. If a <code>deep</code> import is requested, the descendants
263 * of the the source <code>Entity</code> are recursively imported and
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800264 * the resulting nodes reassembled to form the corresponding subtree.</dd>
265 * <dt>
266 * ENTITY_REFERENCE_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700267 * <dd>Only the <code>EntityReference</code> itself is
268 * copied, even if a <code>deep</code> import is requested, since the
269 * source and destination documents might have defined the entity
270 * differently. If the document being imported into provides a
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800271 * definition for this entity name, its value is assigned.</dd>
272 * <dt>NOTATION_NODE</dt>
273 * <dd>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700274 * <code>Notation</code> nodes can be imported, however in the current
275 * release of the DOM the <code>DocumentType</code> is readonly. Ability
276 * to add these imported nodes to a <code>DocumentType</code> will be
277 * considered for addition to a future release of the DOM.On import, the
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800278 * <code>publicId</code> and <code>systemId</code> attributes are copied.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700279 * Note that the <code>deep</code> parameter has no effect on this type
Jesse Wilson320c9892010-01-26 15:22:44 -0800280 * of nodes since they cannot have any children.</dd>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800281 * <dt>
282 * PROCESSING_INSTRUCTION_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700283 * <dd>The imported node copies its
284 * <code>target</code> and <code>data</code> values from those of the
285 * source node.Note that the <code>deep</code> parameter has no effect
Jesse Wilson320c9892010-01-26 15:22:44 -0800286 * on this type of nodes since they cannot have any children.</dd>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700287 * <dt>TEXT_NODE,
Jesse Wilson320c9892010-01-26 15:22:44 -0800288 * CDATA_SECTION_NODE, COMMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700289 * <dd>These three types of nodes inheriting
290 * from <code>CharacterData</code> copy their <code>data</code> and
291 * <code>length</code> attributes from those of the source node.Note
292 * that the <code>deep</code> parameter has no effect on these types of
Jesse Wilson320c9892010-01-26 15:22:44 -0800293 * nodes since they cannot have any children.</dd>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700294 * </dl>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800295 * @param importedNode The node to import.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700296 * @param deep If <code>true</code>, recursively import the subtree under
297 * the specified node; if <code>false</code>, import only the node
298 * itself, as explained above. This has no effect on nodes that cannot
299 * have any children, and on <code>Attr</code>, and
Jesse Wilson320c9892010-01-26 15:22:44 -0800300 * <code>EntityReference</code> nodes.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800301 * @return The imported node that belongs to this <code>Document</code>.
302 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700303 * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800304 * supported.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700305 * <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not
306 * an XML name according to the XML version in use specified in the
307 * <code>Document.xmlVersion</code> attribute. This may happen when
308 * importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element
Jesse Wilson320c9892010-01-26 15:22:44 -0800309 * into an XML 1.0 document, for instance.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800310 * @since DOM Level 2
311 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700312 public Node importNode(Node importedNode,
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800313 boolean deep)
314 throws DOMException;
315
316 /**
Jesse Wilson320c9892010-01-26 15:22:44 -0800317 * Creates an element of the given qualified name and namespace URI.
318 * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700319 * , applications must use the value <code>null</code> as the
Jesse Wilson320c9892010-01-26 15:22:44 -0800320 * namespaceURI parameter for methods if they wish to have no namespace.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800321 * @param namespaceURI The namespace URI of the element to create.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700322 * @param qualifiedName The qualified name of the element type to
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800323 * instantiate.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700324 * @return A new <code>Element</code> object with the following
Jesse Wilson320c9892010-01-26 15:22:44 -0800325 * attributes:
326 * <table border='1' cellpadding='3'>
327 * <tr>
328 * <th>Attribute</th>
329 * <th>Value</th>
330 * </tr>
331 * <tr>
332 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
333 * <td valign='top' rowspan='1' colspan='1'>
334 * <code>qualifiedName</code></td>
335 * </tr>
336 * <tr>
337 * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
338 * <td valign='top' rowspan='1' colspan='1'>
339 * <code>namespaceURI</code></td>
340 * </tr>
341 * <tr>
342 * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700343 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
344 * from <code>qualifiedName</code>, or <code>null</code> if there is
Jesse Wilson320c9892010-01-26 15:22:44 -0800345 * no prefix</td>
346 * </tr>
347 * <tr>
348 * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700349 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
Jesse Wilson320c9892010-01-26 15:22:44 -0800350 * <code>qualifiedName</code></td>
351 * </tr>
352 * <tr>
353 * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
354 * <td valign='top' rowspan='1' colspan='1'>
355 * <code>qualifiedName</code></td>
356 * </tr>
357 * </table>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800358 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700359 * INVALID_CHARACTER_ERR: Raised if the specified
360 * <code>qualifiedName</code> is not an XML name according to the XML
361 * version in use specified in the <code>Document.xmlVersion</code>
Jesse Wilson320c9892010-01-26 15:22:44 -0800362 * attribute.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700363 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
364 * malformed qualified name, if the <code>qualifiedName</code> has a
365 * prefix and the <code>namespaceURI</code> is <code>null</code>, or
366 * if the <code>qualifiedName</code> has a prefix that is "xml" and
Jesse Wilson320c9892010-01-26 15:22:44 -0800367 * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
368 * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700369 * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and
Jesse Wilson320c9892010-01-26 15:22:44 -0800370 * 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".
Elliott Hughesf33eae72010-05-13 12:36:25 -0700371 * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
372 * support the <code>"XML"</code> feature, since namespaces were
Jesse Wilson320c9892010-01-26 15:22:44 -0800373 * defined by XML.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800374 * @since DOM Level 2
375 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700376 public Element createElementNS(String namespaceURI,
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800377 String qualifiedName)
378 throws DOMException;
379
380 /**
Jesse Wilson320c9892010-01-26 15:22:44 -0800381 * Creates an attribute of the given qualified name and namespace URI.
382 * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700383 * , applications must use the value <code>null</code> as the
384 * <code>namespaceURI</code> parameter for methods if they wish to have
Jesse Wilson320c9892010-01-26 15:22:44 -0800385 * no namespace.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800386 * @param namespaceURI The namespace URI of the attribute to create.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700387 * @param qualifiedName The qualified name of the attribute to
Jesse Wilson320c9892010-01-26 15:22:44 -0800388 * instantiate.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800389 * @return A new <code>Attr</code> object with the following attributes:
Jesse Wilson320c9892010-01-26 15:22:44 -0800390 * <table border='1' cellpadding='3'>
391 * <tr>
392 * <th>
393 * Attribute</th>
394 * <th>Value</th>
395 * </tr>
396 * <tr>
397 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
398 * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
399 * </tr>
400 * <tr>
401 * <td valign='top' rowspan='1' colspan='1'>
402 * <code>Node.namespaceURI</code></td>
403 * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
404 * </tr>
405 * <tr>
406 * <td valign='top' rowspan='1' colspan='1'>
407 * <code>Node.prefix</code></td>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700408 * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
409 * <code>qualifiedName</code>, or <code>null</code> if there is no
Jesse Wilson320c9892010-01-26 15:22:44 -0800410 * prefix</td>
411 * </tr>
412 * <tr>
413 * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700414 * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
Jesse Wilson320c9892010-01-26 15:22:44 -0800415 * <code>qualifiedName</code></td>
416 * </tr>
417 * <tr>
418 * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
419 * <td valign='top' rowspan='1' colspan='1'>
420 * <code>qualifiedName</code></td>
421 * </tr>
422 * <tr>
423 * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700424 * <td valign='top' rowspan='1' colspan='1'>the empty
Jesse Wilson320c9892010-01-26 15:22:44 -0800425 * string</td>
426 * </tr>
427 * </table>
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800428 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700429 * INVALID_CHARACTER_ERR: Raised if the specified
430 * <code>qualifiedName</code> is not an XML name according to the XML
431 * version in use specified in the <code>Document.xmlVersion</code>
Jesse Wilson320c9892010-01-26 15:22:44 -0800432 * attribute.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700433 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
434 * malformed qualified name, if the <code>qualifiedName</code> has a
435 * prefix and the <code>namespaceURI</code> is <code>null</code>, if
436 * the <code>qualifiedName</code> has a prefix that is "xml" and the
Jesse Wilson320c9892010-01-26 15:22:44 -0800437 * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700438 * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the
Jesse Wilson320c9892010-01-26 15:22:44 -0800439 * <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".
Elliott Hughesf33eae72010-05-13 12:36:25 -0700440 * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
441 * support the <code>"XML"</code> feature, since namespaces were
Jesse Wilson320c9892010-01-26 15:22:44 -0800442 * defined by XML.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800443 * @since DOM Level 2
444 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700445 public Attr createAttributeNS(String namespaceURI,
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800446 String qualifiedName)
447 throws DOMException;
448
449 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700450 * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
Jesse Wilson320c9892010-01-26 15:22:44 -0800451 * given local name and namespace URI in document order.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700452 * @param namespaceURI The namespace URI of the elements to match on. The
Jesse Wilson320c9892010-01-26 15:22:44 -0800453 * special value <code>"*"</code> matches all namespaces.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700454 * @param localName The local name of the elements to match on. The
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800455 * special value "*" matches all local names.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700456 * @return A new <code>NodeList</code> object containing all the matched
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800457 * <code>Elements</code>.
458 * @since DOM Level 2
459 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700460 public NodeList getElementsByTagNameNS(String namespaceURI,
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800461 String localName);
462
463 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700464 * Returns the <code>Element</code> that has an ID attribute with the
Jesse Wilson320c9892010-01-26 15:22:44 -0800465 * given value. If no such element exists, this returns <code>null</code>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700466 * . If more than one element has an ID attribute with that value, what
467 * is returned is undefined.
468 * <br> The DOM implementation is expected to use the attribute
469 * <code>Attr.isId</code> to determine if an attribute is of type ID.
470 * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type
Jesse Wilson320c9892010-01-26 15:22:44 -0800471 * ID unless so defined.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800472 * @param elementId The unique <code>id</code> value for an element.
Jesse Wilson320c9892010-01-26 15:22:44 -0800473 * @return The matching element or <code>null</code> if there is none.
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800474 * @since DOM Level 2
475 */
476 public Element getElementById(String elementId);
477
Jesse Wilson320c9892010-01-26 15:22:44 -0800478 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700479 * An attribute specifying the encoding used for this document at the time
480 * of the parsing. This is <code>null</code> when it is not known, such
Jesse Wilson320c9892010-01-26 15:22:44 -0800481 * as when the <code>Document</code> was created in memory.
482 * @since DOM Level 3
483 */
484 public String getInputEncoding();
485
486 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700487 * 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
488 * unspecified or when it is not known, such as when the
Jesse Wilson320c9892010-01-26 15:22:44 -0800489 * <code>Document</code> was created in memory.
490 * @since DOM Level 3
491 */
492 public String getXmlEncoding();
493
494 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700495 * 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
Jesse Wilson320c9892010-01-26 15:22:44 -0800496 * unspecified.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700497 * <p ><b>Note:</b> No verification is done on the value when setting
498 * this attribute. Applications should use
499 * <code>Document.normalizeDocument()</code> with the "validate"
500 * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
501 * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
Jesse Wilson320c9892010-01-26 15:22:44 -0800502 * @since DOM Level 3
503 */
504 public boolean getXmlStandalone();
505 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700506 * 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
Jesse Wilson320c9892010-01-26 15:22:44 -0800507 * unspecified.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700508 * <p ><b>Note:</b> No verification is done on the value when setting
509 * this attribute. Applications should use
510 * <code>Document.normalizeDocument()</code> with the "validate"
511 * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
512 * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
Jesse Wilson320c9892010-01-26 15:22:44 -0800513 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700514 * NOT_SUPPORTED_ERR: Raised if this document does not support the
515 * "XML" feature.
Jesse Wilson320c9892010-01-26 15:22:44 -0800516 * @since DOM Level 3
517 */
518 public void setXmlStandalone(boolean xmlStandalone)
519 throws DOMException;
520
521 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700522 * 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
523 * this document supports the "XML" feature, the value is
524 * <code>"1.0"</code>. If this document does not support the "XML"
525 * feature, the value is always <code>null</code>. Changing this
526 * attribute will affect methods that check for invalid characters in
527 * XML names. Application should invoke
528 * <code>Document.normalizeDocument()</code> in order to check for
529 * invalid characters in the <code>Node</code>s that are already part of
530 * this <code>Document</code>.
531 * <br> DOM applications may use the
532 * <code>DOMImplementation.hasFeature(feature, version)</code> method
533 * with parameter values "XMLVersion" and "1.0" (respectively) to
534 * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
535 * applications may use the same method with parameter values
536 * "XMLVersion" and "1.1" (respectively) to determine if an
537 * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
538 * cases, in order to support XML, an implementation must also support
Jesse Wilson320c9892010-01-26 15:22:44 -0800539 * the "XML" feature defined in this specification. <code>Document</code>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700540 * objects supporting a version of the "XMLVersion" feature must not
541 * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
542 * number when using <code>Document.xmlVersion</code>.
Jesse Wilson320c9892010-01-26 15:22:44 -0800543 * @since DOM Level 3
544 */
545 public String getXmlVersion();
546 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700547 * 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
Jesse Wilson320c9892010-01-26 15:22:44 -0800564 * the "XML" feature defined in this specification. <code>Document</code>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700565 * 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>.
Jesse Wilson320c9892010-01-26 15:22:44 -0800568 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700569 * NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
570 * not supported by this <code>Document</code> or if this document
571 * does not support the "XML" feature.
Jesse Wilson320c9892010-01-26 15:22:44 -0800572 * @since DOM Level 3
573 */
574 public void setXmlVersion(String xmlVersion)
575 throws DOMException;
576
577 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700578 * An attribute specifying whether error checking is enforced or not. When
579 * set to <code>false</code>, the implementation is free to not test
580 * every possible error case normally defined on DOM operations, and not
581 * raise any <code>DOMException</code> on DOM operations or report
582 * errors while using <code>Document.normalizeDocument()</code>. In case
583 * of error, the behavior is undefined. This attribute is
Jesse Wilson320c9892010-01-26 15:22:44 -0800584 * <code>true</code> by default.
585 * @since DOM Level 3
586 */
587 public boolean getStrictErrorChecking();
588 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700589 * An attribute specifying whether error checking is enforced or not. When
590 * set to <code>false</code>, the implementation is free to not test
591 * every possible error case normally defined on DOM operations, and not
592 * raise any <code>DOMException</code> on DOM operations or report
593 * errors while using <code>Document.normalizeDocument()</code>. In case
594 * of error, the behavior is undefined. This attribute is
Jesse Wilson320c9892010-01-26 15:22:44 -0800595 * <code>true</code> by default.
596 * @since DOM Level 3
597 */
598 public void setStrictErrorChecking(boolean strictErrorChecking);
599
600 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700601 * The location of the document or <code>null</code> if undefined or if
602 * the <code>Document</code> was created using
603 * <code>DOMImplementation.createDocument</code>. No lexical checking is
604 * performed when setting this attribute; this could result in a
Jesse Wilson320c9892010-01-26 15:22:44 -0800605 * <code>null</code> value returned when using <code>Node.baseURI</code>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700606 * .
607 * <br> Beware that when the <code>Document</code> supports the feature
Jesse Wilson320c9892010-01-26 15:22:44 -0800608 * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700609 * , the href attribute of the HTML BASE element takes precedence over
610 * this attribute when computing <code>Node.baseURI</code>.
Jesse Wilson320c9892010-01-26 15:22:44 -0800611 * @since DOM Level 3
612 */
613 public String getDocumentURI();
614 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700615 * The location of the document or <code>null</code> if undefined or if
616 * the <code>Document</code> was created using
617 * <code>DOMImplementation.createDocument</code>. No lexical checking is
618 * performed when setting this attribute; this could result in a
Jesse Wilson320c9892010-01-26 15:22:44 -0800619 * <code>null</code> value returned when using <code>Node.baseURI</code>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700620 * .
621 * <br> Beware that when the <code>Document</code> supports the feature
Jesse Wilson320c9892010-01-26 15:22:44 -0800622 * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700623 * , the href attribute of the HTML BASE element takes precedence over
624 * this attribute when computing <code>Node.baseURI</code>.
Jesse Wilson320c9892010-01-26 15:22:44 -0800625 * @since DOM Level 3
626 */
627 public void setDocumentURI(String documentURI);
628
629 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700630 * Attempts to adopt a node from another document to this document. If
631 * supported, it changes the <code>ownerDocument</code> of the source
632 * node, its children, as well as the attached attribute nodes if there
633 * are any. If the source node has a parent it is first removed from the
634 * child list of its parent. This effectively allows moving a subtree
635 * from one document to another (unlike <code>importNode()</code> which
636 * create a copy of the source node instead of moving it). When it
637 * fails, applications should use <code>Document.importNode()</code>
638 * instead. Note that if the adopted node is already part of this
639 * document (i.e. the source and target document are the same), this
640 * method still has the effect of removing the source node from the
641 * child list of its parent, if any. The following list describes the
642 * specifics for each type of node.
Jesse Wilson320c9892010-01-26 15:22:44 -0800643 * <dl>
644 * <dt>ATTRIBUTE_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700645 * <dd>The
646 * <code>ownerElement</code> attribute is set to <code>null</code> and
647 * the <code>specified</code> flag is set to <code>true</code> on the
648 * adopted <code>Attr</code>. The descendants of the source
Jesse Wilson320c9892010-01-26 15:22:44 -0800649 * <code>Attr</code> are recursively adopted.</dd>
650 * <dt>DOCUMENT_FRAGMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700651 * <dd>The
Jesse Wilson320c9892010-01-26 15:22:44 -0800652 * descendants of the source node are recursively adopted.</dd>
653 * <dt>DOCUMENT_NODE</dt>
654 * <dd>
655 * <code>Document</code> nodes cannot be adopted.</dd>
656 * <dt>DOCUMENT_TYPE_NODE</dt>
657 * <dd>
658 * <code>DocumentType</code> nodes cannot be adopted.</dd>
659 * <dt>ELEMENT_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700660 * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes
661 * are discarded, though if the document being adopted into defines
662 * default attributes for this element name, those are assigned. The
Jesse Wilson320c9892010-01-26 15:22:44 -0800663 * descendants of the source element are recursively adopted.</dd>
664 * <dt>ENTITY_NODE</dt>
665 * <dd>
666 * <code>Entity</code> nodes cannot be adopted.</dd>
667 * <dt>ENTITY_REFERENCE_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700668 * <dd>Only
669 * the <code>EntityReference</code> node itself is adopted, the
670 * descendants are discarded, since the source and destination documents
671 * might have defined the entity differently. If the document being
672 * imported into provides a definition for this entity name, its value
Jesse Wilson320c9892010-01-26 15:22:44 -0800673 * is assigned.</dd>
674 * <dt>NOTATION_NODE</dt>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700675 * <dd><code>Notation</code> nodes cannot be
Jesse Wilson320c9892010-01-26 15:22:44 -0800676 * adopted.</dd>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700677 * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE,
Jesse Wilson320c9892010-01-26 15:22:44 -0800678 * COMMENT_NODE</dt>
679 * <dd>These nodes can all be adopted. No specifics.</dd>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700680 * </dl>
681 * <p ><b>Note:</b> Since it does not create new nodes unlike the
682 * <code>Document.importNode()</code> method, this method does not raise
683 * an <code>INVALID_CHARACTER_ERR</code> exception, and applications
684 * should use the <code>Document.normalizeDocument()</code> method to
685 * check if an imported name is not an XML name according to the XML
686 * version in use.
Jesse Wilson320c9892010-01-26 15:22:44 -0800687 * @param source The node to move into this document.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700688 * @return The adopted node, or <code>null</code> if this operation
689 * fails, such as when the source node comes from a different
Jesse Wilson320c9892010-01-26 15:22:44 -0800690 * implementation.
691 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700692 * NOT_SUPPORTED_ERR: Raised if the source node is of type
Jesse Wilson320c9892010-01-26 15:22:44 -0800693 * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700694 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
Jesse Wilson320c9892010-01-26 15:22:44 -0800695 * readonly.
696 * @since DOM Level 3
697 */
698 public Node adoptNode(Node source)
699 throws DOMException;
700
701 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700702 * The configuration used when <code>Document.normalizeDocument()</code>
703 * is invoked.
Jesse Wilson320c9892010-01-26 15:22:44 -0800704 * @since DOM Level 3
705 */
706 public DOMConfiguration getDomConfig();
707
708 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700709 * This method acts as if the document was going through a save and load
710 * cycle, putting the document in a "normal" form. As a consequence,
711 * this method updates the replacement tree of
712 * <code>EntityReference</code> nodes and normalizes <code>Text</code>
713 * nodes, as defined in the method <code>Node.normalize()</code>.
714 * <br> Otherwise, the actual result depends on the features being set on
715 * the <code>Document.domConfig</code> object and governing what
716 * operations actually take place. Noticeably this method could also
717 * make the document namespace well-formed according to the algorithm
718 * described in , check the character normalization, remove the
719 * <code>CDATASection</code> nodes, etc. See
720 * <code>DOMConfiguration</code> for details.
721 * <pre>// Keep in the document
722 * the information defined // in the XML Information Set (Java example)
723 * DOMConfiguration docConfig = myDocument.getDomConfig();
724 * docConfig.setParameter("infoset", Boolean.TRUE);
Jesse Wilson320c9892010-01-26 15:22:44 -0800725 * myDocument.normalizeDocument();</pre>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700726 *
727 * <br>Mutation events, when supported, are generated to reflect the
Jesse Wilson320c9892010-01-26 15:22:44 -0800728 * changes occurring on the document.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700729 * <br> If errors occur during the invocation of this method, such as an
730 * attempt to update a read-only node or a <code>Node.nodeName</code>
731 * contains an invalid character according to the XML version in use,
732 * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or
733 * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the
Jesse Wilson320c9892010-01-26 15:22:44 -0800734 * <code>DOMErrorHandler</code> object associated with the "error-handler
735 * " parameter. Note this method might also report fatal errors (
Elliott Hughesf33eae72010-05-13 12:36:25 -0700736 * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation
737 * cannot recover from an error.
Jesse Wilson320c9892010-01-26 15:22:44 -0800738 * @since DOM Level 3
739 */
740 public void normalizeDocument();
741
742 /**
Elliott Hughesf33eae72010-05-13 12:36:25 -0700743 * Rename an existing node of type <code>ELEMENT_NODE</code> or
Jesse Wilson320c9892010-01-26 15:22:44 -0800744 * <code>ATTRIBUTE_NODE</code>.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700745 * <br>When possible this simply changes the name of the given node,
746 * otherwise this creates a new node with the specified name and
Jesse Wilson320c9892010-01-26 15:22:44 -0800747 * replaces the existing node with the new node as described below.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700748 * <br>If simply changing the name of the given node is not possible, the
749 * following operations are performed: a new node is created, any
750 * registered event listener is registered on the new node, any user
751 * data attached to the old node is removed from that node, the old node
752 * is removed from its parent if it has one, the children are moved to
753 * the new node, if the renamed node is an <code>Element</code> its
754 * attributes are moved to the new node, the new node is inserted at the
755 * position the old node used to have in its parent's child nodes list
756 * if it has one, the user data that was attached to the old node is
Jesse Wilson320c9892010-01-26 15:22:44 -0800757 * attached to the new node.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700758 * <br>When the node being renamed is an <code>Element</code> only the
759 * specified attributes are moved, default attributes originated from
760 * the DTD are updated according to the new element name. In addition,
761 * the implementation may update default attributes from other schemas.
762 * Applications should use <code>Document.normalizeDocument()</code> to
Jesse Wilson320c9892010-01-26 15:22:44 -0800763 * guarantee these attributes are up-to-date.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700764 * <br>When the node being renamed is an <code>Attr</code> that is
765 * attached to an <code>Element</code>, the node is first removed from
766 * the <code>Element</code> attributes map. Then, once renamed, either
767 * by modifying the existing node or creating a new one as described
Jesse Wilson320c9892010-01-26 15:22:44 -0800768 * above, it is put back.
769 * <br>In addition,
770 * <ul>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700771 * <li> a user data event <code>NODE_RENAMED</code> is fired,
Jesse Wilson320c9892010-01-26 15:22:44 -0800772 * </li>
Elliott Hughesf33eae72010-05-13 12:36:25 -0700773 * <li>
774 * when the implementation supports the feature "MutationNameEvents",
775 * each mutation operation involved in this method fires the appropriate
Jesse Wilson320c9892010-01-26 15:22:44 -0800776 * event, and in the end the event {
Elliott Hughesf33eae72010-05-13 12:36:25 -0700777 * <code>http://www.w3.org/2001/xml-events</code>,
Jesse Wilson320c9892010-01-26 15:22:44 -0800778 * <code>DOMElementNameChanged</code>} or {
Elliott Hughesf33eae72010-05-13 12:36:25 -0700779 * <code>http://www.w3.org/2001/xml-events</code>,
780 * <code>DOMAttributeNameChanged</code>} is fired.
Jesse Wilson320c9892010-01-26 15:22:44 -0800781 * </li>
782 * </ul>
783 * @param n The node to rename.
784 * @param namespaceURI The new namespace URI.
785 * @param qualifiedName The new qualified name.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700786 * @return The renamed node. This is either the specified node or the new
Jesse Wilson320c9892010-01-26 15:22:44 -0800787 * node that was created to replace the specified node.
788 * @exception DOMException
Elliott Hughesf33eae72010-05-13 12:36:25 -0700789 * NOT_SUPPORTED_ERR: Raised when the type of the specified node is
790 * neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>,
791 * or if the implementation does not support the renaming of the
Jesse Wilson320c9892010-01-26 15:22:44 -0800792 * document element.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700793 * <br>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an
794 * XML name according to the XML version in use specified in the
Jesse Wilson320c9892010-01-26 15:22:44 -0800795 * <code>Document.xmlVersion</code> attribute.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700796 * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created
Jesse Wilson320c9892010-01-26 15:22:44 -0800797 * from a different document than this document.
Elliott Hughesf33eae72010-05-13 12:36:25 -0700798 * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
799 * malformed qualified name, if the <code>qualifiedName</code> has a
800 * prefix and the <code>namespaceURI</code> is <code>null</code>, or
801 * if the <code>qualifiedName</code> has a prefix that is "xml" and
Jesse Wilson320c9892010-01-26 15:22:44 -0800802 * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
803 * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
Elliott Hughesf33eae72010-05-13 12:36:25 -0700804 * . Also raised, when the node being renamed is an attribute, if the
805 * <code>qualifiedName</code>, or its prefix, is "xmlns" and the
Jesse Wilson320c9892010-01-26 15:22:44 -0800806 * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>".
807 * @since DOM Level 3
808 */
Elliott Hughesf33eae72010-05-13 12:36:25 -0700809 public Node renameNode(Node n,
810 String namespaceURI,
Jesse Wilson320c9892010-01-26 15:22:44 -0800811 String qualifiedName)
812 throws DOMException;
813
The Android Open Source Projectadc854b2009-03-03 19:28:47 -0800814}