286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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 * 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 * 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 * Copyright (c) 2004 World Wide Web Consortium, 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 * The <code>Element</code> interface represents an element in an HTML or XML 286N/A * document. Elements may have attributes associated with them; since the 286N/A * <code>Element</code> interface inherits from <code>Node</code>, the 286N/A * generic <code>Node</code> interface attribute <code>attributes</code> may 286N/A * be used to retrieve the set of all attributes for an element. There are 286N/A * methods on the <code>Element</code> interface to retrieve either an 286N/A * <code>Attr</code> object by name or an attribute value by name. In XML, 286N/A * where an attribute value may contain entity references, an 286N/A * <code>Attr</code> object should be retrieved to examine the possibly 286N/A * fairly complex sub-tree representing the attribute value. On the other 286N/A * hand, in HTML, where all attributes have simple string values, methods to 286N/A * directly access an attribute value can safely be used as a convenience. 286N/A * <p ><b>Note:</b> In DOM Level 2, the method <code>normalize</code> is 286N/A * inherited from the <code>Node</code> interface where it was moved. 286N/A * The name of the element. If <code>Node.localName</code> is different 286N/A * from <code>null</code>, this attribute is a qualified name. For 286N/A * <pre> <elementExample id="demo"> ... 286N/A * </elementExample> , </pre> 286N/A * <code>tagName</code> has the value 286N/A * <code>"elementExample"</code>. Note that this is case-preserving in 286N/A * XML, as are all of the operations of the DOM. The HTML DOM returns 286N/A * the <code>tagName</code> of an HTML element in the canonical 286N/A * uppercase form, regardless of the case in the source HTML document. 286N/A * Retrieves an attribute value by name. 286N/A * @param name The name of the attribute to retrieve. 286N/A * @return The <code>Attr</code> value as a string, or the empty string 286N/A * if that attribute does not have a specified or default value. 286N/A * Adds a new attribute. If an attribute with that name is already present 286N/A * in the element, its value is changed to be that of the value 286N/A * parameter. This value is a simple string; it is not parsed as it is 286N/A * being set. So any markup (such as syntax to be recognized as an 286N/A * entity reference) is treated as literal text, and needs to be 286N/A * appropriately escaped by the implementation when it is written out. 286N/A * In order to assign an attribute value that contains entity 286N/A * references, the user must create an <code>Attr</code> node plus any 286N/A * <code>Text</code> and <code>EntityReference</code> nodes, build the 286N/A * appropriate subtree, and use <code>setAttributeNode</code> to assign 286N/A * it as the value of an attribute. 286N/A * <br>To set an attribute with a qualified name and namespace URI, use 286N/A * the <code>setAttributeNS</code> method. 286N/A * @param name The name of the attribute to create or alter. 286N/A * @param value Value to set in string form. 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 * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * Removes an attribute by name. If a default value for the removed 286N/A * attribute is defined in the DTD, a new attribute immediately appears 286N/A * with the default value as well as the corresponding namespace URI, 286N/A * local name, and prefix when applicable. The implementation may handle 286N/A * default values from other schemas similarly but applications should 286N/A * use <code>Document.normalizeDocument()</code> to guarantee this 286N/A * information is up-to-date. 286N/A * <br>If no attribute with this name is found, this method has no effect. 286N/A * <br>To remove an attribute by local name and namespace URI, use the 286N/A * <code>removeAttributeNS</code> method. 286N/A * @param name The name of the attribute to remove. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * Retrieves an attribute node by name. 286N/A * <br>To retrieve an attribute node by qualified name and namespace URI, 286N/A * use the <code>getAttributeNodeNS</code> method. 286N/A * @param name The name (<code>nodeName</code>) of the attribute to 286N/A * @return The <code>Attr</code> node with the specified name ( 286N/A * <code>nodeName</code>) or <code>null</code> if there is no such 286N/A * Adds a new attribute node. If an attribute with that name ( 286N/A * <code>nodeName</code>) is already present in the element, it is 286N/A * replaced by the new one. Replacing an attribute node by itself has no 286N/A * <br>To add a new attribute node with a qualified name and namespace 286N/A * URI, use the <code>setAttributeNodeNS</code> method. 286N/A * @param newAttr The <code>Attr</code> node to add to the attribute list. 286N/A * @return If the <code>newAttr</code> attribute replaces an existing 286N/A * attribute, the replaced <code>Attr</code> node is returned, 286N/A * otherwise <code>null</code> is returned. 286N/A * @exception DOMException 286N/A * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a 286N/A * different document than the one that created the element. 286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an 286N/A * attribute of another <code>Element</code> object. The DOM user must 286N/A * explicitly clone <code>Attr</code> nodes to re-use them in other 286N/A * Removes the specified attribute node. If a default value for the 286N/A * removed <code>Attr</code> node is defined in the DTD, a new node 286N/A * immediately appears with the default value as well as the 286N/A * corresponding namespace URI, local name, and prefix when applicable. 286N/A * The implementation may handle default values from other schemas 286N/A * similarly but applications should use 286N/A * <code>Document.normalizeDocument()</code> to guarantee this 286N/A * information is up-to-date. 286N/A * @param oldAttr The <code>Attr</code> node to remove from the attribute 286N/A * @return The <code>Attr</code> node that was removed. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute 286N/A * Returns a <code>NodeList</code> of all descendant <code>Elements</code> 286N/A * with a given tag name, in document order. 286N/A * @param name The name of the tag to match on. The special value "*" 286N/A * @return A list of matching <code>Element</code> nodes. 286N/A * Retrieves an attribute value by local name and namespace URI. 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 * @param namespaceURI The namespace URI of the attribute to retrieve. 286N/A * @param localName The local name of the attribute to retrieve. 286N/A * @return The <code>Attr</code> value as a string, or the empty string 286N/A * if that attribute does not have a specified or default value. 286N/A * @exception DOMException 286N/A * NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Adds a new attribute. If an attribute with the same local name and 286N/A * namespace URI is already present on the element, its prefix is 286N/A * changed to be the prefix part of the <code>qualifiedName</code>, and 286N/A * its value is changed to be the <code>value</code> parameter. This 286N/A * value is a simple string; it is not parsed as it is being set. So any 286N/A * markup (such as syntax to be recognized as an entity reference) is 286N/A * treated as literal text, and needs to be appropriately escaped by the 286N/A * implementation when it is written out. In order to assign an 286N/A * attribute value that contains entity references, the user must create 286N/A * an <code>Attr</code> node plus any <code>Text</code> and 286N/A * <code>EntityReference</code> nodes, build the appropriate subtree, 286N/A * and use <code>setAttributeNodeNS</code> or 286N/A * <code>setAttributeNode</code> to assign it as the value of an 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 * @param namespaceURI The namespace URI of the attribute to create or 286N/A * @param qualifiedName The qualified name of the attribute to create or 286N/A * @param value The value to set in string form. 286N/A * @exception DOMException 286N/A * INVALID_CHARACTER_ERR: Raised if the specified qualified name is not 286N/A * an XML name according to the XML version in use specified in the 286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is 286N/A * malformed per the Namespaces in XML specification, if the 286N/A * <code>qualifiedName</code> has a prefix and the 286N/A * <code>namespaceURI</code> is <code>null</code>, if the 286N/A * <code>qualifiedName</code> has a prefix that is "xml" and the 286N/A * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Removes an attribute by local name and namespace URI. If a default 286N/A * value for the removed attribute is defined in the DTD, a new 286N/A * attribute immediately appears with the default value as well as the 286N/A * corresponding namespace URI, local name, and prefix when applicable. 286N/A * The implementation may handle default values from other schemas 286N/A * similarly but applications should use 286N/A * <code>Document.normalizeDocument()</code> to guarantee this 286N/A * information is up-to-date. 286N/A * <br>If no attribute with this local name and namespace URI is found, 286N/A * this method has no effect. 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 * @param namespaceURI The namespace URI of the attribute to remove. 286N/A * @param localName The local name of the attribute to remove. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Retrieves an <code>Attr</code> node by local name and namespace URI. 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 * @param namespaceURI The namespace URI of the attribute to retrieve. 286N/A * @param localName The local name of the attribute to retrieve. 286N/A * @return The <code>Attr</code> node with the specified attribute local 286N/A * name and namespace URI or <code>null</code> if there is no such 286N/A * @exception DOMException 286N/A * NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Adds a new attribute. If an attribute with that local name and that 286N/A * namespace URI is already present in the element, it is replaced by 286N/A * the new one. Replacing an attribute node by itself has no effect. 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 * @param newAttr The <code>Attr</code> node to add to the attribute list. 286N/A * @return If the <code>newAttr</code> attribute replaces an existing 286N/A * attribute with the same local name and namespace URI, the replaced 286N/A * <code>Attr</code> node is returned, otherwise <code>null</code> is 286N/A * @exception DOMException 286N/A * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a 286N/A * different document than the one that created the element. 286N/A * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an 286N/A * attribute of another <code>Element</code> object. The DOM user must 286N/A * explicitly clone <code>Attr</code> nodes to re-use them in other 286N/A * <br>NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Returns a <code>NodeList</code> of all the descendant 286N/A * <code>Elements</code> with a given local name and namespace URI in 286N/A * @param namespaceURI The namespace URI of the elements to match on. The 286N/A * special value "*" 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 * @exception DOMException 286N/A * NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * Returns <code>true</code> when an attribute with a given name is 286N/A * specified on this element or has a default value, <code>false</code> 286N/A * @param name The name of the attribute to look for. 286N/A * @return <code>true</code> if an attribute with the given name is 286N/A * specified on this element or has a default value, <code>false</code> 286N/A * Returns <code>true</code> when an attribute with a given local name and 286N/A * namespace URI is specified on this element or has a default value, 286N/A * <code>false</code> otherwise. 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 * @param namespaceURI The namespace URI of the attribute to look for. 286N/A * @param localName The local name of the attribute to look for. 286N/A * @return <code>true</code> if an attribute with the given local name 286N/A * and namespace URI is specified or has a default value on this 286N/A * element, <code>false</code> otherwise. 286N/A * @exception DOMException 286N/A * NOT_SUPPORTED_ERR: May be raised if the implementation does not 286N/A * support the feature <code>"XML"</code> and the language exposed 286N/A * The type information associated with this element. 286N/A * If the parameter <code>isId</code> is <code>true</code>, this method 286N/A * declares the specified attribute to be a user-determined ID attribute 286N/A * . This affects the value of <code>Attr.isId</code> and the behavior 286N/A * of <code>Document.getElementById</code>, but does not change any 286N/A * schema that may be in use, in particular this does not affect the 286N/A * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code> 286N/A * node. Use the value <code>false</code> for the parameter 286N/A * <code>isId</code> to undeclare an attribute for being a 286N/A * user-determined ID attribute. 286N/A * <br> To specify an attribute by local name and namespace URI, use the 286N/A * <code>setIdAttributeNS</code> method. 286N/A * @param name The name of the attribute. 286N/A * @param isId Whether the attribute is a of type ID. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute 286N/A * If the parameter <code>isId</code> is <code>true</code>, this method 286N/A * declares the specified attribute to be a user-determined ID attribute 286N/A * . This affects the value of <code>Attr.isId</code> and the behavior 286N/A * of <code>Document.getElementById</code>, but does not change any 286N/A * schema that may be in use, in particular this does not affect the 286N/A * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code> 286N/A * node. Use the value <code>false</code> for the parameter 286N/A * <code>isId</code> to undeclare an attribute for being a 286N/A * user-determined ID attribute. 286N/A * @param namespaceURI The namespace URI of the attribute. 286N/A * @param localName The local name of the attribute. 286N/A * @param isId Whether the attribute is a of type ID. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute 286N/A * If the parameter <code>isId</code> is <code>true</code>, this method 286N/A * declares the specified attribute to be a user-determined ID attribute 286N/A * . This affects the value of <code>Attr.isId</code> and the behavior 286N/A * of <code>Document.getElementById</code>, but does not change any 286N/A * schema that may be in use, in particular this does not affect the 286N/A * <code>Attr.schemaTypeInfo</code> of the specified <code>Attr</code> 286N/A * node. Use the value <code>false</code> for the parameter 286N/A * <code>isId</code> to undeclare an attribute for being a 286N/A * user-determined ID attribute. 286N/A * @param idAttr The attribute node. 286N/A * @param isId Whether the attribute is a of type ID. 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. 286N/A * <br>NOT_FOUND_ERR: Raised if the specified node is not an attribute