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>Attr</code> interface represents an attribute in an 17f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Element</code> object. Typically the allowable values for the 18320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attribute are defined in a schema associated with the document. 19f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p><code>Attr</code> objects inherit the <code>Node</code> interface, but 20f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * since they are not actually child nodes of the element they describe, the 21f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * DOM does not consider them part of the document tree. Thus, the 22f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Node</code> attributes <code>parentNode</code>, 23f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>previousSibling</code>, and <code>nextSibling</code> have a 24f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>null</code> value for <code>Attr</code> objects. The DOM takes the 25f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * view that attributes are properties of elements rather than having a 26f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * separate identity from the elements they are associated with; this should 27f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * make it more efficient to implement such features as default attributes 28f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * associated with all elements of a given type. Furthermore, 29f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> nodes may not be immediate children of a 30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DocumentFragment</code>. However, they can be associated with 31f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Element</code> nodes contained within a 32f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>DocumentFragment</code>. In short, users and implementors of the 33f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * DOM need to be aware that <code>Attr</code> nodes have some things in 34f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * common with other objects inheriting the <code>Node</code> interface, but 35adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * they also are quite distinct. 36f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>The attribute's effective value is determined as follows: if this 37f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute has been explicitly assigned any value, that value is the 38f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute's effective value; otherwise, if there is a declaration for 39f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * this attribute, and that declaration includes a default value, then that 40f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * default value is the attribute's effective value; otherwise, the 41f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute does not exist on this element in the structure model until it 42f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * has been explicitly added. Note that the <code>Node.nodeValue</code> 43f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute on the <code>Attr</code> instance can also be used to retrieve 44320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the string version of the attribute's value(s). 45f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> If the attribute was not explicitly given a value in the instance 46f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document but has a default value provided by the schema associated with 47f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the document, an attribute node will be created with 48f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>specified</code> set to <code>false</code>. Removing attribute 49f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * nodes for which a default value is defined in the schema generates a new 50f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute node with the default value and <code>specified</code> set to 51f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>false</code>. If validation occurred while invoking 52f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code>, attribute nodes with 53f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>specified</code> equals to <code>false</code> are recomputed 54f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * according to the default attribute values provided by the schema. If no 55f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * default value is associate with this attribute in the schema, the 56f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute node is discarded. 57f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>In XML, where the value of an attribute can contain entity references, 58f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the child nodes of the <code>Attr</code> node may be either 59f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Text</code> or <code>EntityReference</code> nodes (when these are 60f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * in use; see the description of <code>EntityReference</code> for 61f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * discussion). 62f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>The DOM Core represents all attribute values as simple strings, even if 63f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the DTD or schema associated with the document declares them of some 64f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * specific type such as tokenized. 65f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>The way attribute value normalization is performed by the DOM 66f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementation depends on how much the implementation knows about the 67f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * schema in use. Typically, the <code>value</code> and 68f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>nodeValue</code> attributes of an <code>Attr</code> node initially 69f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * returns the normalized value given by the parser. It is also the case 70f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * after <code>Document.normalizeDocument()</code> is called (assuming the 71f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * right options have been set). But this may not be the case after 72f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * mutation, independently of whether the mutation is performed by setting 73f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the string value directly or by changing the <code>Attr</code> child 74f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * nodes. In particular, this is true when <a href='http://www.w3.org/TR/2004/REC-xml-20040204#dt-charref'>character 75f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * references</a> are involved, given that they are not represented in the DOM and they 76f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * impact attribute value normalization. On the other hand, if the 77f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementation knows about the schema in use when the attribute value is 78f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * changed, and it is of a different type than CDATA, it may normalize it 79f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * again at that time. This is especially true of specialized DOM 80f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementations, such as SVG DOM implementations, which store attribute 81320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * values in an internal form different from a string. 82f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p>The following table gives some examples of the relations between the 83f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute value in the original document (parsed attribute), the value as 84f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * exposed in the DOM, and the serialization of the value: 85320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <table border='1' cellpadding='3'> 86320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 87320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Examples</th> 88f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <th>Parsed 89320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attribute value</th> 90320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Initial <code>Attr.value</code></th> 91320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <th>Serialized attribute value</th> 92320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 93320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 94320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 95320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Character reference</td> 96320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 97320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x&#178;=5"</pre> 98320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 99320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 100320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x\u00b2=5"</pre> 101320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 102320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 103320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x&#178;=5"</pre> 104320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 105320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 106320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 107f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <td valign='top' rowspan='1' colspan='1'>Built-in 108320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * character entity</td> 109320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 110320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"y&lt;6"</pre> 111320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 112320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 113320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"y<6"</pre> 114320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 115320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 116320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"y&lt;6"</pre> 117320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 118320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 119320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 120320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'>Literal newline between</td> 121320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 122320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre> 123320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * "x=5&#10;y=6"</pre> 124320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 125320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 126320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x=5 y=6"</pre> 127320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 128320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 129320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x=5&#10;y=6"</pre> 130320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 131320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 132320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 133320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'>Normalized newline between</td> 134320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 135f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <pre>"x=5 136320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * y=6"</pre> 137320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 138320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 139320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x=5 y=6"</pre> 140320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 141320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 142320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre>"x=5 y=6"</pre> 143320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 144320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 145320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <tr> 146320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'>Entity <code>e</code> with literal newline</td> 147320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'> 148320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <pre> 149320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <!ENTITY e '...&#10;...'> [...]> "x=5&e;y=6"</pre> 150320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </td> 151320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load Options</em></td> 152320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <td valign='top' rowspan='1' colspan='1'><em>Dependent on Implementation and Load/Save Options</em></td> 153320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </tr> 154320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </table> 155320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse 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>. 156adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 157adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Projectpublic interface Attr extends Node { 158adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 159f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Returns the name of this attribute. If <code>Node.localName</code> is 160320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * different from <code>null</code>, this attribute is a qualified name. 161adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 162adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public String getName(); 163adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 164adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 165f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>True</code> if this attribute was explicitly given a value in 166f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the instance document, <code>false</code> otherwise. If the 167f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * application changed the value of this attribute node (even if it ends 168f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * up having the same value as the default value) then it is set to 169f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>true</code>. The implementation may handle attributes with 170f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * default values from other schemas similarly but applications should 171f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * use <code>Document.normalizeDocument()</code> to guarantee this 172f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * information is up-to-date. 173adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 174adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public boolean getSpecified(); 175adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 176adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 177f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * On retrieval, the value of the attribute is returned as a string. 178f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Character and general entity references are replaced with their 1791ec94feeb09591c30996c7c0834d6f131e204922Jesse Wilson * values. See also the method <code>getAttribute</code> on the 180adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>Element</code> interface. 181f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>On setting, this creates a <code>Text</code> node with the unparsed 182f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * contents of the string, i.e. any characters that an XML processor 183f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * would recognize as markup are instead treated as literal text. See 184320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * also the method <code>Element.setAttribute()</code>. 185f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> Some specialized implementations, such as some [<a href='http://www.w3.org/TR/2003/REC-SVG11-20030114/'>SVG 1.1</a>] 186f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementations, may do normalization automatically, even after 187f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * mutation; in such case, the value on retrieval may differ from the 188f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * value on setting. 189adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 190adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public String getValue(); 191adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 192f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * On retrieval, the value of the attribute is returned as a string. 193f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Character and general entity references are replaced with their 194f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * values. See also the method <code>getAttribute</code> on the 195320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Element</code> interface. 196f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br>On setting, this creates a <code>Text</code> node with the unparsed 197f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * contents of the string, i.e. any characters that an XML processor 198f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * would recognize as markup are instead treated as literal text. See 199320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * also the method <code>Element.setAttribute()</code>. 200f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> Some specialized implementations, such as some [<a href='http://www.w3.org/TR/2003/REC-SVG11-20030114/'>SVG 1.1</a>] 201f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * implementations, may do normalization automatically, even after 202f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * mutation; in such case, the value on retrieval may differ from the 203f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * value on setting. 204320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @exception DOMException 205adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. 206adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 207adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public void setValue(String value) 208adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project throws DOMException; 209adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 210adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project /** 211f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The <code>Element</code> node this attribute is attached to or 212adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * <code>null</code> if this attribute is not in use. 213adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project * @since DOM Level 2 214adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project */ 215adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project public Element getOwnerElement(); 216adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project 217320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 218f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The type information associated with this attribute. While the type 219f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * information contained in this attribute is guarantee to be correct 220f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * after loading the document or invoking 221320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>Document.normalizeDocument()</code>, <code>schemaTypeInfo</code> 222f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * may not be reliable if the node was moved. 223320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 224320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 225320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public TypeInfo getSchemaTypeInfo(); 226320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 227320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 228f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Returns whether this attribute is known to be of type ID (i.e. to 229f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * contain an identifier for its owner element) or not. When it is and 230f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * its value is unique, the <code>ownerElement</code> of this attribute 231320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * can be retrieved using the method <code>Document.getElementById</code> 232f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . The implementation could use several ways to determine if an 233f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attribute node is known to contain an identifier: 234320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <ul> 235f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> If validation 236320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * occurred using an XML Schema [<a href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/'>XML Schema Part 1</a>] 237f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * while loading the document or while invoking 238f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code>, the post-schema-validation 239f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * infoset contributions (PSVI contributions) values are used to 240f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * determine if this attribute is a schema-determined ID attribute using 241320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * the <a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-sdi'> 242320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * schema-determined ID</a> definition in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>] 243f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 244320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 245f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> If validation occurred using a DTD while loading the document or 246f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * 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 247320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * attribute using the <a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-ddi'> 248320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * DTD-determined ID</a> definition in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>] 249f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 250320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 251f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> from the use of the methods <code>Element.setIdAttribute()</code>, 252f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Element.setIdAttributeNS()</code>, or 253f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Element.setIdAttributeNode()</code>, i.e. it is an 254f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * user-determined ID attribute; 255320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <p ><b>Note:</b> XPointer framework (see section 3.2 in [<a href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/'>XPointer</a>] 256f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * ) consider the DOM user-determined ID attribute as being part of the 257f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * XPointer externally-determined ID definition. 258320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 259f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <li> using mechanisms that 260f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * are outside the scope of this specification, it is then an 261f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * externally-determined ID attribute. This includes using schema 262f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * languages different from XML schema and DTD. 263320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </li> 264320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * </ul> 265f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <br> If validation occurred while invoking 266f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Document.normalizeDocument()</code>, all user-determined ID 267f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * attributes are reset and all attribute nodes ID information are then 268f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * reevaluated in accordance to the schema used. As a consequence, if 269f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * the <code>Attr.schemaTypeInfo</code> attribute contains an ID type, 270f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>isId</code> will always return true. 271320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * @since DOM Level 3 272320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 273320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public boolean isId(); 274320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 275adc854b798c1cfe3bfd4c27d68d5cee38ca617daThe Android Open Source Project} 276