1adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project/* 2320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Copyright (c) 2004 World Wide Web Consortium, 3320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 4320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * (Massachusetts Institute of Technology, European Research Consortium for 5320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Informatics and Mathematics, Keio University). All Rights Reserved. This 6320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * work is distributed under the W3C(r) Software License [1] in the hope that 7320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 10320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 12adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 13adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpackage org.w3c.dom; 14adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 15adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project/** 16f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The <code>Document</code> interface represents the entire HTML or XML 17f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document. Conceptually, it is the root of the document tree, and provides 18adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * the primary access to the document's data. 19f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>Since elements, text nodes, comments, processing instructions, etc. 20f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * cannot exist outside the context of a <code>Document</code>, the 21f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document</code> interface also contains the factory methods needed 22f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * to create these objects. The <code>Node</code> objects created have a 23f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>ownerDocument</code> attribute which associates them with the 24adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>Document</code> within whose context they were created. 25320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <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>. 26adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 27adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpublic interface Document extends Node { 28adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 29f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The Document Type Declaration (see <code>DocumentType</code>) 30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * associated with this document. For XML documents without a document 31f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * type declaration this returns <code>null</code>. For HTML documents, 32f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * a <code>DocumentType</code> object may be returned, independently of 33f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the presence or absence of document type declaration in the HTML 34320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * document. 35f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>This provides direct access to the <code>DocumentType</code> node, 36f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * child node of this <code>Document</code>. This node can be set at 37f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document creation time and later changed through the use of child 38f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * nodes manipulation methods, such as <code>Node.insertBefore</code>, 39f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * or <code>Node.replaceChild</code>. Note, however, that while some 40f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementations may instantiate different types of 41f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document</code> objects supporting additional features than the 42320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] 43f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , based on the <code>DocumentType</code> specified at creation time, 44f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * changing it afterwards is very unlikely to result in a change of the 45320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * features supported. 46320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @version DOM Level 3 47adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 48adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public DocumentType getDoctype(); 49adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 50adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 51f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The <code>DOMImplementation</code> object that handles this document. A 52adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * DOM application may use objects from multiple implementations. 53adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 54adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public DOMImplementation getImplementation(); 55adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 56adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 57f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * This is a convenience attribute that allows direct access to the child 58320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * node that is the document element of the document. 59adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 60adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Element getDocumentElement(); 61adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 62adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 63f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Creates an element of the type specified. Note that the instance 64f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * returned implements the <code>Element</code> interface, so attributes 65adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * can be specified directly on the returned object. 66f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>In addition, if there are known attributes with default values, 67f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> nodes representing them are automatically created 68adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * and attached to the element. 69f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>To create an element with a qualified name and namespace URI, use 70adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * the <code>createElementNS</code> method. 71f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param tagName The name of the element type to instantiate. For XML, 72f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this is case-sensitive, otherwise it depends on the 73f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * case-sensitivity of the markup language in use. In that case, the 74f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * name is mapped to the canonical form of that markup by the DOM 75320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * implementation. 76f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return A new <code>Element</code> object with the 77f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>nodeName</code> attribute set to <code>tagName</code>, and 78f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>localName</code>, <code>prefix</code>, and 79adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>namespaceURI</code> set to <code>null</code>. 80adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 81f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 82f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * name according to the XML version in use specified in the 83320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.xmlVersion</code> attribute. 84adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 85adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Element createElement(String tagName) 86adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 87adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 88adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 89320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Creates an empty <code>DocumentFragment</code> object. 90adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return A new <code>DocumentFragment</code>. 91adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 92adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public DocumentFragment createDocumentFragment(); 93adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 94adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 95adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * Creates a <code>Text</code> node given the specified string. 96adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param data The data for the node. 97adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The new <code>Text</code> object. 98adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 99adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Text createTextNode(String data); 100adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 101adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 102adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * Creates a <code>Comment</code> node given the specified string. 103adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param data The data for the node. 104adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The new <code>Comment</code> object. 105adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 106adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Comment createComment(String data); 107adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 108adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 109f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Creates a <code>CDATASection</code> node whose value is the specified 110adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * string. 111adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param data The data for the <code>CDATASection</code> contents. 112adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The new <code>CDATASection</code> object. 113adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 114adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * NOT_SUPPORTED_ERR: Raised if this document is an HTML document. 115adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 116adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public CDATASection createCDATASection(String data) 117adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 118adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 119adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 120f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Creates a <code>ProcessingInstruction</code> node given the specified 121adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * name and data strings. 122f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param target The target part of the processing instruction.Unlike 123f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.createElementNS</code> or 124f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.createAttributeNS</code>, no namespace well-formed 125f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * checking is done on the target name. Applications should invoke 126320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.normalizeDocument()</code> with the parameter " 127f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * namespaces" set to <code>true</code> in order to ensure that the 128f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * target name is namespace well-formed. 129adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param data The data for the node. 130adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The new <code>ProcessingInstruction</code> object. 131adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 132f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified target is not an XML 133f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * name according to the XML version in use specified in the 134320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.xmlVersion</code> attribute. 135adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document. 136adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 137f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public ProcessingInstruction createProcessingInstruction(String target, 138adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project String data) 139adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 140adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 141adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 142f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Creates an <code>Attr</code> of the given name. Note that the 143f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> instance can then be set on an <code>Element</code> 144f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * using the <code>setAttributeNode</code> method. 145f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>To create an attribute with a qualified name and namespace URI, use 146adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * the <code>createAttributeNS</code> method. 147adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param name The name of the attribute. 148f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return A new <code>Attr</code> object with the <code>nodeName</code> 149f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute set to <code>name</code>, and <code>localName</code>, 150f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>prefix</code>, and <code>namespaceURI</code> set to 151adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>null</code>. The value of the attribute is the empty string. 152adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 153f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 154f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * name according to the XML version in use specified in the 155320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.xmlVersion</code> attribute. 156adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 157adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Attr createAttribute(String name) 158adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 159adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 160adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 161f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Creates an <code>EntityReference</code> object. In addition, if the 162f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * referenced entity is known, the child list of the 163f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>EntityReference</code> node is made the same as that of the 164320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * corresponding <code>Entity</code> node. 165f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> If any descendant of the <code>Entity</code> node has 166f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * an unbound namespace prefix, the corresponding descendant of the 167f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * created <code>EntityReference</code> node is also unbound; (its 168f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and 169f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 3 do not support any mechanism to resolve namespace prefixes in this 170320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * case. 171f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param name The name of the entity to reference.Unlike 172f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.createElementNS</code> or 173f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.createAttributeNS</code>, no namespace well-formed 174f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * checking is done on the entity name. Applications should invoke 175320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.normalizeDocument()</code> with the parameter " 176f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * namespaces" set to <code>true</code> in order to ensure that the 177f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * entity name is namespace well-formed. 178adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The new <code>EntityReference</code> object. 179adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 180f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML 181f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * name according to the XML version in use specified in the 182320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.xmlVersion</code> attribute. 183adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document. 184adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 185adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public EntityReference createEntityReference(String name) 186adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 187adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 188adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 189f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Returns a <code>NodeList</code> of all the <code>Elements</code> in 190f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document order with a given tag name and are contained in the 191320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * document. 192f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param tagname The name of the tag to match on. The special value "*" 193f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * matches all tags. For XML, the <code>tagname</code> parameter is 194f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * case-sensitive, otherwise it depends on the case-sensitivity of the 195f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * markup language in use. 196f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return A new <code>NodeList</code> object containing all the matched 197adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>Elements</code>. 198adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 199adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public NodeList getElementsByTagName(String tagname); 200adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 201adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 202f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Imports a node from another document to this document, without altering 203f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * or removing the source node from the original document; this method 204f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * creates a new copy of the source node. The returned node has no 205320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * parent; (<code>parentNode</code> is <code>null</code>). 206f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>For all nodes, importing a node creates a node object owned by the 207f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * importing document, with attribute values identical to the source 208f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * node's <code>nodeName</code> and <code>nodeType</code>, plus the 209f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attributes related to namespaces (<code>prefix</code>, 210f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>localName</code>, and <code>namespaceURI</code>). As in the 211f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>cloneNode</code> operation, the source node is not altered. 212f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * User data associated to the imported node is not carried over. 213f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * However, if any <code>UserDataHandlers</code> has been specified 214f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * along with the associated data these handlers will be called with the 215320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * appropriate parameters before this method returns. 216f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>Additional information is copied as appropriate to the 217f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>nodeType</code>, attempting to mirror the behavior expected if 218f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * a fragment of XML or HTML source was copied from one document to 219f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * another, recognizing that the two documents may have different DTDs 220f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * in the XML case. The following list describes the specifics for each 221f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * type of node. 222adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dl> 223adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>ATTRIBUTE_NODE</dt> 224f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>The <code>ownerElement</code> attribute 225f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is set to <code>null</code> and the <code>specified</code> flag is 226f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * set to <code>true</code> on the generated <code>Attr</code>. The 227f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * descendants of the source <code>Attr</code> are recursively imported 228adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * and the resulting nodes reassembled to form the corresponding subtree. 229f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Note that the <code>deep</code> parameter has no effect on 230f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> nodes; they always carry their children with them 231adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * when imported.</dd> 232adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>DOCUMENT_FRAGMENT_NODE</dt> 233f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>If the <code>deep</code> option 234f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * was set to <code>true</code>, the descendants of the source 235f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DocumentFragment</code> are recursively imported and the 236f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * resulting nodes reassembled under the imported 237f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DocumentFragment</code> to form the corresponding subtree. 238f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Otherwise, this simply generates an empty 239adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>DocumentFragment</code>.</dd> 240adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>DOCUMENT_NODE</dt> 241f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><code>Document</code> 242adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * nodes cannot be imported.</dd> 243adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>DOCUMENT_TYPE_NODE</dt> 244f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><code>DocumentType</code> 245adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * nodes cannot be imported.</dd> 246adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>ELEMENT_NODE</dt> 247f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated 248f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> nodes are attached to the generated 249f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Element</code>. Default attributes are <em>not</em> copied, though if the document being imported into defines default 250f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attributes for this element name, those are assigned. If the 251f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>importNode</code> <code>deep</code> parameter was set to 252f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>true</code>, the descendants of the source element are 253f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * recursively imported and the resulting nodes reassembled to form the 254adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * corresponding subtree.</dd> 255adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>ENTITY_NODE</dt> 256f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><code>Entity</code> nodes can be 257f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * imported, however in the current release of the DOM the 258f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DocumentType</code> is readonly. Ability to add these imported 259f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * nodes to a <code>DocumentType</code> will be considered for addition 260f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * to a future release of the DOM.On import, the <code>publicId</code>, 261f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>systemId</code>, and <code>notationName</code> attributes are 262f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * copied. If a <code>deep</code> import is requested, the descendants 263f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * of the the source <code>Entity</code> are recursively imported and 264adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * the resulting nodes reassembled to form the corresponding subtree.</dd> 265adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt> 266adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * ENTITY_REFERENCE_NODE</dt> 267f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>Only the <code>EntityReference</code> itself is 268f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * copied, even if a <code>deep</code> import is requested, since the 269f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * source and destination documents might have defined the entity 270f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * differently. If the document being imported into provides a 271adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * definition for this entity name, its value is assigned.</dd> 272adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt>NOTATION_NODE</dt> 273adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dd> 274f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Notation</code> nodes can be imported, however in the current 275f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * release of the DOM the <code>DocumentType</code> is readonly. Ability 276f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * to add these imported nodes to a <code>DocumentType</code> will be 277f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * considered for addition to a future release of the DOM.On import, the 278adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>publicId</code> and <code>systemId</code> attributes are copied. 279f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Note that the <code>deep</code> parameter has no effect on this type 280320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * of nodes since they cannot have any children.</dd> 281adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <dt> 282adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * PROCESSING_INSTRUCTION_NODE</dt> 283f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>The imported node copies its 284f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>target</code> and <code>data</code> values from those of the 285f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * source node.Note that the <code>deep</code> parameter has no effect 286320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * on this type of nodes since they cannot have any children.</dd> 287f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dt>TEXT_NODE, 288320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * CDATA_SECTION_NODE, COMMENT_NODE</dt> 289f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>These three types of nodes inheriting 290f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * from <code>CharacterData</code> copy their <code>data</code> and 291f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>length</code> attributes from those of the source node.Note 292f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * that the <code>deep</code> parameter has no effect on these types of 293320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * nodes since they cannot have any children.</dd> 294f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * </dl> 295adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param importedNode The node to import. 296f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param deep If <code>true</code>, recursively import the subtree under 297f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the specified node; if <code>false</code>, import only the node 298f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * itself, as explained above. This has no effect on nodes that cannot 299f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * have any children, and on <code>Attr</code>, and 300320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>EntityReference</code> nodes. 301adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return The imported node that belongs to this <code>Document</code>. 302adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 303f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not 304adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * supported. 305f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not 306f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * an XML name according to the XML version in use specified in the 307f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.xmlVersion</code> attribute. This may happen when 308f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element 309320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * into an XML 1.0 document, for instance. 310adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 311adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 312f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public Node importNode(Node importedNode, 313adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project boolean deep) 314adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 315adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 316adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 317320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Creates an element of the given qualified name and namespace URI. 318320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] 319f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , applications must use the value <code>null</code> as the 320320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * namespaceURI parameter for methods if they wish to have no namespace. 321adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param namespaceURI The namespace URI of the element to create. 322f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param qualifiedName The qualified name of the element type to 323adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * instantiate. 324f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return A new <code>Element</code> object with the following 325320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attributes: 326320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <table border='1' cellpadding='3'> 327320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 328320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Attribute</th> 329320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Value</th> 330320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 331320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 332320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td> 333320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 334320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>qualifiedName</code></td> 335320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 336320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 337320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td> 338320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 339320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>namespaceURI</code></td> 340320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 341320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 342320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td> 343f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>prefix, extracted 344f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * from <code>qualifiedName</code>, or <code>null</code> if there is 345320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * no prefix</td> 346320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 347320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 348320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> 349f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 350320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>qualifiedName</code></td> 351320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 352320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 353320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td> 354320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 355320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>qualifiedName</code></td> 356320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 357320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </table> 358adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 359f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified 360f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>qualifiedName</code> is not an XML name according to the XML 361f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * version in use specified in the <code>Document.xmlVersion</code> 362320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attribute. 363f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 364f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * malformed qualified name, if the <code>qualifiedName</code> has a 365f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * prefix and the <code>namespaceURI</code> is <code>null</code>, or 366f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * if the <code>qualifiedName</code> has a prefix that is "xml" and 367320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> 368320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] 369f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and 370320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 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". 371f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 372f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * support the <code>"XML"</code> feature, since namespaces were 373320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * defined by XML. 374adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 375adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 376f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public Element createElementNS(String namespaceURI, 377adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project String qualifiedName) 378adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 379adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 380adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 381320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Creates an attribute of the given qualified name and namespace URI. 382320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] 383f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , applications must use the value <code>null</code> as the 384f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>namespaceURI</code> parameter for methods if they wish to have 385320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * no namespace. 386adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param namespaceURI The namespace URI of the attribute to create. 387f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param qualifiedName The qualified name of the attribute to 388320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * instantiate. 389adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @return A new <code>Attr</code> object with the following attributes: 390320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <table border='1' cellpadding='3'> 391320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 392320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th> 393320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Attribute</th> 394320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Value</th> 395320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 396320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 397320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td> 398320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td> 399320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 400320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 401320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 402320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Node.namespaceURI</code></td> 403320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td> 404320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 405320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 406320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 407320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Node.prefix</code></td> 408f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from 409f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>qualifiedName</code>, or <code>null</code> if there is no 410320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * prefix</td> 411320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 412320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 413320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td> 414f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>local name, extracted from 415320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>qualifiedName</code></td> 416320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 417320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 418320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td> 419320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 420320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>qualifiedName</code></td> 421320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 422320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 423320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td> 424f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>the empty 425320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * string</td> 426320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 427320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </table> 428adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @exception DOMException 429f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * INVALID_CHARACTER_ERR: Raised if the specified 430f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>qualifiedName</code> is not an XML name according to the XML 431f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * version in use specified in the <code>Document.xmlVersion</code> 432320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attribute. 433f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 434f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * malformed qualified name, if the <code>qualifiedName</code> has a 435f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * prefix and the <code>namespaceURI</code> is <code>null</code>, if 436f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>qualifiedName</code> has a prefix that is "xml" and the 437320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> 438f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the 439320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <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". 440f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not 441f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * support the <code>"XML"</code> feature, since namespaces were 442320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * defined by XML. 443adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 444adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 445f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public Attr createAttributeNS(String namespaceURI, 446adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project String qualifiedName) 447adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 448adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 449adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 450f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Returns a <code>NodeList</code> of all the <code>Elements</code> with a 451320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * given local name and namespace URI in document order. 452f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param namespaceURI The namespace URI of the elements to match on. The 453320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * special value <code>"*"</code> matches all namespaces. 454f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @param localName The local name of the elements to match on. The 455adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * special value "*" matches all local names. 456f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return A new <code>NodeList</code> object containing all the matched 457adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>Elements</code>. 458adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 459adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 460f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public NodeList getElementsByTagNameNS(String namespaceURI, 461adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project String localName); 462adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 463adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 464f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Returns the <code>Element</code> that has an ID attribute with the 465320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * given value. If no such element exists, this returns <code>null</code> 466f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . If more than one element has an ID attribute with that value, what 467f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is returned is undefined. 468f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> The DOM implementation is expected to use the attribute 469f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr.isId</code> to determine if an attribute is of type ID. 470f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type 471320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * ID unless so defined. 472adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @param elementId The unique <code>id</code> value for an element. 473320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @return The matching element or <code>null</code> if there is none. 474adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 475adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 476adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Element getElementById(String elementId); 477adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 478320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 479f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * An attribute specifying the encoding used for this document at the time 480f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * of the parsing. This is <code>null</code> when it is not known, such 481320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * as when the <code>Document</code> was created in memory. 482320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 483320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 484320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public String getInputEncoding(); 485320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 486320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 487f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 488f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * unspecified or when it is not known, such as when the 489320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document</code> was created in memory. 490320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 491320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 492320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public String getXmlEncoding(); 493320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 494320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 495f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 496320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * unspecified. 497f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> No verification is done on the value when setting 498f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this attribute. Applications should use 499f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code> with the "validate" 500f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity 501f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. 502320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 503320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 504320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public boolean getXmlStandalone(); 505320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 506f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 507320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * unspecified. 508f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> No verification is done on the value when setting 509f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this attribute. Applications should use 510f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code> with the "validate" 511f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity 512f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. 513320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 514f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised if this document does not support the 515f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * "XML" feature. 516320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 517320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 518320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public void setXmlStandalone(boolean xmlStandalone) 519320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson throws DOMException; 520320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 521320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 522f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 523f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this document supports the "XML" feature, the value is 524f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>"1.0"</code>. If this document does not support the "XML" 525f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * feature, the value is always <code>null</code>. Changing this 526f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute will affect methods that check for invalid characters in 527f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * XML names. Application should invoke 528f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code> in order to check for 529f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * invalid characters in the <code>Node</code>s that are already part of 530f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this <code>Document</code>. 531f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> DOM applications may use the 532f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementation.hasFeature(feature, version)</code> method 533f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * with parameter values "XMLVersion" and "1.0" (respectively) to 534f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM 535f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * applications may use the same method with parameter values 536f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * "XMLVersion" and "1.1" (respectively) to determine if an 537f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both 538f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * cases, in order to support XML, an implementation must also support 539320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the "XML" feature defined in this specification. <code>Document</code> 540f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * objects supporting a version of the "XMLVersion" feature must not 541f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version 542f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * number when using <code>Document.xmlVersion</code>. 543320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 544320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 545320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public String getXmlVersion(); 546320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 547f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 548f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this document supports the "XML" feature, the value is 549f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>"1.0"</code>. If this document does not support the "XML" 550f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * feature, the value is always <code>null</code>. Changing this 551f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute will affect methods that check for invalid characters in 552f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * XML names. Application should invoke 553f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code> in order to check for 554f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * invalid characters in the <code>Node</code>s that are already part of 555f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this <code>Document</code>. 556f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> DOM applications may use the 557f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementation.hasFeature(feature, version)</code> method 558f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * with parameter values "XMLVersion" and "1.0" (respectively) to 559f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM 560f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * applications may use the same method with parameter values 561f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * "XMLVersion" and "1.1" (respectively) to determine if an 562f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both 563f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * cases, in order to support XML, an implementation must also support 564320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the "XML" feature defined in this specification. <code>Document</code> 565f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * objects supporting a version of the "XMLVersion" feature must not 566f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version 567f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * number when using <code>Document.xmlVersion</code>. 568320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 569f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised if the version is set to a value that is 570f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * not supported by this <code>Document</code> or if this document 571f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * does not support the "XML" feature. 572320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 573320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 574320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public void setXmlVersion(String xmlVersion) 575320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson throws DOMException; 576320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 577320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 578f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * An attribute specifying whether error checking is enforced or not. When 579f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * set to <code>false</code>, the implementation is free to not test 580f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * every possible error case normally defined on DOM operations, and not 581f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * raise any <code>DOMException</code> on DOM operations or report 582f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * errors while using <code>Document.normalizeDocument()</code>. In case 583f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * of error, the behavior is undefined. This attribute is 584320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>true</code> by default. 585320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 586320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 587320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public boolean getStrictErrorChecking(); 588320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 589f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * An attribute specifying whether error checking is enforced or not. When 590f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * set to <code>false</code>, the implementation is free to not test 591f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * every possible error case normally defined on DOM operations, and not 592f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * raise any <code>DOMException</code> on DOM operations or report 593f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * errors while using <code>Document.normalizeDocument()</code>. In case 594f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * of error, the behavior is undefined. This attribute is 595320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>true</code> by default. 596320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 597320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 598320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public void setStrictErrorChecking(boolean strictErrorChecking); 599320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 600320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 601f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The location of the document or <code>null</code> if undefined or if 602f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>Document</code> was created using 603f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementation.createDocument</code>. No lexical checking is 604f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * performed when setting this attribute; this could result in a 605320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>null</code> value returned when using <code>Node.baseURI</code> 606f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 607f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> Beware that when the <code>Document</code> supports the feature 608320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] 609f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , the href attribute of the HTML BASE element takes precedence over 610f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this attribute when computing <code>Node.baseURI</code>. 611320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 612320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 613320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public String getDocumentURI(); 614320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 615f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The location of the document or <code>null</code> if undefined or if 616f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>Document</code> was created using 617f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMImplementation.createDocument</code>. No lexical checking is 618f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * performed when setting this attribute; this could result in a 619320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>null</code> value returned when using <code>Node.baseURI</code> 620f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 621f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> Beware that when the <code>Document</code> supports the feature 622320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>] 623f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , the href attribute of the HTML BASE element takes precedence over 624f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this attribute when computing <code>Node.baseURI</code>. 625320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 626320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 627320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public void setDocumentURI(String documentURI); 628320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 629320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 630f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Attempts to adopt a node from another document to this document. If 631f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * supported, it changes the <code>ownerDocument</code> of the source 632f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * node, its children, as well as the attached attribute nodes if there 633f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * are any. If the source node has a parent it is first removed from the 634f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * child list of its parent. This effectively allows moving a subtree 635f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * from one document to another (unlike <code>importNode()</code> which 636f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * create a copy of the source node instead of moving it). When it 637f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * fails, applications should use <code>Document.importNode()</code> 638f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * instead. Note that if the adopted node is already part of this 639f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document (i.e. the source and target document are the same), this 640f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * method still has the effect of removing the source node from the 641f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * child list of its parent, if any. The following list describes the 642f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * specifics for each type of node. 643320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dl> 644320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>ATTRIBUTE_NODE</dt> 645f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>The 646f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>ownerElement</code> attribute is set to <code>null</code> and 647f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>specified</code> flag is set to <code>true</code> on the 648f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * adopted <code>Attr</code>. The descendants of the source 649320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Attr</code> are recursively adopted.</dd> 650320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>DOCUMENT_FRAGMENT_NODE</dt> 651f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>The 652320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * descendants of the source node are recursively adopted.</dd> 653320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>DOCUMENT_NODE</dt> 654320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dd> 655320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document</code> nodes cannot be adopted.</dd> 656320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>DOCUMENT_TYPE_NODE</dt> 657320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dd> 658320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>DocumentType</code> nodes cannot be adopted.</dd> 659320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>ELEMENT_NODE</dt> 660f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes 661f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * are discarded, though if the document being adopted into defines 662f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * default attributes for this element name, those are assigned. The 663320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * descendants of the source element are recursively adopted.</dd> 664320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>ENTITY_NODE</dt> 665320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dd> 666320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Entity</code> nodes cannot be adopted.</dd> 667320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>ENTITY_REFERENCE_NODE</dt> 668f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd>Only 669f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>EntityReference</code> node itself is adopted, the 670f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * descendants are discarded, since the source and destination documents 671f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * might have defined the entity differently. If the document being 672f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * imported into provides a definition for this entity name, its value 673320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * is assigned.</dd> 674320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dt>NOTATION_NODE</dt> 675f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dd><code>Notation</code> nodes cannot be 676320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * adopted.</dd> 677f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, 678320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * COMMENT_NODE</dt> 679320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <dd>These nodes can all be adopted. No specifics.</dd> 680f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * </dl> 681f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p ><b>Note:</b> Since it does not create new nodes unlike the 682f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.importNode()</code> method, this method does not raise 683f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * an <code>INVALID_CHARACTER_ERR</code> exception, and applications 684f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * should use the <code>Document.normalizeDocument()</code> method to 685f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * check if an imported name is not an XML name according to the XML 686f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * version in use. 687320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @param source The node to move into this document. 688f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return The adopted node, or <code>null</code> if this operation 689f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * fails, such as when the source node comes from a different 690320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * implementation. 691320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 692f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised if the source node is of type 693320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>. 694f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is 695320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * readonly. 696320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 697320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 698320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public Node adoptNode(Node source) 699320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson throws DOMException; 700320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 701320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 702f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The configuration used when <code>Document.normalizeDocument()</code> 703f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is invoked. 704320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 705320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 706320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public DOMConfiguration getDomConfig(); 707320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 708320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 709f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * This method acts as if the document was going through a save and load 710f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * cycle, putting the document in a "normal" form. As a consequence, 711f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this method updates the replacement tree of 712f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>EntityReference</code> nodes and normalizes <code>Text</code> 713f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * nodes, as defined in the method <code>Node.normalize()</code>. 714f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> Otherwise, the actual result depends on the features being set on 715f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>Document.domConfig</code> object and governing what 716f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * operations actually take place. Noticeably this method could also 717f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * make the document namespace well-formed according to the algorithm 718f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * described in , check the character normalization, remove the 719f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>CDATASection</code> nodes, etc. See 720f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMConfiguration</code> for details. 721f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <pre>// Keep in the document 722f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the information defined // in the XML Information Set (Java example) 723f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * DOMConfiguration docConfig = myDocument.getDomConfig(); 724f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * docConfig.setParameter("infoset", Boolean.TRUE); 725320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * myDocument.normalizeDocument();</pre> 726f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 727f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>Mutation events, when supported, are generated to reflect the 728320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * changes occurring on the document. 729f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> If errors occur during the invocation of this method, such as an 730f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attempt to update a read-only node or a <code>Node.nodeName</code> 731f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * contains an invalid character according to the XML version in use, 732f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or 733f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the 734320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>DOMErrorHandler</code> object associated with the "error-handler 735320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * " parameter. Note this method might also report fatal errors ( 736f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation 737f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * cannot recover from an error. 738320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 739320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 740320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public void normalizeDocument(); 741320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 742320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 743f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Rename an existing node of type <code>ELEMENT_NODE</code> or 744320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>ATTRIBUTE_NODE</code>. 745f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>When possible this simply changes the name of the given node, 746f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * otherwise this creates a new node with the specified name and 747320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * replaces the existing node with the new node as described below. 748f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>If simply changing the name of the given node is not possible, the 749f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * following operations are performed: a new node is created, any 750f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * registered event listener is registered on the new node, any user 751f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * data attached to the old node is removed from that node, the old node 752f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is removed from its parent if it has one, the children are moved to 753f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the new node, if the renamed node is an <code>Element</code> its 754f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attributes are moved to the new node, the new node is inserted at the 755f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * position the old node used to have in its parent's child nodes list 756f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * if it has one, the user data that was attached to the old node is 757320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attached to the new node. 758f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>When the node being renamed is an <code>Element</code> only the 759f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * specified attributes are moved, default attributes originated from 760f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the DTD are updated according to the new element name. In addition, 761f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the implementation may update default attributes from other schemas. 762f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Applications should use <code>Document.normalizeDocument()</code> to 763320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * guarantee these attributes are up-to-date. 764f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>When the node being renamed is an <code>Attr</code> that is 765f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attached to an <code>Element</code>, the node is first removed from 766f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>Element</code> attributes map. Then, once renamed, either 767f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * by modifying the existing node or creating a new one as described 768320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * above, it is put back. 769320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <br>In addition, 770320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <ul> 771f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> a user data event <code>NODE_RENAMED</code> is fired, 772320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 773f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> 774f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * when the implementation supports the feature "MutationNameEvents", 775f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * each mutation operation involved in this method fires the appropriate 776320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * event, and in the end the event { 777f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>http://www.w3.org/2001/xml-events</code>, 778320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>DOMElementNameChanged</code>} or { 779f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>http://www.w3.org/2001/xml-events</code>, 780f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DOMAttributeNameChanged</code>} is fired. 781320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 782320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </ul> 783320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @param n The node to rename. 784320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @param namespaceURI The new namespace URI. 785320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @param qualifiedName The new qualified name. 786f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * @return The renamed node. This is either the specified node or the new 787320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * node that was created to replace the specified node. 788320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 789f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * NOT_SUPPORTED_ERR: Raised when the type of the specified node is 790f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>, 791f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * or if the implementation does not support the renaming of the 792320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * document element. 793f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an 794f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * XML name according to the XML version in use specified in the 795320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.xmlVersion</code> attribute. 796f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created 797320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * from a different document than this document. 798f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a 799f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * malformed qualified name, if the <code>qualifiedName</code> has a 800f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * prefix and the <code>namespaceURI</code> is <code>null</code>, or 801f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * if the <code>qualifiedName</code> has a prefix that is "xml" and 802320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'> 803320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>] 804f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . Also raised, when the node being renamed is an attribute, if the 805f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>qualifiedName</code>, or its prefix, is "xmlns" and the 806320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>". 807320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 808320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 809f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes public Node renameNode(Node n, 810f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes String namespaceURI, 811320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson String qualifiedName) 812320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson throws DOMException; 813320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 814adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project} 815