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>Attr</code> interface represents an attribute in an 286N/A * <code>Element</code> object. Typically the allowable values for the 286N/A * attribute are defined in a schema associated with the document. 286N/A * <p><code>Attr</code> objects inherit the <code>Node</code> interface, but 286N/A * since they are not actually child nodes of the element they describe, the 286N/A * DOM does not consider them part of the document tree. Thus, the 286N/A * <code>Node</code> attributes <code>parentNode</code>, 286N/A * <code>previousSibling</code>, and <code>nextSibling</code> have a 286N/A * <code>null</code> value for <code>Attr</code> objects. The DOM takes the 286N/A * view that attributes are properties of elements rather than having a 286N/A * separate identity from the elements they are associated with; this should 286N/A * make it more efficient to implement such features as default attributes 286N/A * associated with all elements of a given type. Furthermore, 286N/A * <code>Attr</code> nodes may not be immediate children of a 286N/A * <code>DocumentFragment</code>. However, they can be associated with 286N/A * <code>Element</code> nodes contained within a 286N/A * <code>DocumentFragment</code>. In short, users and implementors of the 286N/A * DOM need to be aware that <code>Attr</code> nodes have some things in 286N/A * common with other objects inheriting the <code>Node</code> interface, but 286N/A * they also are quite distinct. 286N/A * <p>The attribute's effective value is determined as follows: if this 286N/A * attribute has been explicitly assigned any value, that value is the 286N/A * attribute's effective value; otherwise, if there is a declaration for 286N/A * this attribute, and that declaration includes a default value, then that 286N/A * default value is the attribute's effective value; otherwise, the 286N/A * attribute does not exist on this element in the structure model until it 286N/A * has been explicitly added. Note that the <code>Node.nodeValue</code> 286N/A * attribute on the <code>Attr</code> instance can also be used to retrieve 286N/A * the string version of the attribute's value(s). 286N/A * <p> If the attribute was not explicitly given a value in the instance 286N/A * document but has a default value provided by the schema associated with 286N/A * the document, an attribute node will be created with 286N/A * <code>specified</code> set to <code>false</code>. Removing attribute 286N/A * nodes for which a default value is defined in the schema generates a new 286N/A * attribute node with the default value and <code>specified</code> set to 286N/A * <code>false</code>. If validation occurred while invoking 286N/A * <code>Document.normalizeDocument()</code>, attribute nodes with 286N/A * <code>specified</code> equals to <code>false</code> are recomputed 286N/A * according to the default attribute values provided by the schema. If no 286N/A * default value is associate with this attribute in the schema, the 286N/A * attribute node is discarded. 286N/A * <p>In XML, where the value of an attribute can contain entity references, 286N/A * the child nodes of the <code>Attr</code> node may be either 286N/A * <code>Text</code> or <code>EntityReference</code> nodes (when these are 286N/A * in use; see the description of <code>EntityReference</code> for 286N/A * <p>The DOM Core represents all attribute values as simple strings, even if 286N/A * the DTD or schema associated with the document declares them of some 286N/A * specific type such as tokenized. 286N/A * <p>The way attribute value normalization is performed by the DOM 286N/A * implementation depends on how much the implementation knows about the 286N/A * schema in use. Typically, the <code>value</code> and 286N/A * <code>nodeValue</code> attributes of an <code>Attr</code> node initially 286N/A * returns the normalized value given by the parser. It is also the case 286N/A * after <code>Document.normalizeDocument()</code> is called (assuming the 286N/A * right options have been set). But this may not be the case after 286N/A * mutation, independently of whether the mutation is performed by setting 286N/A * the string value directly or by changing the <code>Attr</code> child 286N/A * references</a> are involved, given that they are not represented in the DOM and they 286N/A * impact attribute value normalization. On the other hand, if the 286N/A * implementation knows about the schema in use when the attribute value is 286N/A * changed, and it is of a different type than CDATA, it may normalize it 286N/A * again at that time. This is especially true of specialized DOM 286N/A * implementations, such as SVG DOM implementations, which store attribute 286N/A * values in an internal form different from a string. 286N/A * <p>The following table gives some examples of the relations between the 286N/A * attribute value in the original document (parsed attribute), the value as 286N/A * exposed in the DOM, and the serialization of the value: 286N/A * <table border='1' cellpadding='3'> 286N/A * <th>Initial <code>Attr.value</code></th> 286N/A * <th>Serialized attribute value</th> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * Character reference</td> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"x&#178;=5"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"x\u00b2=5"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"x&#178;=5"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'>Built-in 286N/A * character entity</td> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"y&lt;6"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"y&lt;6"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'>Literal newline between</td> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * "x=5&#10;y=6"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <pre>"x=5&#10;y=6"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'>Normalized newline between</td> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <td valign='top' rowspan='1' colspan='1'>Entity <code>e</code> with literal newline</td> 286N/A * <td valign='top' rowspan='1' colspan='1'> 286N/A * <!ENTITY e '...&#10;...'> [...]> "x=5&e;y=6"</pre> 286N/A * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load Options</em></td> 286N/A * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load/Save Options</em></td> 286N/A * Returns the name of this attribute. If <code>Node.localName</code> is 286N/A * different from <code>null</code>, this attribute is a qualified name. 286N/A * <code>True</code> if this attribute was explicitly given a value in 286N/A * the instance document, <code>false</code> otherwise. If the 286N/A * application changed the value of this attribute node (even if it ends 286N/A * up having the same value as the default value) then it is set to 286N/A * <code>true</code>. The implementation may handle attributes with 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 * On retrieval, the value of the attribute is returned as a string. 286N/A * Character and general entity references are replaced with their 286N/A * values. See also the method <code>getAttribute</code> on the 286N/A * <code>Element</code> interface. 286N/A * <br>On setting, this creates a <code>Text</code> node with the unparsed 286N/A * contents of the string, i.e. any characters that an XML processor 286N/A * would recognize as markup are instead treated as literal text. See 286N/A * also the method <code>Element.setAttribute()</code>. 286N/A * implementations, may do normalization automatically, even after 286N/A * mutation; in such case, the value on retrieval may differ from the 286N/A * On retrieval, the value of the attribute is returned as a string. 286N/A * Character and general entity references are replaced with their 286N/A * values. See also the method <code>getAttribute</code> on the 286N/A * <code>Element</code> interface. 286N/A * <br>On setting, this creates a <code>Text</code> node with the unparsed 286N/A * contents of the string, i.e. any characters that an XML processor 286N/A * would recognize as markup are instead treated as literal text. See 286N/A * also the method <code>Element.setAttribute()</code>. 286N/A * implementations, may do normalization automatically, even after 286N/A * mutation; in such case, the value on retrieval may differ from the 286N/A * @exception DOMException 286N/A * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. 286N/A * The <code>Element</code> node this attribute is attached to or 286N/A * <code>null</code> if this attribute is not in use. 286N/A * The type information associated with this attribute. While the type 286N/A * information contained in this attribute is guarantee to be correct 286N/A * after loading the document or invoking 286N/A * <code>Document.normalizeDocument()</code>, <code>schemaTypeInfo</code> 286N/A * may not be reliable if the node was moved. 286N/A * Returns whether this attribute is known to be of type ID (i.e. to 286N/A * contain an identifier for its owner element) or not. When it is and 286N/A * its value is unique, the <code>ownerElement</code> of this attribute 286N/A * can be retrieved using the method <code>Document.getElementById</code> 286N/A * . The implementation could use several ways to determine if an 286N/A * attribute node is known to contain an identifier: 286N/A * while loading the document or while invoking 286N/A * <code>Document.normalizeDocument()</code>, the post-schema-validation 286N/A * infoset contributions (PSVI contributions) values are used to 286N/A * determine if this attribute is a schema-determined ID attribute using 286N/A * <li> If validation occurred using a DTD while loading the document or 286N/A * while invoking <code>Document.normalizeDocument()</code>, the infoset <b>[type definition]</b> value is used to determine if this attribute is a DTD-determined ID 286N/A * <li> from the use of the methods <code>Element.setIdAttribute()</code>, 286N/A * <code>Element.setIdAttributeNS()</code>, or 286N/A * <code>Element.setIdAttributeNode()</code>, i.e. it is an 286N/A * user-determined ID attribute; 286N/A * ) consider the DOM user-determined ID attribute as being part of the 286N/A * XPointer externally-determined ID definition. 286N/A * <li> using mechanisms that 286N/A * are outside the scope of this specification, it is then an 286N/A * externally-determined ID attribute. This includes using schema 286N/A * languages different from XML schema and DTD. 286N/A * <br> If validation occurred while invoking 286N/A * <code>Document.normalizeDocument()</code>, all user-determined ID 286N/A * attributes are reset and all attribute nodes ID information are then 286N/A * reevaluated in accordance to the schema used. As a consequence, if 286N/A * the <code>Attr.schemaTypeInfo</code> attribute contains an ID type, 286N/A * <code>isId</code> will always return true.