286N/A/*
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation. Oracle designates this
286N/A * particular file as subject to the "Classpath" exception as provided
286N/A * by Oracle in the LICENSE file that accompanied this code.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A */
286N/A
286N/A/*
286N/A * This file is available under and governed by the GNU General Public
286N/A * License version 2 only, as published by the Free Software Foundation.
286N/A * However, the following notice accompanied the original version of this
286N/A * file and, per its terms, should not be removed:
286N/A *
286N/A * Copyright (c) 2004 World Wide Web Consortium,
286N/A *
286N/A * (Massachusetts Institute of Technology, European Research Consortium for
286N/A * Informatics and Mathematics, Keio University). All Rights Reserved. This
286N/A * work is distributed under the W3C(r) Software License [1] in the hope that
286N/A * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
286N/A * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
286N/A *
286N/A * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
286N/A */
286N/A
286N/Apackage org.w3c.dom;
286N/A
286N/A/**
286N/A * The <code>Document</code> interface represents the entire HTML or XML
286N/A * document. Conceptually, it is the root of the document tree, and provides
286N/A * the primary access to the document's data.
286N/A * <p>Since elements, text nodes, comments, processing instructions, etc.
286N/A * cannot exist outside the context of a <code>Document</code>, the
286N/A * <code>Document</code> interface also contains the factory methods needed
286N/A * to create these objects. The <code>Node</code> objects created have a
286N/A * <code>ownerDocument</code> attribute which associates them with the
286N/A * <code>Document</code> within whose context they were created.
286N/A * <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>.
286N/A */
286N/Apublic interface Document extends Node {
286N/A /**
286N/A * The Document Type Declaration (see <code>DocumentType</code>)
286N/A * associated with this document. For XML documents without a document
286N/A * type declaration this returns <code>null</code>. For HTML documents,
286N/A * a <code>DocumentType</code> object may be returned, independently of
286N/A * the presence or absence of document type declaration in the HTML
286N/A * document.
286N/A * <br>This provides direct access to the <code>DocumentType</code> node,
286N/A * child node of this <code>Document</code>. This node can be set at
286N/A * document creation time and later changed through the use of child
286N/A * nodes manipulation methods, such as <code>Node.insertBefore</code>,
286N/A * or <code>Node.replaceChild</code>. Note, however, that while some
286N/A * implementations may instantiate different types of
286N/A * <code>Document</code> objects supporting additional features than the
286N/A * "Core", such as "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
286N/A * , based on the <code>DocumentType</code> specified at creation time,
286N/A * changing it afterwards is very unlikely to result in a change of the
286N/A * features supported.
286N/A *
286N/A * @since DOM Level 3
286N/A */
286N/A public DocumentType getDoctype();
286N/A
286N/A /**
286N/A * The <code>DOMImplementation</code> object that handles this document. A
286N/A * DOM application may use objects from multiple implementations.
286N/A */
286N/A public DOMImplementation getImplementation();
286N/A
286N/A /**
286N/A * This is a convenience attribute that allows direct access to the child
286N/A * node that is the document element of the document.
286N/A */
286N/A public Element getDocumentElement();
286N/A
286N/A /**
286N/A * Creates an element of the type specified. Note that the instance
286N/A * returned implements the <code>Element</code> interface, so attributes
286N/A * can be specified directly on the returned object.
286N/A * <br>In addition, if there are known attributes with default values,
286N/A * <code>Attr</code> nodes representing them are automatically created
286N/A * and attached to the element.
286N/A * <br>To create an element with a qualified name and namespace URI, use
286N/A * the <code>createElementNS</code> method.
286N/A * @param tagName The name of the element type to instantiate. For XML,
286N/A * this is case-sensitive, otherwise it depends on the
286N/A * case-sensitivity of the markup language in use. In that case, the
286N/A * name is mapped to the canonical form of that markup by the DOM
286N/A * implementation.
286N/A * @return A new <code>Element</code> object with the
286N/A * <code>nodeName</code> attribute set to <code>tagName</code>, and
286N/A * <code>localName</code>, <code>prefix</code>, and
286N/A * <code>namespaceURI</code> set to <code>null</code>.
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
286N/A * name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute.
286N/A */
286N/A public Element createElement(String tagName)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates an empty <code>DocumentFragment</code> object.
286N/A * @return A new <code>DocumentFragment</code>.
286N/A */
286N/A public DocumentFragment createDocumentFragment();
286N/A
286N/A /**
286N/A * Creates a <code>Text</code> node given the specified string.
286N/A * @param data The data for the node.
286N/A * @return The new <code>Text</code> object.
286N/A */
286N/A public Text createTextNode(String data);
286N/A
286N/A /**
286N/A * Creates a <code>Comment</code> node given the specified string.
286N/A * @param data The data for the node.
286N/A * @return The new <code>Comment</code> object.
286N/A */
286N/A public Comment createComment(String data);
286N/A
286N/A /**
286N/A * Creates a <code>CDATASection</code> node whose value is the specified
286N/A * string.
286N/A * @param data The data for the <code>CDATASection</code> contents.
286N/A * @return The new <code>CDATASection</code> object.
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
286N/A */
286N/A public CDATASection createCDATASection(String data)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates a <code>ProcessingInstruction</code> node given the specified
286N/A * name and data strings.
286N/A * @param target The target part of the processing instruction.Unlike
286N/A * <code>Document.createElementNS</code> or
286N/A * <code>Document.createAttributeNS</code>, no namespace well-formed
286N/A * checking is done on the target name. Applications should invoke
286N/A * <code>Document.normalizeDocument()</code> with the parameter "
286N/A * namespaces" set to <code>true</code> in order to ensure that the
286N/A * target name is namespace well-formed.
286N/A * @param data The data for the node.
286N/A * @return The new <code>ProcessingInstruction</code> object.
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified target is not an XML
286N/A * name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute.
286N/A * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
286N/A */
286N/A public ProcessingInstruction createProcessingInstruction(String target,
286N/A String data)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates an <code>Attr</code> of the given name. Note that the
286N/A * <code>Attr</code> instance can then be set on an <code>Element</code>
286N/A * using the <code>setAttributeNode</code> method.
286N/A * <br>To create an attribute with a qualified name and namespace URI, use
286N/A * the <code>createAttributeNS</code> method.
286N/A * @param name The name of the attribute.
286N/A * @return A new <code>Attr</code> object with the <code>nodeName</code>
286N/A * attribute set to <code>name</code>, and <code>localName</code>,
286N/A * <code>prefix</code>, and <code>namespaceURI</code> set to
286N/A * <code>null</code>. The value of the attribute is the empty string.
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
286N/A * name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute.
286N/A */
286N/A public Attr createAttribute(String name)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates an <code>EntityReference</code> object. In addition, if the
286N/A * referenced entity is known, the child list of the
286N/A * <code>EntityReference</code> node is made the same as that of the
286N/A * corresponding <code>Entity</code> node.
286N/A * <p ><b>Note:</b> If any descendant of the <code>Entity</code> node has
286N/A * an unbound namespace prefix, the corresponding descendant of the
286N/A * created <code>EntityReference</code> node is also unbound; (its
286N/A * <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and
286N/A * 3 do not support any mechanism to resolve namespace prefixes in this
286N/A * case.
286N/A * @param name The name of the entity to reference.Unlike
286N/A * <code>Document.createElementNS</code> or
286N/A * <code>Document.createAttributeNS</code>, no namespace well-formed
286N/A * checking is done on the entity name. Applications should invoke
286N/A * <code>Document.normalizeDocument()</code> with the parameter "
286N/A * namespaces" set to <code>true</code> in order to ensure that the
286N/A * entity name is namespace well-formed.
286N/A * @return The new <code>EntityReference</code> object.
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified name is not an XML
286N/A * name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute.
286N/A * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
286N/A */
286N/A public EntityReference createEntityReference(String name)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Returns a <code>NodeList</code> of all the <code>Elements</code> in
286N/A * document order with a given tag name and are contained in the
286N/A * document.
286N/A * @param tagname The name of the tag to match on. The special value "*"
286N/A * matches all tags. For XML, the <code>tagname</code> parameter is
286N/A * case-sensitive, otherwise it depends on the case-sensitivity of the
286N/A * markup language in use.
286N/A * @return A new <code>NodeList</code> object containing all the matched
286N/A * <code>Elements</code>.
286N/A */
286N/A public NodeList getElementsByTagName(String tagname);
286N/A
286N/A /**
286N/A * Imports a node from another document to this document, without altering
286N/A * or removing the source node from the original document; this method
286N/A * creates a new copy of the source node. The returned node has no
286N/A * parent; (<code>parentNode</code> is <code>null</code>).
286N/A * <br>For all nodes, importing a node creates a node object owned by the
286N/A * importing document, with attribute values identical to the source
286N/A * node's <code>nodeName</code> and <code>nodeType</code>, plus the
286N/A * attributes related to namespaces (<code>prefix</code>,
286N/A * <code>localName</code>, and <code>namespaceURI</code>). As in the
286N/A * <code>cloneNode</code> operation, the source node is not altered.
286N/A * User data associated to the imported node is not carried over.
286N/A * However, if any <code>UserDataHandlers</code> has been specified
286N/A * along with the associated data these handlers will be called with the
286N/A * appropriate parameters before this method returns.
286N/A * <br>Additional information is copied as appropriate to the
286N/A * <code>nodeType</code>, attempting to mirror the behavior expected if
286N/A * a fragment of XML or HTML source was copied from one document to
286N/A * another, recognizing that the two documents may have different DTDs
286N/A * in the XML case. The following list describes the specifics for each
286N/A * type of node.
286N/A * <dl>
286N/A * <dt>ATTRIBUTE_NODE</dt>
286N/A * <dd>The <code>ownerElement</code> attribute
286N/A * is set to <code>null</code> and the <code>specified</code> flag is
286N/A * set to <code>true</code> on the generated <code>Attr</code>. The
286N/A * descendants of the source <code>Attr</code> are recursively imported
286N/A * and the resulting nodes reassembled to form the corresponding subtree.
286N/A * Note that the <code>deep</code> parameter has no effect on
286N/A * <code>Attr</code> nodes; they always carry their children with them
286N/A * when imported.</dd>
286N/A * <dt>DOCUMENT_FRAGMENT_NODE</dt>
286N/A * <dd>If the <code>deep</code> option
286N/A * was set to <code>true</code>, the descendants of the source
286N/A * <code>DocumentFragment</code> are recursively imported and the
286N/A * resulting nodes reassembled under the imported
286N/A * <code>DocumentFragment</code> to form the corresponding subtree.
286N/A * Otherwise, this simply generates an empty
286N/A * <code>DocumentFragment</code>.</dd>
286N/A * <dt>DOCUMENT_NODE</dt>
286N/A * <dd><code>Document</code>
286N/A * nodes cannot be imported.</dd>
286N/A * <dt>DOCUMENT_TYPE_NODE</dt>
286N/A * <dd><code>DocumentType</code>
286N/A * nodes cannot be imported.</dd>
286N/A * <dt>ELEMENT_NODE</dt>
286N/A * <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated
286N/A * <code>Attr</code> nodes are attached to the generated
286N/A * <code>Element</code>. Default attributes are <em>not</em> copied, though if the document being imported into defines default
286N/A * attributes for this element name, those are assigned. If the
286N/A * <code>importNode</code> <code>deep</code> parameter was set to
286N/A * <code>true</code>, the descendants of the source element are
286N/A * recursively imported and the resulting nodes reassembled to form the
286N/A * corresponding subtree.</dd>
286N/A * <dt>ENTITY_NODE</dt>
286N/A * <dd><code>Entity</code> nodes can be
286N/A * imported, however in the current release of the DOM the
286N/A * <code>DocumentType</code> is readonly. Ability to add these imported
286N/A * nodes to a <code>DocumentType</code> will be considered for addition
286N/A * to a future release of the DOM.On import, the <code>publicId</code>,
286N/A * <code>systemId</code>, and <code>notationName</code> attributes are
286N/A * copied. If a <code>deep</code> import is requested, the descendants
286N/A * of the the source <code>Entity</code> are recursively imported and
286N/A * the resulting nodes reassembled to form the corresponding subtree.</dd>
286N/A * <dt>
286N/A * ENTITY_REFERENCE_NODE</dt>
286N/A * <dd>Only the <code>EntityReference</code> itself is
286N/A * copied, even if a <code>deep</code> import is requested, since the
286N/A * source and destination documents might have defined the entity
286N/A * differently. If the document being imported into provides a
286N/A * definition for this entity name, its value is assigned.</dd>
286N/A * <dt>NOTATION_NODE</dt>
286N/A * <dd>
286N/A * <code>Notation</code> nodes can be imported, however in the current
286N/A * release of the DOM the <code>DocumentType</code> is readonly. Ability
286N/A * to add these imported nodes to a <code>DocumentType</code> will be
286N/A * considered for addition to a future release of the DOM.On import, the
286N/A * <code>publicId</code> and <code>systemId</code> attributes are copied.
286N/A * Note that the <code>deep</code> parameter has no effect on this type
286N/A * of nodes since they cannot have any children.</dd>
286N/A * <dt>
286N/A * PROCESSING_INSTRUCTION_NODE</dt>
286N/A * <dd>The imported node copies its
286N/A * <code>target</code> and <code>data</code> values from those of the
286N/A * source node.Note that the <code>deep</code> parameter has no effect
286N/A * on this type of nodes since they cannot have any children.</dd>
286N/A * <dt>TEXT_NODE,
286N/A * CDATA_SECTION_NODE, COMMENT_NODE</dt>
286N/A * <dd>These three types of nodes inheriting
286N/A * from <code>CharacterData</code> copy their <code>data</code> and
286N/A * <code>length</code> attributes from those of the source node.Note
286N/A * that the <code>deep</code> parameter has no effect on these types of
286N/A * nodes since they cannot have any children.</dd>
286N/A * </dl>
286N/A * @param importedNode The node to import.
286N/A * @param deep If <code>true</code>, recursively import the subtree under
286N/A * the specified node; if <code>false</code>, import only the node
286N/A * itself, as explained above. This has no effect on nodes that cannot
286N/A * have any children, and on <code>Attr</code>, and
286N/A * <code>EntityReference</code> nodes.
286N/A * @return The imported node that belongs to this <code>Document</code>.
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
286N/A * supported.
286N/A * <br>INVALID_CHARACTER_ERR: Raised if one of the imported names is not
286N/A * an XML name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute. This may happen when
286N/A * importing an XML 1.1 [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>] element
286N/A * into an XML 1.0 document, for instance.
286N/A * @since DOM Level 2
286N/A */
286N/A public Node importNode(Node importedNode,
286N/A boolean deep)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates an element of the given qualified name and namespace URI.
286N/A * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
286N/A * , applications must use the value <code>null</code> as the
286N/A * namespaceURI parameter for methods if they wish to have no namespace.
286N/A * @param namespaceURI The namespace URI of the element to create.
286N/A * @param qualifiedName The qualified name of the element type to
286N/A * instantiate.
286N/A * @return A new <code>Element</code> object with the following
286N/A * attributes:
286N/A * <table border='1' cellpadding='3'>
286N/A * <tr>
286N/A * <th>Attribute</th>
286N/A * <th>Value</th>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>qualifiedName</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>namespaceURI</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
286N/A * from <code>qualifiedName</code>, or <code>null</code> if there is
286N/A * no prefix</td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
286N/A * <code>qualifiedName</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>qualifiedName</code></td>
286N/A * </tr>
286N/A * </table>
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified
286N/A * <code>qualifiedName</code> is not an XML name according to the XML
286N/A * version in use specified in the <code>Document.xmlVersion</code>
286N/A * attribute.
286N/A * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
286N/A * malformed qualified name, if the <code>qualifiedName</code> has a
286N/A * prefix and the <code>namespaceURI</code> is <code>null</code>, or
286N/A * if the <code>qualifiedName</code> has a prefix that is "xml" and
286N/A * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
286N/A * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
286N/A * , or if the <code>qualifiedName</code> or its prefix is "xmlns" and
286N/A * 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".
286N/A * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
286N/A * support the <code>"XML"</code> feature, since namespaces were
286N/A * defined by XML.
286N/A * @since DOM Level 2
286N/A */
286N/A public Element createElementNS(String namespaceURI,
286N/A String qualifiedName)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Creates an attribute of the given qualified name and namespace URI.
286N/A * <br>Per [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
286N/A * , applications must use the value <code>null</code> as the
286N/A * <code>namespaceURI</code> parameter for methods if they wish to have
286N/A * no namespace.
286N/A * @param namespaceURI The namespace URI of the attribute to create.
286N/A * @param qualifiedName The qualified name of the attribute to
286N/A * instantiate.
286N/A * @return A new <code>Attr</code> object with the following attributes:
286N/A * <table border='1' cellpadding='3'>
286N/A * <tr>
286N/A * <th>
286N/A * Attribute</th>
286N/A * <th>Value</th>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>Node.namespaceURI</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>Node.prefix</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
286N/A * <code>qualifiedName</code>, or <code>null</code> if there is no
286N/A * prefix</td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
286N/A * <code>qualifiedName</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>
286N/A * <code>qualifiedName</code></td>
286N/A * </tr>
286N/A * <tr>
286N/A * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
286N/A * <td valign='top' rowspan='1' colspan='1'>the empty
286N/A * string</td>
286N/A * </tr>
286N/A * </table>
286N/A * @exception DOMException
286N/A * INVALID_CHARACTER_ERR: Raised if the specified
286N/A * <code>qualifiedName</code> is not an XML name according to the XML
286N/A * version in use specified in the <code>Document.xmlVersion</code>
286N/A * attribute.
286N/A * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
286N/A * malformed qualified name, if the <code>qualifiedName</code> has a
286N/A * prefix and the <code>namespaceURI</code> is <code>null</code>, if
286N/A * the <code>qualifiedName</code> has a prefix that is "xml" and the
286N/A * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
286N/A * http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the
286N/A * <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".
286N/A * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
286N/A * support the <code>"XML"</code> feature, since namespaces were
286N/A * defined by XML.
286N/A * @since DOM Level 2
286N/A */
286N/A public Attr createAttributeNS(String namespaceURI,
286N/A String qualifiedName)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
286N/A * given local name and namespace URI in document order.
286N/A * @param namespaceURI The namespace URI of the elements to match on. The
286N/A * special value <code>"*"</code> matches all namespaces.
286N/A * @param localName The local name of the elements to match on. The
286N/A * special value "*" matches all local names.
286N/A * @return A new <code>NodeList</code> object containing all the matched
286N/A * <code>Elements</code>.
286N/A * @since DOM Level 2
286N/A */
286N/A public NodeList getElementsByTagNameNS(String namespaceURI,
286N/A String localName);
286N/A
286N/A /**
286N/A * Returns the <code>Element</code> that has an ID attribute with the
286N/A * given value. If no such element exists, this returns <code>null</code>
286N/A * . If more than one element has an ID attribute with that value, what
286N/A * is returned is undefined.
286N/A * <br> The DOM implementation is expected to use the attribute
286N/A * <code>Attr.isId</code> to determine if an attribute is of type ID.
286N/A * <p ><b>Note:</b> Attributes with the name "ID" or "id" are not of type
286N/A * ID unless so defined.
286N/A * @param elementId The unique <code>id</code> value for an element.
286N/A * @return The matching element or <code>null</code> if there is none.
286N/A * @since DOM Level 2
286N/A */
286N/A public Element getElementById(String elementId);
286N/A
286N/A /**
286N/A * An attribute specifying the encoding used for this document at the time
286N/A * of the parsing. This is <code>null</code> when it is not known, such
286N/A * as when the <code>Document</code> was created in memory.
286N/A * @since DOM Level 3
286N/A */
286N/A public String getInputEncoding();
286N/A
286N/A /**
286N/A * 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
286N/A * unspecified or when it is not known, such as when the
286N/A * <code>Document</code> was created in memory.
286N/A * @since DOM Level 3
286N/A */
286N/A public String getXmlEncoding();
286N/A
286N/A /**
286N/A * 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
286N/A * unspecified.
286N/A * <p ><b>Note:</b> No verification is done on the value when setting
286N/A * this attribute. Applications should use
286N/A * <code>Document.normalizeDocument()</code> with the "validate"
286N/A * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
286N/A * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
286N/A * @since DOM Level 3
286N/A */
286N/A public boolean getXmlStandalone();
286N/A /**
286N/A * 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
286N/A * unspecified.
286N/A * <p ><b>Note:</b> No verification is done on the value when setting
286N/A * this attribute. Applications should use
286N/A * <code>Document.normalizeDocument()</code> with the "validate"
286N/A * parameter to verify if the value matches the <a href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'>validity
286N/A * constraint for standalone document declaration</a> as defined in [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>].
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised if this document does not support the
286N/A * "XML" feature.
286N/A * @since DOM Level 3
286N/A */
286N/A public void setXmlStandalone(boolean xmlStandalone)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * 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
286N/A * this document supports the "XML" feature, the value is
286N/A * <code>"1.0"</code>. If this document does not support the "XML"
286N/A * feature, the value is always <code>null</code>. Changing this
286N/A * attribute will affect methods that check for invalid characters in
286N/A * XML names. Application should invoke
286N/A * <code>Document.normalizeDocument()</code> in order to check for
286N/A * invalid characters in the <code>Node</code>s that are already part of
286N/A * this <code>Document</code>.
286N/A * <br> DOM applications may use the
286N/A * <code>DOMImplementation.hasFeature(feature, version)</code> method
286N/A * with parameter values "XMLVersion" and "1.0" (respectively) to
286N/A * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
286N/A * applications may use the same method with parameter values
286N/A * "XMLVersion" and "1.1" (respectively) to determine if an
286N/A * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
286N/A * cases, in order to support XML, an implementation must also support
286N/A * the "XML" feature defined in this specification. <code>Document</code>
286N/A * objects supporting a version of the "XMLVersion" feature must not
286N/A * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
286N/A * number when using <code>Document.xmlVersion</code>.
286N/A * @since DOM Level 3
286N/A */
286N/A public String getXmlVersion();
286N/A /**
286N/A * 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
286N/A * this document supports the "XML" feature, the value is
286N/A * <code>"1.0"</code>. If this document does not support the "XML"
286N/A * feature, the value is always <code>null</code>. Changing this
286N/A * attribute will affect methods that check for invalid characters in
286N/A * XML names. Application should invoke
286N/A * <code>Document.normalizeDocument()</code> in order to check for
286N/A * invalid characters in the <code>Node</code>s that are already part of
286N/A * this <code>Document</code>.
286N/A * <br> DOM applications may use the
286N/A * <code>DOMImplementation.hasFeature(feature, version)</code> method
286N/A * with parameter values "XMLVersion" and "1.0" (respectively) to
286N/A * determine if an implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml-20040204'>XML 1.0</a>]. DOM
286N/A * applications may use the same method with parameter values
286N/A * "XMLVersion" and "1.1" (respectively) to determine if an
286N/A * implementation supports [<a href='http://www.w3.org/TR/2004/REC-xml11-20040204/'>XML 1.1</a>]. In both
286N/A * cases, in order to support XML, an implementation must also support
286N/A * the "XML" feature defined in this specification. <code>Document</code>
286N/A * objects supporting a version of the "XMLVersion" feature must not
286N/A * raise a <code>NOT_SUPPORTED_ERR</code> exception for the same version
286N/A * number when using <code>Document.xmlVersion</code>.
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised if the version is set to a value that is
286N/A * not supported by this <code>Document</code> or if this document
286N/A * does not support the "XML" feature.
286N/A * @since DOM Level 3
286N/A */
286N/A public void setXmlVersion(String xmlVersion)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * An attribute specifying whether error checking is enforced or not. When
286N/A * set to <code>false</code>, the implementation is free to not test
286N/A * every possible error case normally defined on DOM operations, and not
286N/A * raise any <code>DOMException</code> on DOM operations or report
286N/A * errors while using <code>Document.normalizeDocument()</code>. In case
286N/A * of error, the behavior is undefined. This attribute is
286N/A * <code>true</code> by default.
286N/A * @since DOM Level 3
286N/A */
286N/A public boolean getStrictErrorChecking();
286N/A /**
286N/A * An attribute specifying whether error checking is enforced or not. When
286N/A * set to <code>false</code>, the implementation is free to not test
286N/A * every possible error case normally defined on DOM operations, and not
286N/A * raise any <code>DOMException</code> on DOM operations or report
286N/A * errors while using <code>Document.normalizeDocument()</code>. In case
286N/A * of error, the behavior is undefined. This attribute is
286N/A * <code>true</code> by default.
286N/A * @since DOM Level 3
286N/A */
286N/A public void setStrictErrorChecking(boolean strictErrorChecking);
286N/A
286N/A /**
286N/A * The location of the document or <code>null</code> if undefined or if
286N/A * the <code>Document</code> was created using
286N/A * <code>DOMImplementation.createDocument</code>. No lexical checking is
286N/A * performed when setting this attribute; this could result in a
286N/A * <code>null</code> value returned when using <code>Node.baseURI</code>
286N/A * .
286N/A * <br> Beware that when the <code>Document</code> supports the feature
286N/A * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
286N/A * , the href attribute of the HTML BASE element takes precedence over
286N/A * this attribute when computing <code>Node.baseURI</code>.
286N/A * @since DOM Level 3
286N/A */
286N/A public String getDocumentURI();
286N/A /**
286N/A * The location of the document or <code>null</code> if undefined or if
286N/A * the <code>Document</code> was created using
286N/A * <code>DOMImplementation.createDocument</code>. No lexical checking is
286N/A * performed when setting this attribute; this could result in a
286N/A * <code>null</code> value returned when using <code>Node.baseURI</code>
286N/A * .
286N/A * <br> Beware that when the <code>Document</code> supports the feature
286N/A * "HTML" [<a href='http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109'>DOM Level 2 HTML</a>]
286N/A * , the href attribute of the HTML BASE element takes precedence over
286N/A * this attribute when computing <code>Node.baseURI</code>.
286N/A * @since DOM Level 3
286N/A */
286N/A public void setDocumentURI(String documentURI);
286N/A
286N/A /**
286N/A * Attempts to adopt a node from another document to this document. If
286N/A * supported, it changes the <code>ownerDocument</code> of the source
286N/A * node, its children, as well as the attached attribute nodes if there
286N/A * are any. If the source node has a parent it is first removed from the
286N/A * child list of its parent. This effectively allows moving a subtree
286N/A * from one document to another (unlike <code>importNode()</code> which
286N/A * create a copy of the source node instead of moving it). When it
286N/A * fails, applications should use <code>Document.importNode()</code>
286N/A * instead. Note that if the adopted node is already part of this
286N/A * document (i.e. the source and target document are the same), this
286N/A * method still has the effect of removing the source node from the
286N/A * child list of its parent, if any. The following list describes the
286N/A * specifics for each type of node.
286N/A * <dl>
286N/A * <dt>ATTRIBUTE_NODE</dt>
286N/A * <dd>The
286N/A * <code>ownerElement</code> attribute is set to <code>null</code> and
286N/A * the <code>specified</code> flag is set to <code>true</code> on the
286N/A * adopted <code>Attr</code>. The descendants of the source
286N/A * <code>Attr</code> are recursively adopted.</dd>
286N/A * <dt>DOCUMENT_FRAGMENT_NODE</dt>
286N/A * <dd>The
286N/A * descendants of the source node are recursively adopted.</dd>
286N/A * <dt>DOCUMENT_NODE</dt>
286N/A * <dd>
286N/A * <code>Document</code> nodes cannot be adopted.</dd>
286N/A * <dt>DOCUMENT_TYPE_NODE</dt>
286N/A * <dd>
286N/A * <code>DocumentType</code> nodes cannot be adopted.</dd>
286N/A * <dt>ELEMENT_NODE</dt>
286N/A * <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes
286N/A * are discarded, though if the document being adopted into defines
286N/A * default attributes for this element name, those are assigned. The
286N/A * descendants of the source element are recursively adopted.</dd>
286N/A * <dt>ENTITY_NODE</dt>
286N/A * <dd>
286N/A * <code>Entity</code> nodes cannot be adopted.</dd>
286N/A * <dt>ENTITY_REFERENCE_NODE</dt>
286N/A * <dd>Only
286N/A * the <code>EntityReference</code> node itself is adopted, the
286N/A * descendants are discarded, since the source and destination documents
286N/A * might have defined the entity differently. If the document being
286N/A * imported into provides a definition for this entity name, its value
286N/A * is assigned.</dd>
286N/A * <dt>NOTATION_NODE</dt>
286N/A * <dd><code>Notation</code> nodes cannot be
286N/A * adopted.</dd>
286N/A * <dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE,
286N/A * COMMENT_NODE</dt>
286N/A * <dd>These nodes can all be adopted. No specifics.</dd>
286N/A * </dl>
286N/A * <p ><b>Note:</b> Since it does not create new nodes unlike the
286N/A * <code>Document.importNode()</code> method, this method does not raise
286N/A * an <code>INVALID_CHARACTER_ERR</code> exception, and applications
286N/A * should use the <code>Document.normalizeDocument()</code> method to
286N/A * check if an imported name is not an XML name according to the XML
286N/A * version in use.
286N/A * @param source The node to move into this document.
286N/A * @return The adopted node, or <code>null</code> if this operation
286N/A * fails, such as when the source node comes from a different
286N/A * implementation.
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised if the source node is of type
286N/A * <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.
286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is
286N/A * readonly.
286N/A * @since DOM Level 3
286N/A */
286N/A public Node adoptNode(Node source)
286N/A throws DOMException;
286N/A
286N/A /**
286N/A * The configuration used when <code>Document.normalizeDocument()</code>
286N/A * is invoked.
286N/A * @since DOM Level 3
286N/A */
286N/A public DOMConfiguration getDomConfig();
286N/A
286N/A /**
286N/A * This method acts as if the document was going through a save and load
286N/A * cycle, putting the document in a "normal" form. As a consequence,
286N/A * this method updates the replacement tree of
286N/A * <code>EntityReference</code> nodes and normalizes <code>Text</code>
286N/A * nodes, as defined in the method <code>Node.normalize()</code>.
286N/A * <br> Otherwise, the actual result depends on the features being set on
286N/A * the <code>Document.domConfig</code> object and governing what
286N/A * operations actually take place. Noticeably this method could also
286N/A * make the document namespace well-formed according to the algorithm
286N/A * described in , check the character normalization, remove the
286N/A * <code>CDATASection</code> nodes, etc. See
286N/A * <code>DOMConfiguration</code> for details.
286N/A * <pre>// Keep in the document
286N/A * the information defined // in the XML Information Set (Java example)
286N/A * DOMConfiguration docConfig = myDocument.getDomConfig();
286N/A * docConfig.setParameter("infoset", Boolean.TRUE);
286N/A * myDocument.normalizeDocument();</pre>
286N/A *
286N/A * <br>Mutation events, when supported, are generated to reflect the
286N/A * changes occurring on the document.
286N/A * <br> If errors occur during the invocation of this method, such as an
286N/A * attempt to update a read-only node or a <code>Node.nodeName</code>
286N/A * contains an invalid character according to the XML version in use,
286N/A * errors or warnings (<code>DOMError.SEVERITY_ERROR</code> or
286N/A * <code>DOMError.SEVERITY_WARNING</code>) will be reported using the
286N/A * <code>DOMErrorHandler</code> object associated with the "error-handler
286N/A * " parameter. Note this method might also report fatal errors (
286N/A * <code>DOMError.SEVERITY_FATAL_ERROR</code>) if an implementation
286N/A * cannot recover from an error.
286N/A * @since DOM Level 3
286N/A */
286N/A public void normalizeDocument();
286N/A
286N/A /**
286N/A * Rename an existing node of type <code>ELEMENT_NODE</code> or
286N/A * <code>ATTRIBUTE_NODE</code>.
286N/A * <br>When possible this simply changes the name of the given node,
286N/A * otherwise this creates a new node with the specified name and
286N/A * replaces the existing node with the new node as described below.
286N/A * <br>If simply changing the name of the given node is not possible, the
286N/A * following operations are performed: a new node is created, any
286N/A * registered event listener is registered on the new node, any user
286N/A * data attached to the old node is removed from that node, the old node
286N/A * is removed from its parent if it has one, the children are moved to
286N/A * the new node, if the renamed node is an <code>Element</code> its
286N/A * attributes are moved to the new node, the new node is inserted at the
286N/A * position the old node used to have in its parent's child nodes list
286N/A * if it has one, the user data that was attached to the old node is
286N/A * attached to the new node.
286N/A * <br>When the node being renamed is an <code>Element</code> only the
286N/A * specified attributes are moved, default attributes originated from
286N/A * the DTD are updated according to the new element name. In addition,
286N/A * the implementation may update default attributes from other schemas.
286N/A * Applications should use <code>Document.normalizeDocument()</code> to
286N/A * guarantee these attributes are up-to-date.
286N/A * <br>When the node being renamed is an <code>Attr</code> that is
286N/A * attached to an <code>Element</code>, the node is first removed from
286N/A * the <code>Element</code> attributes map. Then, once renamed, either
286N/A * by modifying the existing node or creating a new one as described
286N/A * above, it is put back.
286N/A * <br>In addition,
286N/A * <ul>
286N/A * <li> a user data event <code>NODE_RENAMED</code> is fired,
286N/A * </li>
286N/A * <li>
286N/A * when the implementation supports the feature "MutationNameEvents",
286N/A * each mutation operation involved in this method fires the appropriate
286N/A * event, and in the end the event {
286N/A * <code>http://www.w3.org/2001/xml-events</code>,
286N/A * <code>DOMElementNameChanged</code>} or {
286N/A * <code>http://www.w3.org/2001/xml-events</code>,
286N/A * <code>DOMAttributeNameChanged</code>} is fired.
286N/A * </li>
286N/A * </ul>
286N/A * @param n The node to rename.
286N/A * @param namespaceURI The new namespace URI.
286N/A * @param qualifiedName The new qualified name.
286N/A * @return The renamed node. This is either the specified node or the new
286N/A * node that was created to replace the specified node.
286N/A * @exception DOMException
286N/A * NOT_SUPPORTED_ERR: Raised when the type of the specified node is
286N/A * neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>,
286N/A * or if the implementation does not support the renaming of the
286N/A * document element.
286N/A * <br>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an
286N/A * XML name according to the XML version in use specified in the
286N/A * <code>Document.xmlVersion</code> attribute.
286N/A * <br>WRONG_DOCUMENT_ERR: Raised when the specified node was created
286N/A * from a different document than this document.
286N/A * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a
286N/A * malformed qualified name, if the <code>qualifiedName</code> has a
286N/A * prefix and the <code>namespaceURI</code> is <code>null</code>, or
286N/A * if the <code>qualifiedName</code> has a prefix that is "xml" and
286N/A * the <code>namespaceURI</code> is different from "<a href='http://www.w3.org/XML/1998/namespace'>
286N/A * http://www.w3.org/XML/1998/namespace</a>" [<a href='http://www.w3.org/TR/1999/REC-xml-names-19990114/'>XML Namespaces</a>]
286N/A * . Also raised, when the node being renamed is an attribute, if the
286N/A * <code>qualifiedName</code>, or its prefix, is "xmlns" and the
286N/A * <code>namespaceURI</code> is different from "<a href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>".
286N/A * @since DOM Level 3
286N/A */
286N/A public Node renameNode(Node n,
286N/A String namespaceURI,
286N/A String qualifiedName)
286N/A throws DOMException;
286N/A
286N/A}