The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 1 | /* |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 2 | * 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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 11 | */ |
| 12 | |
| 13 | package org.w3c.dom; |
| 14 | |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 15 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 16 | * 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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 18 | * the primary access to the document's data. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 19 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 24 | * <code>Document</code> within whose context they were created. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 25 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 26 | */ |
| 27 | public interface Document extends Node { |
| 28 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 29 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 34 | * document. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 35 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 42 | * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 43 | * , 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 45 | * features supported. |
| 46 | * @version DOM Level 3 |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 47 | */ |
| 48 | public DocumentType getDoctype(); |
| 49 | |
| 50 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 51 | * The <code>DOMImplementation</code> object that handles this document. A |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 52 | * DOM application may use objects from multiple implementations. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 53 | */ |
| 54 | public DOMImplementation getImplementation(); |
| 55 | |
| 56 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 57 | * This is a convenience attribute that allows direct access to the child |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 58 | * node that is the document element of the document. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 59 | */ |
| 60 | public Element getDocumentElement(); |
| 61 | |
| 62 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 63 | * 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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 65 | * can be specified directly on the returned object. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 66 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 68 | * and attached to the element. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 69 | * <br>To create an element with a qualified name and namespace URI, use |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 70 | * the <code>createElementNS</code> method. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 71 | * @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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 75 | * implementation. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 76 | * @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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 79 | * <code>namespaceURI</code> set to <code>null</code>. |
| 80 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 81 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 83 | * <code>Document.xmlVersion</code> attribute. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 84 | */ |
| 85 | public Element createElement(String tagName) |
| 86 | throws DOMException; |
| 87 | |
| 88 | /** |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 89 | * Creates an empty <code>DocumentFragment</code> object. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 90 | * @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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 109 | * Creates a <code>CDATASection</code> node whose value is the specified |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 110 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 120 | * Creates a <code>ProcessingInstruction</code> node given the specified |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 121 | * name and data strings. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 122 | * @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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 126 | * <code>Document.normalizeDocument()</code> with the parameter " |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 127 | * namespaces" set to <code>true</code> in order to ensure that the |
| 128 | * target name is namespace well-formed. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 129 | * @param data The data for the node. |
| 130 | * @return The new <code>ProcessingInstruction</code> object. |
| 131 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 132 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 134 | * <code>Document.xmlVersion</code> attribute. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 135 | * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document. |
| 136 | */ |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 137 | public ProcessingInstruction createProcessingInstruction(String target, |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 138 | String data) |
| 139 | throws DOMException; |
| 140 | |
| 141 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 142 | * 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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 146 | * the <code>createAttributeNS</code> method. |
| 147 | * @param name The name of the attribute. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 148 | * @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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 151 | * <code>null</code>. The value of the attribute is the empty string. |
| 152 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 153 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 155 | * <code>Document.xmlVersion</code> attribute. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 156 | */ |
| 157 | public Attr createAttribute(String name) |
| 158 | throws DOMException; |
| 159 | |
| 160 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 161 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 164 | * corresponding <code>Entity</code> node. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 165 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 170 | * case. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 171 | * @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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 175 | * <code>Document.normalizeDocument()</code> with the parameter " |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 176 | * namespaces" set to <code>true</code> in order to ensure that the |
| 177 | * entity name is namespace well-formed. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 178 | * @return The new <code>EntityReference</code> object. |
| 179 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 180 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 182 | * <code>Document.xmlVersion</code> attribute. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 183 | * <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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 189 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 191 | * document. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 192 | * @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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 197 | * <code>Elements</code>. |
| 198 | */ |
| 199 | public NodeList getElementsByTagName(String tagname); |
| 200 | |
| 201 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 202 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 205 | * parent; (<code>parentNode</code> is <code>null</code>). |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 206 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 215 | * appropriate parameters before this method returns. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 216 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 222 | * <dl> |
| 223 | * <dt>ATTRIBUTE_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 224 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 228 | * and the resulting nodes reassembled to form the corresponding subtree. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 229 | * 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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 231 | * when imported.</dd> |
| 232 | * <dt>DOCUMENT_FRAGMENT_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 233 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 239 | * <code>DocumentFragment</code>.</dd> |
| 240 | * <dt>DOCUMENT_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 241 | * <dd><code>Document</code> |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 242 | * nodes cannot be imported.</dd> |
| 243 | * <dt>DOCUMENT_TYPE_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 244 | * <dd><code>DocumentType</code> |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 245 | * nodes cannot be imported.</dd> |
| 246 | * <dt>ELEMENT_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 247 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 254 | * corresponding subtree.</dd> |
| 255 | * <dt>ENTITY_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 256 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 264 | * the resulting nodes reassembled to form the corresponding subtree.</dd> |
| 265 | * <dt> |
| 266 | * ENTITY_REFERENCE_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 267 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 271 | * definition for this entity name, its value is assigned.</dd> |
| 272 | * <dt>NOTATION_NODE</dt> |
| 273 | * <dd> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 274 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 278 | * <code>publicId</code> and <code>systemId</code> attributes are copied. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 279 | * Note that the <code>deep</code> parameter has no effect on this type |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 280 | * of nodes since they cannot have any children.</dd> |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 281 | * <dt> |
| 282 | * PROCESSING_INSTRUCTION_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 283 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 286 | * on this type of nodes since they cannot have any children.</dd> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 287 | * <dt>TEXT_NODE, |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 288 | * CDATA_SECTION_NODE, COMMENT_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 289 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 293 | * nodes since they cannot have any children.</dd> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 294 | * </dl> |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 295 | * @param importedNode The node to import. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 296 | * @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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 300 | * <code>EntityReference</code> nodes. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 301 | * @return The imported node that belongs to this <code>Document</code>. |
| 302 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 303 | * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 304 | * supported. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 305 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 309 | * into an XML 1.0 document, for instance. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 310 | * @since DOM Level 2 |
| 311 | */ |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 312 | public Node importNode(Node importedNode, |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 313 | boolean deep) |
| 314 | throws DOMException; |
| 315 | |
| 316 | /** |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 317 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 319 | * , applications must use the value <code>null</code> as the |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 320 | * namespaceURI parameter for methods if they wish to have no namespace. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 321 | * @param namespaceURI The namespace URI of the element to create. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 322 | * @param qualifiedName The qualified name of the element type to |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 323 | * instantiate. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 324 | * @return A new <code>Element</code> object with the following |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 325 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 343 | * <td valign='top' rowspan='1' colspan='1'>prefix, extracted |
| 344 | * from <code>qualifiedName</code>, or <code>null</code> if there is |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 345 | * no prefix</td> |
| 346 | * </tr> |
| 347 | * <tr> |
| 348 | * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 349 | * <td valign='top' rowspan='1' colspan='1'>local name, extracted from |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 350 | * <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 Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 358 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 359 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 362 | * attribute. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 363 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 367 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 369 | * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 370 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 371 | * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not |
| 372 | * support the <code>"XML"</code> feature, since namespaces were |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 373 | * defined by XML. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 374 | * @since DOM Level 2 |
| 375 | */ |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 376 | public Element createElementNS(String namespaceURI, |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 377 | String qualifiedName) |
| 378 | throws DOMException; |
| 379 | |
| 380 | /** |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 381 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 383 | * , applications must use the value <code>null</code> as the |
| 384 | * <code>namespaceURI</code> parameter for methods if they wish to have |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 385 | * no namespace. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 386 | * @param namespaceURI The namespace URI of the attribute to create. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 387 | * @param qualifiedName The qualified name of the attribute to |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 388 | * instantiate. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 389 | * @return A new <code>Attr</code> object with the following attributes: |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 390 | * <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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 408 | * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from |
| 409 | * <code>qualifiedName</code>, or <code>null</code> if there is no |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 410 | * prefix</td> |
| 411 | * </tr> |
| 412 | * <tr> |
| 413 | * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 414 | * <td valign='top' rowspan='1' colspan='1'>local name, extracted from |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 415 | * <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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 424 | * <td valign='top' rowspan='1' colspan='1'>the empty |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 425 | * string</td> |
| 426 | * </tr> |
| 427 | * </table> |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 428 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 429 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 432 | * attribute. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 433 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 437 | * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 438 | * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 439 | * <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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 440 | * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not |
| 441 | * support the <code>"XML"</code> feature, since namespaces were |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 442 | * defined by XML. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 443 | * @since DOM Level 2 |
| 444 | */ |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 445 | public Attr createAttributeNS(String namespaceURI, |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 446 | String qualifiedName) |
| 447 | throws DOMException; |
| 448 | |
| 449 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 450 | * Returns a <code>NodeList</code> of all the <code>Elements</code> with a |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 451 | * given local name and namespace URI in document order. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 452 | * @param namespaceURI The namespace URI of the elements to match on. The |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 453 | * special value <code>"*"</code> matches all namespaces. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 454 | * @param localName The local name of the elements to match on. The |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 455 | * special value "*" matches all local names. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 456 | * @return A new <code>NodeList</code> object containing all the matched |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 457 | * <code>Elements</code>. |
| 458 | * @since DOM Level 2 |
| 459 | */ |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 460 | public NodeList getElementsByTagNameNS(String namespaceURI, |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 461 | String localName); |
| 462 | |
| 463 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 464 | * Returns the <code>Element</code> that has an ID attribute with the |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 465 | * given value. If no such element exists, this returns <code>null</code> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 466 | * . 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 471 | * ID unless so defined. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 472 | * @param elementId The unique <code>id</code> value for an element. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 473 | * @return The matching element or <code>null</code> if there is none. |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 474 | * @since DOM Level 2 |
| 475 | */ |
| 476 | public Element getElementById(String elementId); |
| 477 | |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 478 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 479 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 481 | * as when the <code>Document</code> was created in memory. |
| 482 | * @since DOM Level 3 |
| 483 | */ |
| 484 | public String getInputEncoding(); |
| 485 | |
| 486 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 487 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 489 | * <code>Document</code> was created in memory. |
| 490 | * @since DOM Level 3 |
| 491 | */ |
| 492 | public String getXmlEncoding(); |
| 493 | |
| 494 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 495 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 496 | * unspecified. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 497 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 502 | * @since DOM Level 3 |
| 503 | */ |
| 504 | public boolean getXmlStandalone(); |
| 505 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 506 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 507 | * unspecified. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 508 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 513 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 514 | * NOT_SUPPORTED_ERR: Raised if this document does not support the |
| 515 | * "XML" feature. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 516 | * @since DOM Level 3 |
| 517 | */ |
| 518 | public void setXmlStandalone(boolean xmlStandalone) |
| 519 | throws DOMException; |
| 520 | |
| 521 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 522 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 539 | * the "XML" feature defined in this specification. <code>Document</code> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 540 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 543 | * @since DOM Level 3 |
| 544 | */ |
| 545 | public String getXmlVersion(); |
| 546 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 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 |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 564 | * the "XML" feature defined in this specification. <code>Document</code> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 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>. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 568 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 569 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 572 | * @since DOM Level 3 |
| 573 | */ |
| 574 | public void setXmlVersion(String xmlVersion) |
| 575 | throws DOMException; |
| 576 | |
| 577 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 578 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 584 | * <code>true</code> by default. |
| 585 | * @since DOM Level 3 |
| 586 | */ |
| 587 | public boolean getStrictErrorChecking(); |
| 588 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 589 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 595 | * <code>true</code> by default. |
| 596 | * @since DOM Level 3 |
| 597 | */ |
| 598 | public void setStrictErrorChecking(boolean strictErrorChecking); |
| 599 | |
| 600 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 601 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 605 | * <code>null</code> value returned when using <code>Node.baseURI</code> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 606 | * . |
| 607 | * <br> Beware that when the <code>Document</code> supports the feature |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 608 | * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 609 | * , the href attribute of the HTML BASE element takes precedence over |
| 610 | * this attribute when computing <code>Node.baseURI</code>. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 611 | * @since DOM Level 3 |
| 612 | */ |
| 613 | public String getDocumentURI(); |
| 614 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 615 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 619 | * <code>null</code> value returned when using <code>Node.baseURI</code> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 620 | * . |
| 621 | * <br> Beware that when the <code>Document</code> supports the feature |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 622 | * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 623 | * , the href attribute of the HTML BASE element takes precedence over |
| 624 | * this attribute when computing <code>Node.baseURI</code>. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 625 | * @since DOM Level 3 |
| 626 | */ |
| 627 | public void setDocumentURI(String documentURI); |
| 628 | |
| 629 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 630 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 643 | * <dl> |
| 644 | * <dt>ATTRIBUTE_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 645 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 649 | * <code>Attr</code> are recursively adopted.</dd> |
| 650 | * <dt>DOCUMENT_FRAGMENT_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 651 | * <dd>The |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 652 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 660 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 663 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 668 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 673 | * is assigned.</dd> |
| 674 | * <dt>NOTATION_NODE</dt> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 675 | * <dd><code>Notation</code> nodes cannot be |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 676 | * adopted.</dd> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 677 | * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 678 | * COMMENT_NODE</dt> |
| 679 | * <dd>These nodes can all be adopted. No specifics.</dd> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 680 | * </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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 687 | * @param source The node to move into this document. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 688 | * @return The adopted node, or <code>null</code> if this operation |
| 689 | * fails, such as when the source node comes from a different |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 690 | * implementation. |
| 691 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 692 | * NOT_SUPPORTED_ERR: Raised if the source node is of type |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 693 | * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 694 | * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 695 | * readonly. |
| 696 | * @since DOM Level 3 |
| 697 | */ |
| 698 | public Node adoptNode(Node source) |
| 699 | throws DOMException; |
| 700 | |
| 701 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 702 | * The configuration used when <code>Document.normalizeDocument()</code> |
| 703 | * is invoked. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 704 | * @since DOM Level 3 |
| 705 | */ |
| 706 | public DOMConfiguration getDomConfig(); |
| 707 | |
| 708 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 709 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 725 | * myDocument.normalizeDocument();</pre> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 726 | * |
| 727 | * <br>Mutation events, when supported, are generated to reflect the |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 728 | * changes occurring on the document. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 729 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 734 | * <code>DOMErrorHandler</code> object associated with the "error-handler |
| 735 | * " parameter. Note this method might also report fatal errors ( |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 736 | * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation |
| 737 | * cannot recover from an error. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 738 | * @since DOM Level 3 |
| 739 | */ |
| 740 | public void normalizeDocument(); |
| 741 | |
| 742 | /** |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 743 | * Rename an existing node of type <code>ELEMENT_NODE</code> or |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 744 | * <code>ATTRIBUTE_NODE</code>. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 745 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 747 | * replaces the existing node with the new node as described below. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 748 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 757 | * attached to the new node. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 758 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 763 | * guarantee these attributes are up-to-date. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 764 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 768 | * above, it is put back. |
| 769 | * <br>In addition, |
| 770 | * <ul> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 771 | * <li> a user data event <code>NODE_RENAMED</code> is fired, |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 772 | * </li> |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 773 | * <li> |
| 774 | * when the implementation supports the feature "MutationNameEvents", |
| 775 | * each mutation operation involved in this method fires the appropriate |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 776 | * event, and in the end the event { |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 777 | * <code>http://www.w3.org/2001/xml-events</code>, |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 778 | * <code>DOMElementNameChanged</code>} or { |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 779 | * <code>http://www.w3.org/2001/xml-events</code>, |
| 780 | * <code>DOMAttributeNameChanged</code>} is fired. |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 781 | * </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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 786 | * @return The renamed node. This is either the specified node or the new |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 787 | * node that was created to replace the specified node. |
| 788 | * @exception DOMException |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 789 | * 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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 792 | * document element. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 793 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 795 | * <code>Document.xmlVersion</code> attribute. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 796 | * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 797 | * from a different document than this document. |
Elliott Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 798 | * <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 Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 802 | * 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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 804 | * . Also raised, when the node being renamed is an attribute, if the |
| 805 | * <code>qualifiedName</code>, or its prefix, is "xmlns" and the |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 806 | * <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 Hughes | f33eae7 | 2010-05-13 12:36:25 -0700 | [diff] [blame^] | 809 | public Node renameNode(Node n, |
| 810 | String namespaceURI, |
Jesse Wilson | 320c989 | 2010-01-26 15:22:44 -0800 | [diff] [blame] | 811 | String qualifiedName) |
| 812 | throws DOMException; |
| 813 | |
The Android Open Source Project | adc854b | 2009-03-03 19:28:47 -0800 | [diff] [blame] | 814 | } |