<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- Generated: Wed Apr 07 13:10:49 EDT 2004 jfouffa.w3.org --> <html lang='en-US'> <head> <title>Document Object Model Core</title> <link rel='stylesheet' type='text/css' href='./spec.css'> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel='stylesheet' type='text/css' href='W3C-REC.css'> <link rel='next' href='changes.html'> <link rel='contents' href='Overview.html#contents'> <link rel='copyright' href='copyright-notice.html'> <link rel='glossary' href='glossary.html'> <link rel='Start' href='Overview.html'> <link rel='index' href='def-index.html'> <link rel='author' href='mailto:www-dom@w3.org'> <link rel='help' href='http://www.w3.org/DOM/'> <link rel='prev' href='introduction.html'> </head> <body> <div class='navbar' style='text-align: center'> <map id='navbar-top' name='navbar-top' title='Navigation Bar'><p> [<a title='What is the Document Object Model?' accesskey='p' href='introduction.html'><strong><u>p</u></strong>revious</a>] [<a title='Changes' accesskey='n' href='changes.html'><strong><u>n</u></strong>ext</a>] [<a title='Table of Contents' accesskey='c' href='Overview.html#contents'><strong><u>c</u></strong>ontents</a>] [<a title='Index' accesskey='i' href='def-index.html'><strong><u>i</u></strong>ndex</a>]</p> <hr title='Navigation area separator'> </map></div> <div class='noprint' style='text-align: right'> <p style='font-family: monospace;font-size:small'>07 April 2004</p> </div> <div class='div1'><a name='Core'></a> <h1 id='Core-h1' class='div1'>1. Document Object Model Core</h1><dl> <dt><i>Editors</i>: </dt><dd>Arnaud Le Hors, IBM</dd> <dd>Philippe Le Hégaret, W3C</dd> <dd>Gavin Nicol, Inso EPS (for DOM Level 1)</dd> <dd>Lauren Wood, SoftQuad, Inc. (for DOM Level 1)</dd> <dd>Mike Champion, Arbortext and Software AG (for DOM Level 1 from November 20, 1997)</dd> <dd>Steve Byrne, JavaSoft (for DOM Level 1 until November 19, 1997)</dd> </dl> <div class='noprint'> <h2 id='table-of-contents'>Table of contents</h2> <ul class='toc'> <li class='tocline3'><a class='tocxref' href='#ID-1590626201'>1.1 Overview of the DOM Core Interfaces</a> <ul class='toc'> <li class='tocline4'><a class='tocxref' href='#ID-1590626202'>1.1.1 The DOM Structure Model</a> <li class='tocline4'><a class='tocxref' href='#ID-249F15BA'>1.1.2 Memory Management</a> <li class='tocline4'><a class='tocxref' href='#ID-45A944CB'>1.1.3 Naming Conventions</a> <li class='tocline4'><a class='tocxref' href='#ID-1CED5498'>1.1.4 Inheritance vs. Flattened Views of the API</a> </ul></li> <li class='tocline3'><a class='tocxref' href='#BasicTypes'>1.2 Basic Types</a> <ul class='toc'> <li class='tocline4'><a class='tocxref' href='#ID-C74D1578'>1.2.1 The DOMString Type</a> <ul> <li class='tocline5'><a href='#DOMString'>DOMString</a></ul> <li class='tocline4'><a class='tocxref' href='#Core-DOMTimeStamp'>1.2.2 The DOMTimeStamp Type</a> <ul> <li class='tocline5'><a href='#DOMTimeStamp'>DOMTimeStamp</a></ul> <li class='tocline4'><a class='tocxref' href='#Core-DOMUserData'>1.2.3 The DOMUserData Type</a> <ul> <li class='tocline5'><a href='#DOMUserData'>DOMUserData</a></ul> <li class='tocline4'><a class='tocxref' href='#Core-DOMObject'>1.2.4 The DOMObject Type</a> <ul> <li class='tocline5'><a href='#DOMObject'>DOMObject</a></ul> </ul></li> <li class='tocline3'><a class='tocxref' href='#Consideration'>1.3 General Considerations</a> <ul class='toc'> <li class='tocline4'><a class='tocxref' href='#ID-5DFED1F0'>1.3.1 String Comparisons in the DOM</a> <li class='tocline4'><a class='tocxref' href='#domURIs'>1.3.2 DOM URIs</a> <li class='tocline4'><a class='tocxref' href='#Namespaces-Considerations'>1.3.3 XML Namespaces</a> <li class='tocline4'><a class='tocxref' href='#baseURIs-Considerations'>1.3.4 Base URIs</a> <li class='tocline4'><a class='tocxref' href='#Embedded-DOM'>1.3.5 Mixed DOM Implementations</a> <li class='tocline4'><a class='tocxref' href='#DOMFeatures'>1.3.6 DOM Features</a> <li class='tocline4'><a class='tocxref' href='#Bootstrap'>1.3.7 Bootstrapping</a> </ul></li> <li class='tocline3'><a class='tocxref' href='#ID-BBACDC08'>1.4 Fundamental Interfaces: Core Module</a> <ul class='toc'> <li class='tocline4'><a href='#ID-17189187'>DOMException</a>, <a href='#ID-258A00AF'>ExceptionCode</a>, <a href='#DOMStringList'>DOMStringList</a>, <a href='#NameList'>NameList</a>, <a href='#DOMImplementationList'>DOMImplementationList</a>, <a href='#DOMImplementationSource'>DOMImplementationSource</a>, <a href='#ID-102161490'>DOMImplementation</a>, <a href='#ID-B63ED1A3'>DocumentFragment</a>, <a href='#i-Document'>Document</a>, <a href='#ID-1950641247'>Node</a>, <a href='#ID-536297177'>NodeList</a>, <a href='#ID-1780488922'>NamedNodeMap</a>, <a href='#ID-FF21A306'>CharacterData</a>, <a href='#ID-637646024'>Attr</a>, <a href='#ID-745549614'>Element</a>, <a href='#ID-1312295772'>Text</a>, <a href='#ID-1728279322'>Comment</a>, <a href='#TypeInfo'>TypeInfo</a>, <a href='#UserDataHandler'>UserDataHandler</a>, <a href='#ERROR-Interfaces-DOMError'>DOMError</a>, <a href='#ERROR-Interfaces-DOMErrorHandler'>DOMErrorHandler</a>, <a href='#Interfaces-DOMLocator'>DOMLocator</a>, <a href='#DOMConfiguration'>DOMConfiguration</a></ul></li> <li class='tocline3'><a class='tocxref' href='#ID-E067D597'>1.5 Extended Interfaces: XML Module</a> <ul class='toc'> <li class='tocline4'><a href='#ID-667469212'>CDATASection</a>, <a href='#ID-412266927'>DocumentType</a>, <a href='#ID-5431D1B9'>Notation</a>, <a href='#ID-527DCFF2'>Entity</a>, <a href='#ID-11C98490'>EntityReference</a>, <a href='#ID-1004215813'>ProcessingInstruction</a></ul></li> </ul> </div> <p class='first'> This specification defines a set of objects and interfaces for accessing and manipulating document objects. The functionality specified (the <em>Core</em> functionality) is sufficient to allow software developers and Web script authors to access and manipulate parsed HTML [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>] and XML [<cite><a class='noxref informative' href='references.html#XML'>XML 1.0</a></cite>] content inside conforming products. The DOM Core <a href='glossary.html#dt-API'>API</a> also allows creation and population of a <a href='core.html#i-Document'><code>Document</code></a> object using only DOM API calls. A solution for loading a <a class='noxref' href='core.html#i-Document'><code>Document</code></a> and saving it persistently is proposed in [<cite><a class='noxref informative' href='references.html#DOMLS'>DOM Level 3 Load and Save</a></cite>]. </p> <div class='div2'><a name='ID-1590626201'></a> <h2 id='ID-1590626201-h2' class='div2'>1.1 Overview of the DOM Core Interfaces</h2> <div class='div3'><a name='ID-1590626202'></a> <h3 id='ID-1590626202-h3' class='div3'>1.1.1 The DOM Structure Model</h3><p>The DOM presents documents as a hierarchy of <a href='core.html#ID-1950641247'><code>Node</code></a> objects that also implement other, more specialized interfaces. Some types of nodes may have <a href='glossary.html#dt-child'>child</a> nodes of various types, and others are leaf nodes that cannot have anything below them in the document structure. For XML and HTML, the node types, and which node types they may have as children, are as follows: <ul> <li> <a href='core.html#i-Document'><code>Document</code></a> -- <a href='core.html#ID-745549614'><code>Element</code></a> (maximum of one), <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-412266927'><code>DocumentType</code></a> (maximum of one) </li> <li> <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> -- <a href='core.html#ID-745549614'><code>Element</code></a>, <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-667469212'><code>CDATASection</code></a>, <a href='core.html#ID-11C98490'><code>EntityReference</code></a> </li> <li> <a href='core.html#ID-412266927'><code>DocumentType</code></a> -- no children</li> <li> <a href='core.html#ID-11C98490'><code>EntityReference</code></a> -- <a href='core.html#ID-745549614'><code>Element</code></a>, <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-667469212'><code>CDATASection</code></a>, <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> </li> <li> <a href='core.html#ID-745549614'><code>Element</code></a> -- <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a>, <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>, <a href='core.html#ID-667469212'><code>CDATASection</code></a>, <a href='core.html#ID-11C98490'><code>EntityReference</code></a></li> <li> <a href='core.html#ID-637646024'><code>Attr</code></a> -- <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-11C98490'><code>EntityReference</code></a></li> <li> <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a> -- no children</li> <li> <a href='core.html#ID-1728279322'><code>Comment</code></a> -- no children</li> <li> <a href='core.html#ID-1312295772'><code>Text</code></a> -- no children</li> <li> <a href='core.html#ID-667469212'><code>CDATASection</code></a> -- no children</li> <li> <a href='core.html#ID-527DCFF2'><code>Entity</code></a> -- <a href='core.html#ID-745549614'><code>Element</code></a>, <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-667469212'><code>CDATASection</code></a>, <a href='core.html#ID-11C98490'><code>EntityReference</code></a></li> <li> <a href='core.html#ID-5431D1B9'><code>Notation</code></a> -- no children</li> </ul> <p>The DOM also specifies a <a href='core.html#ID-536297177'><code>NodeList</code></a> interface to handle ordered lists of <a href='core.html#ID-1950641247'><code>Nodes</code></a>, such as the children of a <a href='core.html#ID-1950641247'><code>Node</code></a>, or the <a href='glossary.html#dt-element'>elements</a> returned by the <a href='core.html#ID-A6C90942'><code>Element.getElementsByTagNameNS(namespaceURI, localName)</code></a> method, and also a <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> interface to handle unordered sets of nodes referenced by their name attribute, such as the attributes of an <a href='core.html#ID-745549614'><code>Element</code></a>. <a name='td-live'></a> <a href='core.html#ID-536297177'><code>NodeList</code></a> and <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> objects in the DOM are <i>live</i>; that is, changes to the underlying document structure are reflected in all relevant <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> and <a class='noxref' href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> objects. For example, if a DOM user gets a <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> object containing the children of an <a href='core.html#ID-745549614'><code>Element</code></a>, then subsequently adds more children to that <a href='glossary.html#dt-element'>element</a> (or removes children, or modifies them), those changes are automatically reflected in the <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a>, without further action on the user's part. Likewise, changes to a <a href='core.html#ID-1950641247'><code>Node</code></a> in the tree are reflected in all references to that <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> in <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> and <a class='noxref' href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> objects.<p>Finally, the interfaces <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, and <a href='core.html#ID-667469212'><code>CDATASection</code></a> all inherit from the <a href='core.html#ID-FF21A306'><code>CharacterData</code></a> interface.</div> <!-- div3 ID-1590626202 --> <div class='div3'><a name='ID-249F15BA'></a> <h3 id='ID-249F15BA-h3' class='div3'>1.1.2 Memory Management</h3><p>Most of the APIs defined by this specification are <em>interfaces</em> rather than classes. That means that an implementation need only expose methods with the defined names and specified operation, not implement classes that correspond directly to the interfaces. This allows the DOM APIs to be implemented as a thin veneer on top of legacy applications with their own data structures, or on top of newer applications with different class hierarchies. This also means that ordinary constructors (in the Java or C++ sense) cannot be used to create DOM objects, since the underlying objects to be constructed may have little relationship to the DOM interfaces. The conventional solution to this in object-oriented design is to define <em>factory</em> methods that create instances of objects that implement the various interfaces. Objects implementing some interface "X" are created by a "createX()" method on the <a href='core.html#i-Document'><code>Document</code></a> interface; this is because all DOM objects live in the context of a specific Document.<p>The Core DOM APIs are designed to be compatible with a wide range of languages, including both general-user scripting languages and the more challenging languages used mostly by professional programmers. Thus, the DOM APIs need to operate across a variety of memory management philosophies, from language bindings that do not expose memory management to the user at all, through those (notably Java) that provide explicit constructors but provide an automatic garbage collection mechanism to automatically reclaim unused memory, to those (especially C/C++) that generally require the programmer to explicitly allocate object memory, track where it is used, and explicitly free it for re-use. To ensure a consistent API across these platforms, the DOM does not address memory management issues at all, but instead leaves these for the implementation. Neither of the explicit language bindings defined by the DOM API (for <a href='glossary.html#dt-ECMAScript'>ECMAScript</a> and Java) require any memory management methods, but DOM bindings for other languages (especially C or C++) may require such support. These extensions will be the responsibility of those adapting the DOM API to a specific language, not the DOM Working Group.</div> <!-- div3 ID-249F15BA --> <div class='div3'><a name='ID-45A944CB'></a> <h3 id='ID-45A944CB-h3' class='div3'>1.1.3 Naming Conventions</h3><p>While it would be nice to have attribute and method names that are short, informative, internally consistent, and familiar to users of similar APIs, the names also should not clash with the names in legacy APIs supported by DOM implementations. Furthermore, both OMG IDL [<cite><a class='noxref informative' href='references.html#OMGIDL'>OMG IDL</a></cite>] and ECMAScript [<cite><a class='noxref informative' href='references.html#ECMAScript'>ECMAScript</a></cite>] have significant limitations in their ability to disambiguate names from different namespaces that make it difficult to avoid naming conflicts with short, familiar names. So, DOM names tend to be long and descriptive in order to be unique across all environments.<p>The Working Group has also attempted to be internally consistent in its use of various terms, even though these may not be common distinctions in other APIs. For example, the DOM API uses the method name "remove" when the method changes the structural model, and the method name "delete" when the method gets rid of something inside the structure model. The thing that is deleted is not returned. The thing that is removed may be returned, when it makes sense to return it.</div> <!-- div3 ID-45A944CB --> <div class='div3'><a name='ID-1CED5498'></a> <h3 id='ID-1CED5498-h3' class='div3'>1.1.4 Inheritance vs. Flattened Views of the API</h3><p>The DOM Core <a href='glossary.html#dt-API'>APIs</a> present two somewhat different sets of interfaces to an XML/HTML document: one presenting an "object oriented" approach with a hierarchy of <a href='glossary.html#dt-inheritance'>inheritance</a>, and a "simplified" view that allows all manipulation to be done via the <a href='core.html#ID-1950641247'><code>Node</code></a> interface without requiring casts (in Java and other C-like languages) or query interface calls in <a href='glossary.html#dt-COM'>COM</a> environments. These operations are fairly expensive in Java and COM, and the DOM may be used in performance-critical environments, so we allow significant functionality using just the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface. Because many other users will find the <a href='glossary.html#dt-inheritance'>inheritance</a> hierarchy easier to understand than the "everything is a <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a>" approach to the DOM, we also support the full higher-level interfaces for those who prefer a more object-oriented <a href='glossary.html#dt-API'>API</a>. <p>In practice, this means that there is a certain amount of redundancy in the <a href='glossary.html#dt-API'>API</a>. The Working Group considers the "<a href='glossary.html#dt-inheritance'>inheritance</a>" approach the primary view of the API, and the full set of functionality on <a href='core.html#ID-1950641247'><code>Node</code></a> to be "extra" functionality that users may employ, but that does not eliminate the need for methods on other interfaces that an object-oriented analysis would dictate. (Of course, when the O-O analysis yields an attribute or method that is identical to one on the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface, we don't specify a completely redundant one.) Thus, even though there is a generic <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a> attribute on the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface, there is still a <a href='core.html#ID-104682815'><code>Element.tagName</code></a> attribute on the <a href='core.html#ID-745549614'><code>Element</code></a> interface; these two attributes must contain the same value, but the it is worthwhile to support both, given the different constituencies the DOM <a href='glossary.html#dt-API'>API</a> must satisfy.</div> <!-- div3 ID-1CED5498 --></div> <!-- div2 ID-1590626201 --> <div class='div2'><a name='BasicTypes'></a> <h2 id='BasicTypes-h2' class='div2'>1.2 Basic Types</h2><p> To ensure interoperability, this specification specifies the following basic types used in various DOM modules. Even though the DOM uses the basic types in the interfaces, bindings may use different types and normative bindings are only given for Java and ECMAScript in this specification. <div class='div3'><a name='ID-C74D1578'></a> <h3 id='ID-C74D1578-h3' class='div3'>1.2.1 The <a href='core.html#DOMString'><code>DOMString</code></a> Type</h3><p> The <a href='core.html#DOMString'><code>DOMString</code></a> type is used to store [<cite><a class='noxref normative' href='references.html#Unicode'>Unicode</a></cite>] characters as a sequence of <a href='glossary.html#dt-16-bit-unit'>16-bit units</a> using UTF-16 as defined in [<cite><a class='noxref normative' href='references.html#Unicode'>Unicode</a></cite>] and Amendment 1 of [<cite><a class='noxref normative' href='references.html#ISO10646'>ISO/IEC 10646</a></cite>]. <p> Characters are <a class='normative' href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully normalized</a> as defined in appendix B of [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>] if: <ul> <li> the parameter "<a href='core.html#parameter-normalize-characters'>normalize-characters</a>" was set to <code>true</code> while loading the document or the document was certified as defined in [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>]; </li> <li> the parameter "<a href='core.html#parameter-normalize-characters'>normalize-characters</a>" was set to <code>true</code> while using the method <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, or while using the method <a href='core.html#ID-normalize'><code>Node.normalize()</code></a>; </li> </ul> <p> Note that, with the exceptions of <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> and <a href='core.html#ID-normalize'><code>Node.normalize()</code></a>, manipulating characters using DOM methods does not guarantee to preserve a <i>fully-normalized</i> text. <dl><dt><b>Type Definition <i><a name='DOMString'>DOMString</a></i></b></dt><dd> <p>A <a href='core.html#DOMString'><code>DOMString</code></a> is a sequence of <a href='glossary.html#dt-16-bit-unit'>16-bit units</a>. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> valuetype <a class='noxref' href='core.html#DOMString'>DOMString</a> sequence<unsigned short>; </pre> </div><br> </dd></dl> </dd></dl> <p></p><p>The UTF-16 encoding was chosen because of its widespread industry practice. Note that for both HTML and XML, the document character set (and therefore the notation of numeric character references) is based on UCS [<cite><a class='noxref normative' href='references.html#ISO10646'>ISO/IEC 10646</a></cite>]. A single numeric character reference in a source document may therefore in some cases correspond to two 16-bit units in a <a href='core.html#DOMString'><code>DOMString</code></a> (a high surrogate and a low surrogate). For issues related to string comparisons, refer to <a href='core.html#ID-5DFED1F0'>String Comparisons in the DOM</a>.</p><p> For Java and ECMAScript, <a href='core.html#DOMString'><code>DOMString</code></a> is bound to the <code>String</code> type because both languages also use UTF-16 as their encoding. </p><p><b>Note:</b> As of August 2000, the OMG IDL specification ([<cite><a class='noxref normative' href='references.html#OMGIDL'>OMG IDL</a></cite>]) included a <code>wstring</code> type. However, that definition did not meet the interoperability criteria of the DOM <a href='glossary.html#dt-API'>API</a> since it relied on negotiation to decide the width and encoding of a character.</p> </div> <!-- div3 ID-C74D1578 --> <div class='div3'><a name='Core-DOMTimeStamp'></a> <h3 id='Core-DOMTimeStamp-h3' class='div3'>1.2.2 The <a href='core.html#DOMTimeStamp'><code>DOMTimeStamp</code></a> Type</h3><p> The <a href='core.html#DOMTimeStamp'><code>DOMTimeStamp</code></a> type is used to store an absolute or relative time. <dl><dt><b>Type Definition <i><a name='DOMTimeStamp'>DOMTimeStamp</a></i></b></dt><dd> <p>A <a href='core.html#DOMTimeStamp'><code>DOMTimeStamp</code></a> represents a number of milliseconds. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> typedef unsigned long long <a class='noxref' href='core.html#DOMTimeStamp'>DOMTimeStamp</a>; </pre> </div><br> </dd></dl> </dd></dl> <p> For Java, <a href='core.html#DOMTimeStamp'><code>DOMTimeStamp</code></a> is bound to the <code>long</code> type. For ECMAScript, <a class='noxref' href='core.html#DOMTimeStamp'><code>DOMTimeStamp</code></a> is bound to the <code>Date</code> type because the range of the <code>integer</code> type is too small. </p></div> <!-- div3 Core-DOMTimeStamp --> <div class='div3'><a name='Core-DOMUserData'></a> <h3 id='Core-DOMUserData-h3' class='div3'>1.2.3 The <a href='core.html#DOMUserData'><code>DOMUserData</code></a> Type</h3><p> The <a href='core.html#DOMUserData'><code>DOMUserData</code></a> type is used to store application data. <dl><dt><b>Type Definition <i><a name='DOMUserData'>DOMUserData</a></i></b></dt><dd> <p>A <a href='core.html#DOMUserData'><code>DOMUserData</code></a> represents a reference to application data. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> typedef any <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a>; </pre> </div><br> </dd></dl> </dd></dl> <p> For Java, <a href='core.html#DOMUserData'><code>DOMUserData</code></a> is bound to the <code>Object</code> type. For ECMAScript, <a class='noxref' href='core.html#DOMUserData'><code>DOMUserData</code></a> is bound to <code>any type</code>. </p></div> <!-- div3 Core-DOMUserData --> <div class='div3'><a name='Core-DOMObject'></a> <h3 id='Core-DOMObject-h3' class='div3'>1.2.4 The <a href='core.html#DOMObject'><code>DOMObject</code></a> Type</h3><p> The <a href='core.html#DOMObject'><code>DOMObject</code></a> type is used to represent an object. <dl><dt><b>Type Definition <i><a name='DOMObject'>DOMObject</a></i></b></dt><dd> <p>A <a href='core.html#DOMObject'><code>DOMObject</code></a> represents an object reference. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> typedef Object <a class='noxref' href='core.html#DOMObject'>DOMObject</a>; </pre> </div><br> </dd></dl> </dd></dl> <p> For Java and ECMAScript, <a href='core.html#DOMObject'><code>DOMObject</code></a> is bound to the <code>Object</code> type. </p></div> <!-- div3 Core-DOMObject --></div> <!-- div2 BasicTypes --> <div class='div2'><a name='Consideration'></a> <h2 id='Consideration-h2' class='div2'>1.3 General Considerations</h2> <div class='div3'><a name='ID-5DFED1F0'></a> <h3 id='ID-5DFED1F0-h3' class='div3'>1.3.1 String Comparisons in the DOM</h3><p>The DOM has many interfaces that imply string matching. For XML, string comparisons are case-sensitive and performed with a binary <a href='glossary.html#dt-string-compare'>comparison</a> of the <a href='glossary.html#dt-16-bit-unit'>16-bit units</a> of the <a href='core.html#DOMString'><code>DOMStrings</code></a>. However, for case-insensitive markup languages, such as HTML 4.01 or earlier, these comparisons are case-insensitive where appropriate.<p>Note that HTML processors often perform specific case normalizations (canonicalization) of the markup before the DOM structures are built. This is typically using uppercase for <a href='glossary.html#dt-element'>element</a> names and lowercase for attribute names. For this reason, applications should also compare element and attribute names returned by the DOM implementation in a case-insensitive manner.<p> The character normalization, i.e. transforming into their <a class='normative' href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully normalized</a> form as as defined in [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>], is assumed to happen at serialization time. The DOM Level 3 Load and Save module [<cite><a class='noxref informative' href='references.html#DOMLS'>DOM Level 3 Load and Save</a></cite>] provides a serialization mechanism (see the <code>DOMSerializer</code> interface, section 2.3.1) and uses the <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a> parameters "<a href='core.html#parameter-normalize-characters'>normalize-characters</a>" and "<a href='core.html#parameter-check-character-normalization'>check-character-normalization</a>" to assure that text is <a class='normative' href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully normalized</a> [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>]. Other serialization mechanisms built on top of the DOM Level 3 Core also have to assure that text is <i>fully normalized</i>. </div> <!-- div3 ID-5DFED1F0 --> <div class='div3'><a name='domURIs'></a> <h3 id='domURIs-h3' class='div3'>1.3.2 DOM URIs</h3><p> The DOM specification relies on <a href='core.html#DOMString'><code>DOMString</code></a> values as resource identifiers, such that the following conditions are met: <ol> <li> An absolute identifier absolutely identifies a resource on the Web; </li> <li> Simple string equality establishes equality of absolute resource identifiers, and no other equivalence of resource identifiers is considered significant to the DOM specification; </li> <li> A relative identifier is easily detected and made absolute relative to an absolute identifier; </li> <li> Retrieval of content of a resource may be accomplished where required. </li> </ol> <p> The term "<i>absolute URI</i>" refers to a complete resource identifier and the term "<i>relative URI</i>" refers to an incomplete resource identifier. <p> Within the DOM specifications, these identifiers are called URIs, "Uniform Resource Identifiers", but this is meant abstractly. The DOM implementation does not necessarily process its URIs according to the URI specification [<cite><a class='noxref informative' href='references.html#URIRef'>IETF RFC 2396</a></cite>]. Generally the particular form of these identifiers must be ignored. <p> When is not possible to completely ignore the type of a DOM URI, either because a relative identifier must be made absolute or because content must be retrieved, the DOM implementation must at least support identifier types appropriate to the content being processed. [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>], [<cite><a class='noxref informative' href='references.html#XML'>XML 1.0</a></cite>], and associated namespace specification [<cite><a class='noxref informative' href='references.html#Namespaces'>XML Namespaces</a></cite>] rely on [<cite><a class='noxref informative' href='references.html#URIRef'>IETF RFC 2396</a></cite>] to determine permissible characters and resolving relative URIs. Other specifications such as namespaces in XML 1.1 [<cite><a class='noxref informative' href='references.html#Namespaces11'>XML Namespaces 1.1</a></cite>] may rely on alternative resource identifier types that may, for example, include non-ASCII characters, necessitating support for alternative resource identifier types where required by applicable specifications. </div> <!-- div3 domURIs --> <div class='div3'><a name='Namespaces-Considerations'></a> <h3 id='Namespaces-Considerations-h3' class='div3'>1.3.3 XML Namespaces</h3><p> DOM Level 2 and 3 support XML namespaces [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>] by augmenting several interfaces of the DOM Level 1 Core to allow creating and manipulating <a href='glossary.html#dt-element'>elements</a> and attributes associated to a namespace. When [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>] is in use (see <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a>), DOM Level 3 also supports [<cite><a class='noxref normative' href='references.html#Namespaces11'>XML Namespaces 1.1</a></cite>]. <p>As far as the DOM is concerned, special attributes used for declaring XML namespaces are still exposed and can be manipulated just like any other attribute. However, nodes are permanently bound to <a href='glossary.html#dt-namespaceURI'>namespace URIs</a> as they get created. Consequently, moving a node within a document, using the DOM, in no case results in a change of its <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a> or namespace URI. Similarly, creating a node with a namespace prefix and namespace URI, or changing the namespace prefix of a node, does not result in any addition, removal, or modification of any special attributes for declaring the appropriate XML namespaces. Namespace validation is not enforced; the DOM application is responsible. In particular, since the mapping between prefixes and namespace URIs is not enforced, in general, the resulting document cannot be serialized naively. For example, applications may have to declare every namespace in use when serializing a document.<p>In general, the DOM implementation (and higher) doesn't perform any URI normalization or canonicalization. The URIs given to the DOM are assumed to be valid (e.g., characters such as white spaces are properly escaped), and no lexical checking is performed. Absolute URI references are treated as strings and <a href='glossary.html#dt-string-compare'>compared literally</a>. How relative namespace URI references are treated is undefined. To ensure interoperability only absolute namespace URI references (i.e., URI references beginning with a scheme name and a colon) should be used. Applications should use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace. In programming languages where empty strings can be differentiated from null, empty strings, when given as a namespace URI, are converted to <code>null</code>. This is true even though the DOM does no lexical checking of URIs.<p><b>Note:</b> <a href='core.html#ID-ElSetAttrNS'><code>Element.setAttributeNS(null, ...)</code></a> puts the attribute in the <i>per-element-type partitions</i> as defined in <a class='normative' href='http://www.w3.org/TR/1999/REC-xml-names-19990114'><em>XML Namespace Partitions</em></a> in [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>]. </p> <p><b>Note:</b> In the DOM, all namespace declaration attributes are <em>by definition</em> bound to the namespace URI: "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>". These are the attributes whose <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a> or <a href='glossary.html#dt-qualifiedname'>qualified name</a> is "xmlns" as introduced in [<cite><a class='noxref normative' href='references.html#Namespaces11'>XML Namespaces 1.1</a></cite>].</p> <p>In a document with no namespaces, the <a href='glossary.html#dt-child'>child</a> list of an <a href='core.html#ID-11C98490'><code>EntityReference</code></a> node is always the same as that of the corresponding <a href='core.html#ID-527DCFF2'><code>Entity</code></a>. This is not true in a document where an entity contains unbound <a href='glossary.html#dt-namespaceprefix'>namespace prefixes</a>. In such a case, the <a href='glossary.html#dt-descendant'>descendants</a> of the corresponding <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes may be bound to different <a href='glossary.html#dt-namespaceURI'>namespace URIs</a>, depending on where the entity references are. Also, because, in the DOM, nodes always remain bound to the same namespace URI, moving such <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes can lead to documents that cannot be serialized. This is also true when the DOM Level 1 method <a href='core.html#ID-392B75AE'><code>Document.createEntityReference(name)</code></a> is used to create entity references that correspond to such entities, since the <a href='glossary.html#dt-descendant'>descendants</a> of the returned <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> are unbound. While DOM Level 3 does have support for the resolution of namespace prefixes, use of such entities and entity references should be avoided or used with extreme care.<p>The "NS" methods, such as <a href='core.html#ID-DocCrElNS'><code>Document.createElementNS(namespaceURI, qualifiedName)</code></a> and <a href='core.html#ID-DocCrAttrNS'><code>Document.createAttributeNS(namespaceURI, qualifiedName)</code></a>, are meant to be used by namespace aware applications. Simple applications that do not use namespaces can use the DOM Level 1 methods, such as <a href='core.html#ID-2141741547'><code>Document.createElement(tagName)</code></a> and <a href='core.html#ID-1084891198'><code>Document.createAttribute(name)</code></a>. Elements and attributes created in this way do not have any namespace prefix, namespace URI, or local name.<p><b>Note:</b> DOM Level 1 methods are namespace ignorant. Therefore, while it is safe to use these methods when not dealing with namespaces, using them and the new ones at the same time should be avoided. DOM Level 1 methods solely identify attribute nodes by their <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a>. On the contrary, the DOM Level 2 methods related to namespaces, identify attribute nodes by their <a href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a> and <a href='core.html#ID-NodeNSLocalN'><code>Node.localName</code></a>. Because of this fundamental difference, mixing both sets of methods can lead to unpredictable results. In particular, using <a href='core.html#ID-ElSetAttrNS'><code>Element.setAttributeNS(namespaceURI, qualifiedName, value)</code></a>, an <a href='glossary.html#dt-element'>element</a> may have two attributes (or more) that have the same <a class='noxref' href='core.html#ID-F68D095'><code>Node.nodeName</code></a>, but different <a class='noxref' href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a>s. Calling <a href='core.html#ID-666EE0F9'><code>Element.getAttribute(name)</code></a> with that <code>nodeName</code> could then return any of those attributes. The result depends on the implementation. Similarly, using <a href='core.html#ID-887236154'><code>Element.setAttributeNode(newAttr)</code></a>, one can set two attributes (or more) that have different <a class='noxref' href='core.html#ID-F68D095'><code>Node.nodeName</code></a>s but the same <a href='core.html#ID-NodeNSPrefix'><code>Node.prefix</code></a> and <a class='noxref' href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a>. In this case <a href='core.html#ID-ElGetAtNodeNS'><code>Element.getAttributeNodeNS(namespaceURI, localName)</code></a> will return either attribute, in an implementation dependent manner. The only guarantee in such cases is that all methods that access a named item by its <code>nodeName</code> will access the same item, and all methods which access a node by its URI and local name will access the same node. For instance, <a href='core.html#ID-F68F082'><code>Element.setAttribute(name, value)</code></a> and <a href='core.html#ID-ElSetAttrNS'><code>Element.setAttributeNS(namespaceURI, qualifiedName, value)</code></a> affect the node that <a href='core.html#ID-666EE0F9'><code>Element.getAttribute(name)</code></a> and <a href='core.html#ID-ElGetAttrNS'><code>Element.getAttributeNS(namespaceURI, localName)</code></a>, respectively, return.</p> </div> <!-- div3 Namespaces-Considerations --> <div class='div3'><a name='baseURIs-Considerations'></a> <h3 id='baseURIs-Considerations-h3' class='div3'>1.3.4 Base URIs</h3><p>The DOM Level 3 adds support for the <b>[base URI]</b> property defined in [<cite><a class='noxref normative' href='references.html#InfoSet'>XML Information Set</a></cite>] by providing a new attribute on the <a href='core.html#ID-1950641247'><code>Node</code></a> interface that exposes this information. However, unlike the <a href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a> attribute, the <a href='core.html#Node3-baseURI'><code>Node.baseURI</code></a> attribute is not a static piece of information that every node carries. Instead, it is a value that is dynamically computed according to [<cite><a class='noxref normative' href='references.html#XMLBase'>XML Base</a></cite>]. This means its value depends on the location of the node in the tree and moving the node from one place to another in the tree may affect its value. Other changes, such as adding or changing an <code>xml:base</code> attribute on the node being queried or one of its ancestors may also affect its value. <p>One consequence of this it that when external entity references are expanded while building a <a href='core.html#i-Document'><code>Document</code></a> one may need to add, or change, an xml:base attribute to the <a href='core.html#ID-745549614'><code>Element</code></a> nodes originally contained in the entity being expanded so that the <a href='core.html#Node3-baseURI'><code>Node.baseURI</code></a> returns the correct value. In the case of <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a> nodes originally contained in the entity being expanded the information is lost. [<cite><a class='noxref informative' href='references.html#DOMLS'>DOM Level 3 Load and Save</a></cite>] handles elements as described here and generates a warning in the latter case. </div> <!-- div3 baseURIs-Considerations --> <div class='div3'><a name='Embedded-DOM'></a> <h3 id='Embedded-DOM-h3' class='div3'>1.3.5 Mixed DOM Implementations</h3><p>As new XML vocabularies are developed, those defining the vocabularies are also beginning to define specialized APIs for manipulating XML instances of those vocabularies. This is usually done by extending the DOM to provide interfaces and methods that perform operations frequently needed by their users. For example, the MathML [<cite><a class='noxref informative' href='references.html#MathML2'>MathML 2.0</a></cite>] and SVG [<cite><a class='noxref informative' href='references.html#SVG1'>SVG 1.1</a></cite>] specifications have developed DOM extensions to allow users to manipulate instances of these vocabularies using semantics appropriate to images and mathematics, respectively, as well as the generic DOM XML semantics. Instances of SVG or MathML are often embedded in XML documents conforming to a different schema such as XHTML. <p> While the Namespaces in XML specification [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>] provides a mechanism for integrating these documents at the syntax level, it has become clear that the DOM Level 2 Recommendation [<cite><a class='noxref informative' href='references.html#DOM2Core'>DOM Level 2 Core</a></cite>] is not rich enough to cover all the issues that have been encountered in having these different DOM implementations be used together in a single application. DOM Level 3 deals with the requirements brought about by embedding fragments written according to a specific markup language (the embedded component) in a document where the rest of the markup is not written according to that specific markup language (the host document). It does not deal with fragments embedded by reference or linking.<p>A DOM implementation supporting DOM Level 3 Core should be able to collaborate with subcomponents implementing specific DOMs to assemble a compound document that can be traversed and manipulated via DOM interfaces as if it were a seamless whole.<p>The normal typecast operation on an object should support the interfaces expected by legacy code for a given document type. Typecasting techniques may not be adequate for selecting between multiple DOM specializations of an object which were combined at run time, because they may not all be part of the same object as defined by the binding's object model. Conflicts are most obvious with the <a href='core.html#i-Document'><code>Document</code></a> object, since it is shared as owner by the rest of the document. In a homogeneous document, elements rely on the Document for specialized services and construction of specialized nodes. In a heterogeneous document, elements from different modules expect different services and APIs from the same <a class='noxref' href='core.html#i-Document'><code>Document</code></a> object, since there can only be one owner and root of the document hierarchy.</div> <!-- div3 Embedded-DOM --> <div class='div3'><a name='DOMFeatures'></a> <h3 id='DOMFeatures-h3' class='div3'>1.3.6 DOM Features</h3><p> Each DOM module defines one or more features, as listed in the conformance section (<a href='introduction.html#ID-Conformance'>Conformance</a>). Features are case-insensitive and are also defined for a specific set of versions. For example, this specification defines the features <code>"Core"</code> and <code>"XML"</code>, for the version <code>"3.0"</code>. Versions <code>"1.0"</code> and <code>"2.0"</code> can also be used for features defined in the corresponding DOM Levels. To avoid possible conflicts, as a convention, names referring to features defined outside the DOM specification should be made unique. Applications could then request for features to be supported by a DOM implementation using the methods <a href='core.html#ID-getDOMImpl'><code>DOMImplementationSource.getDOMImplementation(features)</code></a> or <a href='core.html#ID-getDOMImpls'><code>DOMImplementationSource.getDOMImplementationList(features)</code></a>, check the features supported by a DOM implementation using the method <a href='core.html#ID-5CED94D7'><code>DOMImplementation.hasFeature(feature, version)</code></a>, or by a specific node using <a href='core.html#Level-2-Core-Node-supports'><code>Node.isSupported(feature, version)</code></a>. Note that when using the methods that take a feature and a version as parameters, applications can use <code>null</code> or empty string for the version parameter if they don't wish to specify a particular version for the specified feature. <p> Up to the DOM Level 2 modules, all interfaces, that were an extension of existing ones, were accessible using binding-specific casting mechanisms if the feature associated to the extension was supported. For example, an instance of the <code>EventTarget</code> interface could be obtained from an instance of the <a href='core.html#ID-1950641247'><code>Node</code></a> interface if the feature "Events" was supported by the node. <p> As discussed <a href='core.html#Embedded-DOM'>Mixed DOM Implementations</a>, DOM Level 3 Core should be able to collaborate with subcomponents implementing specific DOMs. For that effect, the methods <a href='core.html#DOMImplementation3-getFeature'><code>DOMImplementation.getFeature(feature, version)</code></a> and <a href='core.html#Node3-getFeature'><code>Node.getFeature(feature, version)</code></a> were introduced. In the case of <a href='core.html#ID-5CED94D7'><code>DOMImplementation.hasFeature(feature, version)</code></a> and <a href='core.html#Level-2-Core-Node-supports'><code>Node.isSupported(feature, version)</code></a>, if a plus sign "+" is prepended to any feature name, implementations are considered in which the specified feature may not be directly castable but would require discovery through <a href='core.html#DOMImplementation3-getFeature'><code>DOMImplementation.getFeature(feature, version)</code></a> and <a href='core.html#Node3-getFeature'><code>Node.getFeature(feature, version)</code></a>. Without a plus, only features whose interfaces are directly castable are considered. <div class='code-block'> <pre>// example 1, without prepending the "+" if (myNode.isSupported("Events", "3.0")) { EventTarget evt = (EventTarget) myNode; // ... } // example 2, with the "+" if (myNode.isSupported("+Events", "3.0")) { // (the plus sign "+" is irrelevant for the getFeature method itself // and is ignored by this method anyway) EventTarget evt = (EventTarget) myNode.getFeature("Events", "3.0"); // ... }</pre> </div></div> <!-- div3 DOMFeatures --> <div class='div3'><a name='Bootstrap'></a> <h3 id='Bootstrap-h3' class='div3'>1.3.7 Bootstrapping</h3><p>Because previous versions of the DOM specification only defined a set of interfaces, applications had to rely on some implementation dependent code to start from. However, hard-coding the application to a specific implementation prevents the application from running on other implementations and from using the most-suitable implementation of the environment. At the same time, implementations may also need to load modules or perform other setup to efficiently adapt to different and sometimes mutually-exclusive feature sets.<p>To solve these problems this specification introduces a <code>DOMImplementationRegistry</code> object with a function that lets an application find implementations, based on the specific features it requires. How this object is found and what it exactly looks like is not defined here, because this cannot be done in a language-independent manner. Instead, each language binding defines its own way of doing this. See <a href='java-binding.html#java-binding'>Java Language Binding</a> and <a href='ecma-script-binding.html#ecma-binding'>ECMAScript Language Binding</a> for specifics.<p>In all cases, though, the <code>DOMImplementationRegistry</code> provides a <code>getDOMImplementation</code> method accepting a features string, which is passed to every known <a href='core.html#DOMImplementationSource'><code>DOMImplementationSource</code></a> until a suitable <a href='core.html#ID-102161490'><code>DOMImplementation</code></a> is found and returned. The <code>DOMImplementationRegistry</code> also provides a <code>getDOMImplementationList</code> method accepting a features string, which is passed to every known <a class='noxref' href='core.html#DOMImplementationSource'><code>DOMImplementationSource</code></a>, and returns a list of suitable <a class='noxref' href='core.html#ID-102161490'><code>DOMImplementations</code></a>. Those two methods are the same as the ones found on the <a class='noxref' href='core.html#DOMImplementationSource'><code>DOMImplementationSource</code></a> interface. <p>Any number of <a href='core.html#DOMImplementationSource'><code>DOMImplementationSource</code></a> objects can be registered. A source may return one or more <a href='core.html#ID-102161490'><code>DOMImplementation</code></a> singletons or construct new <a class='noxref' href='core.html#ID-102161490'><code>DOMImplementation</code></a> objects, depending upon whether the requested features require specialized state in the <a class='noxref' href='core.html#ID-102161490'><code>DOMImplementation</code></a> object.</div> <!-- div3 Bootstrap --></div> <!-- div2 Consideration --> <div class='div2'><a name='ID-BBACDC08'></a> <h2 id='ID-BBACDC08-h2' class='div2'>1.4 Fundamental Interfaces: Core Module</h2><p>The interfaces within this section are considered <em>fundamental</em>, and must be fully implemented by all conforming implementations of the DOM, including all HTML DOM implementations [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>], unless otherwise specified. <p>A DOM application may use the <a href='core.html#ID-5CED94D7'><code>DOMImplementation.hasFeature(feature, version)</code></a> method with parameter values "Core" and "3.0" (respectively) to determine whether or not this module is supported by the implementation. Any implementation that conforms to DOM Level 3 or a DOM Level 3 module must conform to the Core module. Please refer to additional information about <a class='normative' href='http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance'><em>conformance</em></a> in this specification. The DOM Level 3 Core module is backward compatible with the DOM Level 2 Core [<cite><a class='noxref informative' href='references.html#DOM2Core'>DOM Level 2 Core</a></cite>] module, i.e. a DOM Level 3 Core implementation who returns <code>true</code> for "Core" with the <code>version</code> number <code>"3.0"</code> must also return <code>true</code> for this <code>feature</code> when the <code>version</code> number is <code>"2.0"</code>, <code>""</code> or, <code>null</code>. <dl><dt><b>Exception <i><a name='ID-17189187'>DOMException</a></i></b></dt> <dd> <p>DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when using <a href='core.html#ID-536297177'><code>NodeList</code></a>.<p>Implementations should raise other exceptions under other circumstances. For example, implementations should raise an implementation-dependent exception if a <code>null</code> argument is passed when <code>null</code> was not expected.<p>Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> exception <a class='noxref' href='core.html#ID-17189187'>DOMException</a> { unsigned short code; }; // ExceptionCode const unsigned short <a class='noxref' href='core.html#DOMException-INDEX_SIZE_ERR'>INDEX_SIZE_ERR</a> = 1; const unsigned short <a class='noxref' href='core.html#DOMException-DOMSTRING_SIZE_ERR'>DOMSTRING_SIZE_ERR</a> = 2; const unsigned short <a class='noxref' href='core.html#DOMException-HIERARCHY_REQUEST_ERR'>HIERARCHY_REQUEST_ERR</a> = 3; const unsigned short <a class='noxref' href='core.html#DOMException-WRONG_DOCUMENT_ERR'>WRONG_DOCUMENT_ERR</a> = 4; const unsigned short <a class='noxref' href='core.html#DOMException-INVALID_CHARACTER_ERR'>INVALID_CHARACTER_ERR</a> = 5; const unsigned short <a class='noxref' href='core.html#DOMException-NO_DATA_ALLOWED_ERR'>NO_DATA_ALLOWED_ERR</a> = 6; const unsigned short <a class='noxref' href='core.html#DOMException-NO_MODIFICATION_ALLOWED_ERR'>NO_MODIFICATION_ALLOWED_ERR</a> = 7; const unsigned short <a class='noxref' href='core.html#DOMException-NOT_FOUND_ERR'>NOT_FOUND_ERR</a> = 8; const unsigned short <a class='noxref' href='core.html#DOMException-NOT_SUPPORTED_ERR'>NOT_SUPPORTED_ERR</a> = 9; const unsigned short <a class='noxref' href='core.html#DOMException-INUSE_ATTRIBUTE_ERR'>INUSE_ATTRIBUTE_ERR</a> = 10; // Introduced in DOM Level 2: const unsigned short <a class='noxref' href='core.html#DOMException-INVALID_STATE_ERR'>INVALID_STATE_ERR</a> = 11; // Introduced in DOM Level 2: const unsigned short <a class='noxref' href='core.html#DOMException-SYNTAX_ERR'>SYNTAX_ERR</a> = 12; // Introduced in DOM Level 2: const unsigned short <a class='noxref' href='core.html#DOMException-INVALID_MODIFICATION_ERR'>INVALID_MODIFICATION_ERR</a> = 13; // Introduced in DOM Level 2: const unsigned short <a class='noxref' href='core.html#DOMException-NAMESPACE_ERR'>NAMESPACE_ERR</a> = 14; // Introduced in DOM Level 2: const unsigned short <a class='noxref' href='core.html#DOMException-INVALID_ACCESS_ERR'>INVALID_ACCESS_ERR</a> = 15; // Introduced in DOM Level 3: const unsigned short <a class='noxref' href='core.html#DOMException-VALIDATION_ERR'>VALIDATION_ERR</a> = 16; // Introduced in DOM Level 3: const unsigned short <a class='noxref' href='core.html#DOMException-TYPE_MISMATCH_ERR'>TYPE_MISMATCH_ERR</a> = 17; </pre> </div><br> </dd> <dt><b>Definition group <i><a name='ID-258A00AF'>ExceptionCode</a></i></b></dt> <dd><p>An integer indicating the type of error generated.<p><b>Note:</b> Other numeric codes are reserved for W3C for possible future use.</p> <dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='DOMException-DOMSTRING_SIZE_ERR'><code class='constant-name'>DOMSTRING_SIZE_ERR</code></a></dt><dd> If the specified range of text does not fit into a <a href='core.html#DOMString'><code>DOMString</code></a>.</dd> <dt><a name='DOMException-HIERARCHY_REQUEST_ERR'><code class='constant-name'>HIERARCHY_REQUEST_ERR</code></a></dt><dd> If any <a href='core.html#ID-1950641247'><code>Node</code></a> is inserted somewhere it doesn't belong.</dd> <dt><a name='DOMException-INDEX_SIZE_ERR'><code class='constant-name'>INDEX_SIZE_ERR</code></a></dt><dd> If index or size is negative, or greater than the allowed value.</dd> <dt><a name='DOMException-INUSE_ATTRIBUTE_ERR'><code class='constant-name'>INUSE_ATTRIBUTE_ERR</code></a></dt><dd> If an attempt is made to add an attribute that is already in use elsewhere.</dd> <dt><a name='DOMException-INVALID_ACCESS_ERR'><code class='constant-name'>INVALID_ACCESS_ERR</code></a>, introduced in <b class='version'>DOM Level 2</b>.</dt><dd> If a parameter or an operation is not supported by the underlying object.</dd> <dt><a name='DOMException-INVALID_CHARACTER_ERR'><code class='constant-name'>INVALID_CHARACTER_ERR</code></a></dt><dd> If an invalid or illegal character is specified, such as in an XML name.</dd> <dt><a name='DOMException-INVALID_MODIFICATION_ERR'><code class='constant-name'>INVALID_MODIFICATION_ERR</code></a>, introduced in <b class='version'>DOM Level 2</b>.</dt><dd> If an attempt is made to modify the type of the underlying object.</dd> <dt><a name='DOMException-INVALID_STATE_ERR'><code class='constant-name'>INVALID_STATE_ERR</code></a>, introduced in <b class='version'>DOM Level 2</b>.</dt><dd> If an attempt is made to use an object that is not, or is no longer, usable.</dd> <dt><a name='DOMException-NAMESPACE_ERR'><code class='constant-name'>NAMESPACE_ERR</code></a>, introduced in <b class='version'>DOM Level 2</b>.</dt><dd> If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.</dd> <dt><a name='DOMException-NOT_FOUND_ERR'><code class='constant-name'>NOT_FOUND_ERR</code></a></dt><dd> If an attempt is made to reference a <a href='core.html#ID-1950641247'><code>Node</code></a> in a context where it does not exist.</dd> <dt><a name='DOMException-NOT_SUPPORTED_ERR'><code class='constant-name'>NOT_SUPPORTED_ERR</code></a></dt><dd> If the implementation does not support the requested type of object or operation.</dd> <dt><a name='DOMException-NO_DATA_ALLOWED_ERR'><code class='constant-name'>NO_DATA_ALLOWED_ERR</code></a></dt><dd> If data is specified for a <a href='core.html#ID-1950641247'><code>Node</code></a> which does not support data.</dd> <dt><a name='DOMException-NO_MODIFICATION_ALLOWED_ERR'><code class='constant-name'>NO_MODIFICATION_ALLOWED_ERR</code></a></dt><dd> If an attempt is made to modify an object where modifications are not allowed.</dd> <dt><a name='DOMException-SYNTAX_ERR'><code class='constant-name'>SYNTAX_ERR</code></a>, introduced in <b class='version'>DOM Level 2</b>.</dt><dd> If an invalid or illegal string is specified.</dd> <dt><a name='DOMException-TYPE_MISMATCH_ERR'><code class='constant-name'>TYPE_MISMATCH_ERR</code></a>, introduced in <b class='version'>DOM Level 3</b>.</dt><dd> If the type of an object is incompatible with the expected type of the parameter associated to the object. </dd> <dt><a name='DOMException-VALIDATION_ERR'><code class='constant-name'>VALIDATION_ERR</code></a>, introduced in <b class='version'>DOM Level 3</b>.</dt><dd> If a call to a method such as <code>insertBefore</code> or <code>removeChild</code> would make the <a href='core.html#ID-1950641247'><code>Node</code></a> invalid with respect to <a href='glossary.html#dt-partially-valid'>"partial validity"</a>, this exception would be raised and the operation would not be done. This code is used in [<cite><a class='noxref informative' href='references.html#DOMVal'>DOM Level 3 Validation</a></cite>]. Refer to this specification for further information.</dd> <dt><a name='DOMException-WRONG_DOCUMENT_ERR'><code class='constant-name'>WRONG_DOCUMENT_ERR</code></a></dt><dd> If a <a href='core.html#ID-1950641247'><code>Node</code></a> is used in a different document than the one that created it (that doesn't support it).</dd> </dl> </dd></dl> </dd> </dl></dd> <dt><b>Interface <i><a name='DOMStringList'>DOMStringList</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> The <code>DOMStringList</code> interface provides the abstraction of an ordered collection of <a href='core.html#DOMString'><code>DOMString</code></a> values, without defining or constraining how this collection is implemented. The items in the <code>DOMStringList</code> are accessible via an integral index, starting from 0. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#DOMStringList'>DOMStringList</a> { <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#DOMStringList-item'>item</a>(in unsigned long index); readonly attribute unsigned long <a class='noxref' href='core.html#DOMStringList-length'>length</a>; boolean <a class='noxref' href='core.html#DOMStringList-contains'>contains</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> str); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='DOMStringList-length'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd>The number of <a href='core.html#DOMString'><code>DOMString</code></a>s in the list. The range of valid child node indices is 0 to <code>length-1</code> inclusive.<br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='DOMStringList-contains'>contains</a></code></dt> <dd> <div class='method'> Test if a string is part of this <code>DOMStringList</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>str</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The string to look for. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if the string has been found, <code>false</code> otherwise. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='DOMStringList-item'>item</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th item in the collection. If <code>index</code> is greater than or equal to the number of <a href='core.html#DOMString'><code>DOMString</code></a>s in the list, this returns <code>null</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into the collection.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a> at the <code>index</code>th position in the <code>DOMStringList</code>, or <code>null</code> if that is not a valid index. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='NameList'>NameList</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> The <code>NameList</code> interface provides the abstraction of an ordered collection of parallel pairs of name and namespace values (which could be null values), without defining or constraining how this collection is implemented. The items in the <code>NameList</code> are accessible via an integral index, starting from 0. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#NameList'>NameList</a> { <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#NameList-getName'>getName</a>(in unsigned long index); <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#NameList-getNamespaceURI'>getNamespaceURI</a>(in unsigned long index); readonly attribute unsigned long <a class='noxref' href='core.html#NameList-length'>length</a>; boolean <a class='noxref' href='core.html#NameList-contains'>contains</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> str); boolean <a class='noxref' href='core.html#NameList-containsNS'>containsNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='NameList-length'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd> The number of pairs (name and namespaceURI) in the list. The range of valid child node indices is 0 to <code>length-1</code> inclusive. <br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='NameList-contains'>contains</a></code></dt> <dd> <div class='method'> Test if a name is part of this <code>NameList</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>str</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name to look for. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if the name has been found, <code>false</code> otherwise. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='NameList-containsNS'>containsNS</a></code></dt> <dd> <div class='method'> Test if the pair namespaceURI/name is part of this <code>NameList</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The namespace URI to look for. <br> </dd> <dt><code class='parameter-name'>name</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name to look for. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if the pair namespaceURI/name has been found, <code>false</code> otherwise. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='NameList-getName'>getName</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th name item in the collection. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into the collection.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The name at the <code>index</code>th position in the <code>NameList</code>, or <code>null</code> if there is no name for the specified index or if the index is out of range. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='NameList-getNamespaceURI'>getNamespaceURI</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th namespaceURI item in the collection. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into the collection.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The namespace URI at the <code>index</code>th position in the <code>NameList</code>, or <code>null</code> if there is no name for the specified index or if the index is out of range. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='DOMImplementationList'>DOMImplementationList</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> The <code>DOMImplementationList</code> interface provides the abstraction of an ordered collection of DOM implementations, without defining or constraining how this collection is implemented. The items in the <code>DOMImplementationList</code> are accessible via an integral index, starting from 0. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#DOMImplementationList'>DOMImplementationList</a> { <a class='noxref' href='core.html#ID-102161490'>DOMImplementation</a> <a class='noxref' href='core.html#DOMImplementationList-item'>item</a>(in unsigned long index); readonly attribute unsigned long <a class='noxref' href='core.html#DOMImplementationList-length'>length</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='DOMImplementationList-length'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd> The number of <a href='core.html#ID-102161490'><code>DOMImplementation</code></a>s in the list. The range of valid child node indices is 0 to <code>length-1</code> inclusive. <br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='DOMImplementationList-item'>item</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th item in the collection. If <code>index</code> is greater than or equal to the number of <a href='core.html#ID-102161490'><code>DOMImplementation</code></a>s in the list, this returns <code>null</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into the collection.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-102161490'><code>DOMImplementation</code></a></p></td><td> <p> The <a class='noxref' href='core.html#ID-102161490'><code>DOMImplementation</code></a> at the <code>index</code>th position in the <code>DOMImplementationList</code>, or <code>null</code> if that is not a valid index. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='DOMImplementationSource'>DOMImplementationSource</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p>This interface permits a DOM implementer to supply one or more implementations, based upon requested features and versions, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>. Each implemented <code>DOMImplementationSource</code> object is listed in the binding-specific list of available sources so that its <a href='core.html#ID-102161490'><code>DOMImplementation</code></a> objects are made available. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#DOMImplementationSource'>DOMImplementationSource</a> { <a class='noxref' href='core.html#ID-102161490'>DOMImplementation</a> <a class='noxref' href='core.html#ID-getDOMImpl'>getDOMImplementation</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> features); <a class='noxref' href='core.html#DOMImplementationList'>DOMImplementationList</a> <a class='noxref' href='core.html#ID-getDOMImpls'>getDOMImplementationList</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> features); }; </pre> </div><br> </dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-getDOMImpl'>getDOMImplementation</a></code></dt> <dd> <div class='method'> A method to request the first DOM implementation that supports the specified features. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>features</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number. <br> This method returns the first item of the list returned by <code>getDOMImplementationList</code>. <br> As an example, the string <code>"XML 3.0 Traversal +Events 2.0"</code> will request a DOM implementation that supports the module "XML" for its 3.0 version, a module that support of the "Traversal" module for any version, and the module "Events" for its 2.0 version. The module "Events" must be accessible using the method <a href='core.html#Node3-getFeature'><code>Node.getFeature()</code></a> and <a href='core.html#DOMImplementation3-getFeature'><code>DOMImplementation.getFeature()</code></a>. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-102161490'><code>DOMImplementation</code></a></p></td><td> <p> The first DOM implementation that support the desired features, or <code>null</code> if this source has none.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-getDOMImpls'>getDOMImplementationList</a></code></dt> <dd> <div class='method'> A method to request a list of DOM implementations that support the specified features and versions, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>features</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number. This is something like: "XML 3.0 Traversal +Events 2.0"<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMImplementationList'><code>DOMImplementationList</code></a></p></td><td> <p> A list of DOM implementations that support the desired features.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-102161490'>DOMImplementation</a></i></b></dt> <dd> <p>The <code>DOMImplementation</code> interface provides a number of methods for performing operations that are independent of any particular instance of the document object model. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-102161490'>DOMImplementation</a> { boolean <a class='noxref' href='core.html#ID-5CED94D7'>hasFeature</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> feature, in <a class='noxref' href='core.html#DOMString'>DOMString</a> version); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-412266927'>DocumentType</a> <a class='noxref' href='core.html#Level-2-Core-DOM-createDocType'>createDocumentType</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName, in <a class='noxref' href='core.html#DOMString'>DOMString</a> publicId, in <a class='noxref' href='core.html#DOMString'>DOMString</a> systemId) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#i-Document'>Document</a> <a class='noxref' href='core.html#Level-2-Core-DOM-createDocument'>createDocument</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName, in <a class='noxref' href='core.html#ID-412266927'>DocumentType</a> doctype) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMObject'>DOMObject</a> <a class='noxref' href='core.html#DOMImplementation3-getFeature'>getFeature</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> feature, in <a class='noxref' href='core.html#DOMString'>DOMString</a> version); }; </pre> </div><br> </dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='Level-2-Core-DOM-createDocument'>createDocument</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Creates a DOM Document object of the specified type with its document element.<br> Note that based on the <a href='core.html#ID-412266927'><code>DocumentType</code></a> given to create the document, the implementation may instantiate specialized <a href='core.html#i-Document'><code>Document</code></a> objects that support additional features than the "Core", such as "HTML" [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>]. On the other hand, setting the <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> after the document was created makes this very unlikely to happen. Alternatively, specialized <a class='noxref' href='core.html#i-Document'><code>Document</code></a> creation methods, such as <code>createHTMLDocument</code> [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>], can be used to obtain specific types of <a class='noxref' href='core.html#i-Document'><code>Document</code></a> objects.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the document element to create or <code>null</code>.<br> </dd> <dt><code class='parameter-name'>qualifiedName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-qualifiedname'>qualified name</a> of the document element to be created or <code>null</code>.<br> </dd> <dt><code class='parameter-name'>doctype</code> of type <a href='core.html#ID-412266927'><code>DocumentType</code></a></dt><dd> The type of document to be created or <code>null</code>.<br> When <code>doctype</code> is not <code>null</code>, its <a href='core.html#node-ownerDoc'><code>Node.ownerDocument</code></a> attribute is set to the document being created.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#i-Document'><code>Document</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#i-Document'><code>Document</code></a> object with its document element. If the <code>NamespaceURI</code>, <code>qualifiedName</code>, and <code>doctype</code> are <code>null</code>, the returned <a class='noxref' href='core.html#i-Document'><code>Document</code></a> is empty with no document element.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>].<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is malformed, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, or if the <code>qualifiedName</code> is <code>null</code> and the <code>namespaceURI</code> is different from <code>null</code>, or if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>" [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], or if the DOM implementation does not support the <code>"XML"</code> feature but a non-null namespace URI was provided, since namespaces were defined by XML.<p>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already been used with a different document or was created from a different implementation.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Level-2-Core-DOM-createDocType'>createDocumentType</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Creates an empty <a href='core.html#ID-412266927'><code>DocumentType</code></a> node. Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur..<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>qualifiedName</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-qualifiedname'>qualified name</a> of the document type to be created.<br> </dd> <dt><code class='parameter-name'>publicId</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The external subset public identifier.<br> </dd> <dt><code class='parameter-name'>systemId</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The external subset system identifier.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-412266927'><code>DocumentType</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> node with <a href='core.html#node-ownerDoc'><code>Node.ownerDocument</code></a> set to <code>null</code>.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>].<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is malformed.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='DOMImplementation3-getFeature'>getFeature</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in <a href='core.html#Embedded-DOM'>Mixed DOM Implementations</a>. This method also allow the implementation to provide specialized objects which do not support the <code>DOMImplementation</code> interface. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>feature</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method. <br> </dd> <dt><code class='parameter-name'>version</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> This is the version number of the feature to test. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMObject'><code>DOMObject</code></a></p></td><td> <p> Returns an object which implements the specialized APIs of the specified feature and version, if any, or <code>null</code> if there is no object which implements interfaces associated with that feature. If the <a class='noxref' href='core.html#DOMObject'><code>DOMObject</code></a> returned by this method implements the <code>DOMImplementation</code> interface, it must delegate to the primary core <code>DOMImplementation</code> and not return results inconsistent with the primary core <code>DOMImplementation</code> such as <code>hasFeature</code>, <code>getFeature</code>, etc. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-5CED94D7'>hasFeature</a></code></dt> <dd> <div class='method'> Test if the DOM implementation implements a specific feature and version, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>feature</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the feature to test. <br> </dd> <dt><code class='parameter-name'>version</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> This is the version number of the feature to test. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if the feature is implemented in the specified version, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-B63ED1A3'>DocumentFragment</a></i></b></dt> <dd> <p><code>DocumentFragment</code> is a "lightweight" or "minimal" <a href='core.html#i-Document'><code>Document</code></a> object. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that a <a class='noxref' href='core.html#i-Document'><code>Document</code></a> object could fulfill this role, a <a class='noxref' href='core.html#i-Document'><code>Document</code></a> object can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object. <code>DocumentFragment</code> is such an object.<p>Furthermore, various operations -- such as inserting nodes as children of another <a href='core.html#ID-1950641247'><code>Node</code></a> -- may take <code>DocumentFragment</code> objects as arguments; this results in all the child nodes of the <code>DocumentFragment</code> being moved to the child list of this node.<p>The children of a <code>DocumentFragment</code> node are zero or more nodes representing the tops of any sub-trees defining the structure of the document. <code>DocumentFragment</code> nodes do not need to be <a href='glossary.html#dt-well-formed'>well-formed XML documents</a> (although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, a <code>DocumentFragment</code> might have only one child and that child node could be a <a href='core.html#ID-1312295772'><code>Text</code></a> node. Such a structure model represents neither an HTML document nor a well-formed XML document.<p>When a <code>DocumentFragment</code> is inserted into a <a href='core.html#i-Document'><code>Document</code></a> (or indeed any other <a href='core.html#ID-1950641247'><code>Node</code></a> that may take children) the children of the <code>DocumentFragment</code> and not the <code>DocumentFragment</code> itself are inserted into the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a>. This makes the <code>DocumentFragment</code> very useful when the user wishes to create nodes that are <a href='glossary.html#dt-sibling'>siblings</a>; the <code>DocumentFragment</code> acts as the parent of these nodes so that the user can use the standard methods from the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface, such as <a href='core.html#ID-952280727'><code>Node.insertBefore</code></a> and <a href='core.html#ID-184E7107'><code>Node.appendChild</code></a>. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-B63ED1A3'>DocumentFragment</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { }; </pre> </div><br> </dd> </dl></dd> <dt><b>Interface <i><a name='i-Document'>Document</a></i></b></dt> <dd> <p>The <code>Document</code> interface represents the entire HTML or XML document. Conceptually, it is the <a href='glossary.html#dt-root-node'>root</a> of the document tree, and provides the primary access to the document's data.<p>Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of a <code>Document</code>, the <code>Document</code> interface also contains the factory methods needed to create these objects. The <a href='core.html#ID-1950641247'><code>Node</code></a> objects created have a <code>ownerDocument</code> attribute which associates them with the <code>Document</code> within whose context they were created. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#i-Document'>Document</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { // Modified in DOM Level 3: readonly attribute <a class='noxref' href='core.html#ID-412266927'>DocumentType</a> <a class='noxref' href='core.html#ID-B63ED1A31'>doctype</a>; readonly attribute <a class='noxref' href='core.html#ID-102161490'>DOMImplementation</a> <a class='noxref' href='core.html#ID-1B793EBA'>implementation</a>; readonly attribute <a class='noxref' href='core.html#ID-745549614'>Element</a> <a class='noxref' href='core.html#ID-87CD092'>documentElement</a>; <a class='noxref' href='core.html#ID-745549614'>Element</a> <a class='noxref' href='core.html#ID-2141741547'>createElement</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> tagName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-B63ED1A3'>DocumentFragment</a> <a class='noxref' href='core.html#ID-35CB04B5'>createDocumentFragment</a>(); <a class='noxref' href='core.html#ID-1312295772'>Text</a> <a class='noxref' href='core.html#ID-1975348127'>createTextNode</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> data); <a class='noxref' href='core.html#ID-1728279322'>Comment</a> <a class='noxref' href='core.html#ID-1334481328'>createComment</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> data); <a class='noxref' href='core.html#ID-667469212'>CDATASection</a> <a class='noxref' href='core.html#ID-D26C0AF8'>createCDATASection</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> data) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-1004215813'>ProcessingInstruction</a> <a class='noxref' href='core.html#ID-135944439'>createProcessingInstruction</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> target, in <a class='noxref' href='core.html#DOMString'>DOMString</a> data) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-1084891198'>createAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-11C98490'>EntityReference</a> <a class='noxref' href='core.html#ID-392B75AE'>createEntityReference</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-536297177'>NodeList</a> <a class='noxref' href='core.html#ID-A6C9094'>getElementsByTagName</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> tagname); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#Core-Document-importNode'>importNode</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> importedNode, in boolean deep) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-745549614'>Element</a> <a class='noxref' href='core.html#ID-DocCrElNS'>createElementNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-DocCrAttrNS'>createAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-536297177'>NodeList</a> <a class='noxref' href='core.html#ID-getElBTNNS'>getElementsByTagNameNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-745549614'>Element</a> <a class='noxref' href='core.html#ID-getElBId'>getElementById</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> elementId); // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Document3-inputEncoding'>inputEncoding</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Document3-encoding'>xmlEncoding</a>; // Introduced in DOM Level 3: attribute boolean <a class='noxref' href='core.html#Document3-standalone'>xmlStandalone</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // Introduced in DOM Level 3: attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Document3-version'>xmlVersion</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // Introduced in DOM Level 3: attribute boolean <a class='noxref' href='core.html#Document3-strictErrorChecking'>strictErrorChecking</a>; // Introduced in DOM Level 3: attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Document3-documentURI'>documentURI</a>; // Introduced in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#Document3-adoptNode'>adoptNode</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> source) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMConfiguration'>DOMConfiguration</a> <a class='noxref' href='core.html#Document3-domConfig'>domConfig</a>; // Introduced in DOM Level 3: void <a class='noxref' href='core.html#Document3-normalizeDocument'>normalizeDocument</a>(); // Introduced in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#Document3-renameNode'>renameNode</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> n, in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-B63ED1A31'>doctype</a></code> of type <a href='core.html#ID-412266927'><code>DocumentType</code></a>, readonly, modified in <b class='version'>DOM Level 3</b></dt> <dd>The Document Type Declaration (see <a href='core.html#ID-412266927'><code>DocumentType</code></a>) associated with this document. For XML documents without a document type declaration this returns <code>null</code>. For HTML documents, a <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> object may be returned, independently of the presence or absence of document type declaration in the HTML document.<br> This provides direct access to the <a href='core.html#ID-412266927'><code>DocumentType</code></a> node, child node of this <code>Document</code>. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such as <a href='core.html#ID-952280727'><code>Node.insertBefore</code></a>, or <a href='core.html#ID-785887307'><code>Node.replaceChild</code></a>. Note, however, that while some implementations may instantiate different types of <code>Document</code> objects supporting additional features than the "Core", such as "HTML" [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>], based on the <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> specified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.<br> </dd> <dt><code class='attribute-name'><a name='ID-87CD092'>documentElement</a></code> of type <a href='core.html#ID-745549614'><code>Element</code></a>, readonly</dt> <dd>This is a <a href='glossary.html#dt-convenience'>convenience</a> attribute that allows direct access to the child node that is the <a href='glossary.html#dt-document-element'>document element</a> of the document.<br> </dd> <dt><code class='attribute-name'><a name='Document3-documentURI'>documentURI</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, introduced in <b class='version'>DOM Level 3</b></dt> <dd> The location of the document or <code>null</code> if undefined or if the <code>Document</code> was created using <a href='core.html#Level-2-Core-DOM-createDocument'><code>DOMImplementation.createDocument</code></a>. No lexical checking is performed when setting this attribute; this could result in a <code>null</code> value returned when using <a href='core.html#Node3-baseURI'><code>Node.baseURI</code></a>. <br> Beware that when the <code>Document</code> supports the feature "HTML" [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>], the href attribute of the HTML BASE element takes precedence over this attribute when computing <a href='core.html#Node3-baseURI'><code>Node.baseURI</code></a>. <br> </dd> <dt><code class='attribute-name'><a name='Document3-domConfig'>domConfig</a></code> of type <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd> The configuration used when <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> is invoked. <br> </dd> <dt><code class='attribute-name'><a name='ID-1B793EBA'>implementation</a></code> of type <a href='core.html#ID-102161490'><code>DOMImplementation</code></a>, readonly</dt> <dd>The <a href='core.html#ID-102161490'><code>DOMImplementation</code></a> object that handles this document. A DOM application may use objects from multiple implementations.<br> </dd> <dt><code class='attribute-name'><a name='Document3-inputEncoding'>inputEncoding</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying the encoding used for this document at the time of the parsing. This is <code>null</code> when it is not known, such as when the <code>Document</code> was created in memory.<br> </dd> <dt><code class='attribute-name'><a name='Document3-strictErrorChecking'>strictErrorChecking</a></code> of type <code>boolean</code>, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying whether error checking is enforced or not. When set to <code>false</code>, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise any <a href='core.html#ID-17189187'><code>DOMException</code></a> on DOM operations or report errors while using <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>. In case of error, the behavior is undefined. This attribute is <code>true</code> by default.<br> </dd> <dt><code class='attribute-name'><a name='Document3-encoding'>xmlEncoding</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying, as part of the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'><em>XML declaration</em></a>, the encoding of this document. This is <code>null</code> when unspecified or when it is not known, such as when the <code>Document</code> was created in memory.<br> </dd> <dt><code class='attribute-name'><a name='Document3-standalone'>xmlStandalone</a></code> of type <code>boolean</code>, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying, as part of the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'><em>XML declaration</em></a>, whether this document is standalone. This is <code>false</code> when unspecified.<p><b>Note:</b> No verification is done on the value when setting this attribute. Applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> with the "<a href='core.html#parameter-validate'>validate</a>" parameter to verify if the value matches the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-rmd'><em>validity constraint for standalone document declaration</em></a> as defined in [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. </p> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p> NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature. </td></tr> </table> </div></div> <!-- exceptions --> </dd> <dt><code class='attribute-name'><a name='Document3-version'>xmlVersion</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, introduced in <b class='version'>DOM Level 3</b></dt> <dd> An attribute specifying, as part of the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-XMLDecl'><em>XML declaration</em></a>, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is <code>"1.0"</code>. If this document does not support the "XML" feature, the value is always <code>null</code>. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invoke <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> in order to check for invalid characters in the <a href='core.html#ID-1950641247'><code>Node</code></a>s that are already part of this <code>Document</code>. <br> DOM applications may use the <a href='core.html#ID-5CED94D7'><code>DOMImplementation.hasFeature(feature, version)</code></a> method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification. <code>Document</code> objects supporting a version of the "XMLVersion" feature must not raise a <a href='core.html#DOMException-NOT_SUPPORTED_ERR'><code>NOT_SUPPORTED_ERR</code></a> exception for the same version number when using <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a>. <br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p> NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by this <code>Document</code> or if this document does not support the "XML" feature. </td></tr> </table> </div></div> <!-- exceptions --> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='Document3-adoptNode'>adoptNode</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Attempts to adopt a node from another document to this document. If supported, it changes the <code>ownerDocument</code> of the source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to another (unlike <code>importNode()</code> which create a copy of the source node instead of moving it). When it fails, applications should use <a href='core.html#Core-Document-importNode'><code>Document.importNode()</code></a> instead. Note that if the adopted node is already part of this document (i.e. the source and target document are the same), this method still has the effect of removing the source node from the child list of its parent, if any. The following list describes the specifics for each type of node. <dl> <dt>ATTRIBUTE_NODE</dt> <dd>The <code>ownerElement</code> attribute is set to <code>null</code> and the <code>specified</code> flag is set to <code>true</code> on the adopted <a href='core.html#ID-637646024'><code>Attr</code></a>. The descendants of the source <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> are recursively adopted.</dd><dt>DOCUMENT_FRAGMENT_NODE</dt> <dd>The descendants of the source node are recursively adopted.</dd><dt>DOCUMENT_NODE</dt> <dd><code>Document</code> nodes cannot be adopted.</dd><dt>DOCUMENT_TYPE_NODE</dt> <dd><a href='core.html#ID-412266927'><code>DocumentType</code></a> nodes cannot be adopted.</dd><dt>ELEMENT_NODE</dt> <dd><em>Specified</em> attribute nodes of the source element are adopted. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.</dd><dt>ENTITY_NODE</dt> <dd><a href='core.html#ID-527DCFF2'><code>Entity</code></a> nodes cannot be adopted.</dd><dt>ENTITY_REFERENCE_NODE</dt> <dd>Only the <a href='core.html#ID-11C98490'><code>EntityReference</code></a> node itself is adopted, the descendants are discarded, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.</dd><dt>NOTATION_NODE</dt> <dd><a href='core.html#ID-5431D1B9'><code>Notation</code></a> nodes cannot be adopted.</dd><dt>PROCESSING_INSTRUCTION_NODE, TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt> <dd>These nodes can all be adopted. No specifics.</dd></dl> <p><b>Note:</b> Since it does not create new nodes unlike the <a href='core.html#Core-Document-importNode'><code>Document.importNode()</code></a> method, this method does not raise an <a href='core.html#DOMException-INVALID_CHARACTER_ERR'><code>INVALID_CHARACTER_ERR</code></a> exception, and applications should use the <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> method to check if an imported name is not an XML name according to the XML version in use. </p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>source</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to move into this document.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The adopted node, or <code>null</code> if this operation fails, such as when the source node comes from a different implementation.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: Raised if the source node is of type <code>DOCUMENT</code>, <code>DOCUMENT_TYPE</code>.<p>NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1084891198'>createAttribute</a></code></dt> <dd> <div class='method'> Creates an <a href='core.html#ID-637646024'><code>Attr</code></a> of the given name. Note that the <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> instance can then be set on an <a href='core.html#ID-745549614'><code>Element</code></a> using the <code>setAttributeNode</code> method. <br> To create an attribute with a <a href='glossary.html#dt-qualifiedname'>qualified name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a>, use the <code>createAttributeNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> object with the <code>nodeName</code> attribute set to <code>name</code>, and <code>localName</code>, <code>prefix</code>, and <code>namespaceURI</code> set to <code>null</code>. The value of the attribute is the empty string.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-DocCrAttrNS'>createAttributeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Creates an attribute of the given <a href='glossary.html#dt-qualifiedname'>qualified name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a>.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to create.<br> </dd> <dt><code class='parameter-name'>qualifiedName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-qualifiedname'>qualified name</a> of the attribute to instantiate.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> object with the following attributes:<table border='1' summary='Layout table: the first cell the name property, the second cell contains his initial value' cellpadding='3' > <tr> <th rowspan='1' colspan='1'> Attribute</th><th rowspan='1' colspan='1'> Value</th></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a></td><td valign='top' rowspan='1' colspan='1'> qualifiedName</td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>namespaceURI</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSPrefix'><code>Node.prefix</code></a></td><td valign='top' rowspan='1' colspan='1'> prefix, extracted from <code>qualifiedName</code>, or <code>null</code> if there is no prefix</td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSLocalN'><code>Node.localName</code></a></td><td valign='top' rowspan='1' colspan='1'> <a class='noxref' href='glossary.html#dt-localname'>local name</a>, extracted from <code>qualifiedName</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-1112119403'><code>Attr.name</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>qualifiedName</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-F68D080'><code>Node.nodeValue</code></a></td><td valign='top' rowspan='1' colspan='1'> the empty string</td></tr> </table> </td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified <code>qualifiedName</code> is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a malformed <a href='glossary.html#dt-qualifiedname'>qualified name</a>, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a class='normative' 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".<p>NOT_SUPPORTED_ERR: Always thrown if the current document does not support the <code>"XML"</code> feature, since namespaces were defined by XML.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-D26C0AF8'>createCDATASection</a></code></dt> <dd> <div class='method'> Creates a <a href='core.html#ID-667469212'><code>CDATASection</code></a> node whose value is the specified string.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>data</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The data for the <a href='core.html#ID-667469212'><code>CDATASection</code></a> contents.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-667469212'><code>CDATASection</code></a></p></td><td> <p> The new <a class='noxref' href='core.html#ID-667469212'><code>CDATASection</code></a> object.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1334481328'>createComment</a></code></dt> <dd> <div class='method'> Creates a <a href='core.html#ID-1728279322'><code>Comment</code></a> node given the specified string.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>data</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The data for the node.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1728279322'><code>Comment</code></a></p></td><td> <p> The new <a class='noxref' href='core.html#ID-1728279322'><code>Comment</code></a> object.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-35CB04B5'>createDocumentFragment</a></code></dt> <dd> <div class='method'> Creates an empty <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> object. <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>.</td></tr></table> </div></div> <!-- return --> <div><b>No Parameters</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-2141741547'>createElement</a></code></dt> <dd> <div class='method'> Creates an element of the type specified. Note that the instance returned implements the <a href='core.html#ID-745549614'><code>Element</code></a> interface, so attributes can be specified directly on the returned object.<br> In addition, if there are known attributes with default values, <a href='core.html#ID-637646024'><code>Attr</code></a> nodes representing them are automatically created and attached to the element.<br> To create an element with a <a href='glossary.html#dt-qualifiedname'>qualified name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a>, use the <code>createElementNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>tagName</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-745549614'><code>Element</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a> object with the <code>nodeName</code> attribute set to <code>tagName</code>, and <code>localName</code>, <code>prefix</code>, and <code>namespaceURI</code> set to <code>null</code>.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-DocCrElNS'>createElementNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Creates an element of the given <a href='glossary.html#dt-qualifiedname'>qualified name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a>.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the namespaceURI parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the element to create.<br> </dd> <dt><code class='parameter-name'>qualifiedName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-qualifiedname'>qualified name</a> of the element type to instantiate.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-745549614'><code>Element</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a> object with the following attributes:<table border='1' summary='Layout table: the first cell the name property, the second cell contains his initial value' cellpadding='3' > <tr> <th rowspan='1' colspan='1'> Attribute</th><th rowspan='1' colspan='1'> Value</th></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>qualifiedName</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSname'><code>Node.namespaceURI</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>namespaceURI</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSPrefix'><code>Node.prefix</code></a></td><td valign='top' rowspan='1' colspan='1'> prefix, extracted from <code>qualifiedName</code>, or <code>null</code> if there is no prefix</td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-NodeNSLocalN'><code>Node.localName</code></a></td><td valign='top' rowspan='1' colspan='1'> <a class='noxref' href='glossary.html#dt-localname'>local name</a>, extracted from <code>qualifiedName</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-104682815'><code>Element.tagName</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>qualifiedName</code></td></tr> </table> </td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified <code>qualifiedName</code> is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a malformed <a href='glossary.html#dt-qualifiedname'>qualified name</a>, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, or if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>" [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], or if the <code>qualifiedName</code> or its prefix is "xmlns" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a class='normative' 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".<p>NOT_SUPPORTED_ERR: Always thrown if the current document does not support the <code>"XML"</code> feature, since namespaces were defined by XML.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-392B75AE'>createEntityReference</a></code></dt> <dd> <div class='method'> Creates an <a href='core.html#ID-11C98490'><code>EntityReference</code></a> object. In addition, if the referenced entity is known, the child list of the <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> node is made the same as that of the corresponding <a href='core.html#ID-527DCFF2'><code>Entity</code></a> node.<p><b>Note:</b> If any descendant of the <a href='core.html#ID-527DCFF2'><code>Entity</code></a> node has an unbound <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a>, the corresponding descendant of the created <a href='core.html#ID-11C98490'><code>EntityReference</code></a> node is also unbound; (its <code>namespaceURI</code> is <code>null</code>). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.</p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the entity to reference.<br> Unlike <a href='core.html#ID-DocCrElNS'><code>Document.createElementNS</code></a> or <a href='core.html#ID-DocCrAttrNS'><code>Document.createAttributeNS</code></a>, no namespace well-formed checking is done on the entity name. Applications should invoke <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> with the parameter "<a href='core.html#parameter-namespaces'>namespaces</a>" set to <code>true</code> in order to ensure that the entity name is namespace well-formed. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-11C98490'><code>EntityReference</code></a></p></td><td> <p> The new <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> object.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-135944439'>createProcessingInstruction</a></code></dt> <dd> <div class='method'> Creates a <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a> node given the specified name and data strings.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>target</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The target part of the processing instruction.<br> Unlike <a href='core.html#ID-DocCrElNS'><code>Document.createElementNS</code></a> or <a href='core.html#ID-DocCrAttrNS'><code>Document.createAttributeNS</code></a>, no namespace well-formed checking is done on the target name. Applications should invoke <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> with the parameter "<a href='core.html#parameter-namespaces'>namespaces</a>" set to <code>true</code> in order to ensure that the target name is namespace well-formed. <br> </dd> <dt><code class='parameter-name'>data</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The data for the node.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a></p></td><td> <p> The new <a class='noxref' href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a> object.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified target is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1975348127'>createTextNode</a></code></dt> <dd> <div class='method'> Creates a <a href='core.html#ID-1312295772'><code>Text</code></a> node given the specified string.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>data</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The data for the node.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1312295772'><code>Text</code></a></p></td><td> <p> The new <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> object.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-getElBId'>getElementById</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns the <a href='core.html#ID-745549614'><code>Element</code></a> that has an ID attribute with the given value. If no such element exists, this returns <code>null</code>. If more than one element has an ID attribute with that value, what is returned is undefined. <br> The DOM implementation is expected to use the attribute <a href='core.html#Attr-isId'><code>Attr.isId</code></a> to determine if an attribute is of type ID. <p><b>Note:</b> Attributes with the name "ID" or "id" are not of type ID unless so defined.</p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>elementId</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The unique <code>id</code> value for an element.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-745549614'><code>Element</code></a></p></td><td> <p> The matching element or <code>null</code> if there is none.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-A6C9094'>getElementsByTagName</a></code></dt> <dd> <div class='method'> Returns a <a href='core.html#ID-536297177'><code>NodeList</code></a> of all the <a href='core.html#ID-745549614'><code>Elements</code></a> in <a href='glossary.html#dt-document-order'>document order</a> with a given tag name and are contained in the document.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>tagname</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the tag to match on. The special value "*" matches all tags. For XML, the <code>tagname</code> parameter is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-536297177'><code>NodeList</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> object containing all the matched <a href='core.html#ID-745549614'><code>Elements</code></a>.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-getElBTNNS'>getElementsByTagNameNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns a <a href='core.html#ID-536297177'><code>NodeList</code></a> of all the <a href='core.html#ID-745549614'><code>Elements</code></a> with a given <a href='glossary.html#dt-localname'>local name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a> in <a href='glossary.html#dt-document-order'>document order</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the elements to match on. The special value <code>"*"</code> matches all namespaces.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the elements to match on. The special value "*" matches all local names.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-536297177'><code>NodeList</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> object containing all the matched <a href='core.html#ID-745549614'><code>Elements</code></a>.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Core-Document-importNode'>importNode</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (<code>parentNode</code> is <code>null</code>).<br> For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node's <code>nodeName</code> and <code>nodeType</code>, plus the attributes related to namespaces (<code>prefix</code>, <code>localName</code>, and <code>namespaceURI</code>). As in the <code>cloneNode</code> operation, the source node is not altered. User data associated to the imported node is not carried over. However, if any <a href='core.html#UserDataHandler'><code>UserDataHandlers</code></a> has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.<br> Additional information is copied as appropriate to the <code>nodeType</code>, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node. <dl> <dt>ATTRIBUTE_NODE</dt> <dd>The <code>ownerElement</code> attribute is set to <code>null</code> and the <code>specified</code> flag is set to <code>true</code> on the generated <a href='core.html#ID-637646024'><code>Attr</code></a>. The <a href='glossary.html#dt-descendant'>descendants</a> of the source <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> are recursively imported and the resulting nodes reassembled to form the corresponding subtree.<br> Note that the <code>deep</code> parameter has no effect on <a href='core.html#ID-637646024'><code>Attr</code></a> nodes; they always carry their children with them when imported.</dd><dt>DOCUMENT_FRAGMENT_NODE</dt> <dd>If the <code>deep</code> option was set to <code>true</code>, the <a href='glossary.html#dt-descendant'>descendants</a> of the source <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> are recursively imported and the resulting nodes reassembled under the imported <a class='noxref' href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> to form the corresponding subtree. Otherwise, this simply generates an empty <a class='noxref' href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>.</dd><dt>DOCUMENT_NODE</dt> <dd><code>Document</code> nodes cannot be imported.</dd><dt>DOCUMENT_TYPE_NODE</dt> <dd><a href='core.html#ID-412266927'><code>DocumentType</code></a> nodes cannot be imported.</dd><dt>ELEMENT_NODE</dt> <dd><em>Specified</em> attribute nodes of the source element are imported, and the generated <a href='core.html#ID-637646024'><code>Attr</code></a> nodes are attached to the generated <a href='core.html#ID-745549614'><code>Element</code></a>. Default attributes are <em>not</em> copied, though if the document being imported into defines default attributes for this element name, those are assigned. If the <code>importNode</code> <code>deep</code> parameter was set to <code>true</code>, the <a href='glossary.html#dt-descendant'>descendants</a> of the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.</dd><dt>ENTITY_NODE</dt> <dd><a href='core.html#ID-527DCFF2'><code>Entity</code></a> nodes can be imported, however in the current release of the DOM the <a href='core.html#ID-412266927'><code>DocumentType</code></a> is readonly. Ability to add these imported nodes to a <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> will be considered for addition to a future release of the DOM.<br> On import, the <code>publicId</code>, <code>systemId</code>, and <code>notationName</code> attributes are copied. If a <code>deep</code> import is requested, the <a href='glossary.html#dt-descendant'>descendants</a> of the the source <a href='core.html#ID-527DCFF2'><code>Entity</code></a> are recursively imported and the resulting nodes reassembled to form the corresponding subtree.</dd><dt>ENTITY_REFERENCE_NODE</dt> <dd>Only the <a href='core.html#ID-11C98490'><code>EntityReference</code></a> itself is copied, even if a <code>deep</code> import is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.</dd><dt>NOTATION_NODE</dt> <dd><a href='core.html#ID-5431D1B9'><code>Notation</code></a> nodes can be imported, however in the current release of the DOM the <a href='core.html#ID-412266927'><code>DocumentType</code></a> is readonly. Ability to add these imported nodes to a <a class='noxref' href='core.html#ID-412266927'><code>DocumentType</code></a> will be considered for addition to a future release of the DOM.<br> On import, the <code>publicId</code> and <code>systemId</code> attributes are copied.<br> Note that the <code>deep</code> parameter has no effect on this type of nodes since they cannot have any children.</dd><dt>PROCESSING_INSTRUCTION_NODE</dt> <dd>The imported node copies its <code>target</code> and <code>data</code> values from those of the source node.<br> Note that the <code>deep</code> parameter has no effect on this type of nodes since they cannot have any children.</dd><dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt> <dd>These three types of nodes inheriting from <a href='core.html#ID-FF21A306'><code>CharacterData</code></a> copy their <code>data</code> and <code>length</code> attributes from those of the source node.<br> Note that the <code>deep</code> parameter has no effect on these types of nodes since they cannot have any children.</dd></dl> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>importedNode</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to import.<br> </dd> <dt><code class='parameter-name'>deep</code> of type <code>boolean</code></dt><dd> If <code>true</code>, recursively import the subtree under the specified node; if <code>false</code>, import only the node itself, as explained above. This has no effect on nodes that cannot have any children, and on <a href='core.html#ID-637646024'><code>Attr</code></a>, and <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The imported node that belongs to this <code>Document</code>.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: Raised if the type of node being imported is not supported.<p>INVALID_CHARACTER_ERR: Raised if one of the imported names is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute. This may happen when importing an XML 1.1 [<cite><a class='noxref informative' href='references.html#XML11'>XML 1.1</a></cite>] element into an XML 1.0 document, for instance.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Document3-normalizeDocument'>normalizeDocument</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. As a consequence, this method updates the replacement tree of <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes and normalizes <a href='core.html#ID-1312295772'><code>Text</code></a> nodes, as defined in the method <a href='core.html#ID-normalize'><code>Node.normalize()</code></a>. <br> Otherwise, the actual result depends on the features being set on the <a href='core.html#Document3-domConfig'><code>Document.domConfig</code></a> object and governing what operations actually take place. Noticeably this method could also make the document <a href='glossary.html#dt-namespace-well-formed'>namespace well-formed</a> according to the algorithm described in <a href='namespaces-algorithms.html#normalizeDocumentAlgo'>Namespace Normalization</a>, check the character normalization, remove the <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes, etc. See <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a> for details. <div class='code-block'> <pre>// Keep in the document the information defined // in the XML Information Set (Java example) DOMConfiguration docConfig = myDocument.getDomConfig(); docConfig.setParameter("infoset", Boolean.TRUE); myDocument.normalizeDocument();</pre> </div><br> Mutation events, when supported, are generated to reflect the changes occurring on the document.<br> If errors occur during the invocation of this method, such as an attempt to update a <a href='glossary.html#dt-readonly-node'>read-only node</a> or a <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a> contains an invalid character according to the XML version in use, errors or warnings (<a href='core.html#ERROR-DOMError-severity-error'><code>DOMError.SEVERITY_ERROR</code></a> or <a href='core.html#ERROR-DOMError-severity-warning'><code>DOMError.SEVERITY_WARNING</code></a>) will be reported using the <a href='core.html#ERROR-Interfaces-DOMErrorHandler'><code>DOMErrorHandler</code></a> object associated with the "<a href='core.html#parameter-error-handler'>error-handler</a>" parameter. Note this method might also report fatal errors (<a href='core.html#ERROR-DOMError-severity-fatal-error'><code>DOMError.SEVERITY_FATAL_ERROR</code></a>) if an implementation cannot recover from an error. <p> <div><b>No Parameters</b></div> <div><b>No Return Value</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Document3-renameNode'>renameNode</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Rename an existing node of type <code>ELEMENT_NODE</code> or <code>ATTRIBUTE_NODE</code>.<br> When possible this simply changes the name of the given node, otherwise this creates a new node with the specified name and replaces the existing node with the new node as described below.<br> If simply changing the name of the given node is not possible, the following operations are performed: a new node is created, any registered event listener is registered on the new node, any user data attached to the old node is removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node, if the renamed node is an <a href='core.html#ID-745549614'><code>Element</code></a> its attributes are moved to the new node, the new node is inserted at the position the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old node is attached to the new node.<br> When the node being renamed is an <a href='core.html#ID-745549614'><code>Element</code></a> only the specified attributes are moved, default attributes originated from the DTD are updated according to the new element name. In addition, the implementation may update default attributes from other schemas. Applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> to guarantee these attributes are up-to-date.<br> When the node being renamed is an <a href='core.html#ID-637646024'><code>Attr</code></a> that is attached to an <a href='core.html#ID-745549614'><code>Element</code></a>, the node is first removed from the <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a> attributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it is put back.<br> In addition,<ul> <li> a user data event <code>NODE_RENAMED</code> is fired, </li> <li> when the implementation supports the feature "MutationNameEvents", each mutation operation involved in this method fires the appropriate event, and in the end the event {<code>http://www.w3.org/2001/xml-events</code>, <code>DOMElementNameChanged</code>} or {<code>http://www.w3.org/2001/xml-events</code>, <code>DOMAttributeNameChanged</code>} is fired. </li> </ul> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>n</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to rename.<br> </dd> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The new <a href='glossary.html#dt-namespaceURI'>namespace URI</a>.<br> </dd> <dt><code class='parameter-name'>qualifiedName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The new <a href='glossary.html#dt-qualifiedname'>qualified name</a>.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The renamed node. This is either the specified node or the new node that was created to replace the specified node.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: Raised when the type of the specified node is neither <code>ELEMENT_NODE</code> nor <code>ATTRIBUTE_NODE</code>, or if the implementation does not support the renaming of the <a href='glossary.html#dt-document-element'>document element</a>.<p>INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is a malformed <a href='glossary.html#dt-qualifiedname'>qualified name</a>, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, or if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>" [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>]. Also raised, when the node being renamed is an attribute, if the <code>qualifiedName</code>, or its prefix, is "xmlns" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>".</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-1950641247'>Node</a></i></b></dt> <dd> <p>The <code>Node</code> interface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing the <code>Node</code> interface expose methods for dealing with children, not all objects implementing the <code>Node</code> interface may have children. For example, <a href='core.html#ID-1312295772'><code>Text</code></a> nodes may not have children, and adding children to such nodes results in a <a href='core.html#ID-17189187'><code>DOMException</code></a> being raised.<p>The attributes <code>nodeName</code>, <code>nodeValue</code> and <code>attributes</code> are included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an <a href='core.html#ID-745549614'><code>Element</code></a> or <code>attributes</code> for a <a href='core.html#ID-1728279322'><code>Comment</code></a>), this returns <code>null</code>. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-1950641247'>Node</a> { // NodeType const unsigned short <a class='noxref' href='core.html#Node-ELEMENT_NODE'>ELEMENT_NODE</a> = 1; const unsigned short <a class='noxref' href='core.html#Node-ATTRIBUTE_NODE'>ATTRIBUTE_NODE</a> = 2; const unsigned short <a class='noxref' href='core.html#Node-TEXT_NODE'>TEXT_NODE</a> = 3; const unsigned short <a class='noxref' href='core.html#Node-CDATA_SECTION_NODE'>CDATA_SECTION_NODE</a> = 4; const unsigned short <a class='noxref' href='core.html#Node-ENTITY_REFERENCE_NODE'>ENTITY_REFERENCE_NODE</a> = 5; const unsigned short <a class='noxref' href='core.html#Node-ENTITY_NODE'>ENTITY_NODE</a> = 6; const unsigned short <a class='noxref' href='core.html#Node-PROCESSING_INSTRUCTION_NODE'>PROCESSING_INSTRUCTION_NODE</a> = 7; const unsigned short <a class='noxref' href='core.html#Node-COMMENT_NODE'>COMMENT_NODE</a> = 8; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_NODE'>DOCUMENT_NODE</a> = 9; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_TYPE_NODE'>DOCUMENT_TYPE_NODE</a> = 10; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_FRAGMENT_NODE'>DOCUMENT_FRAGMENT_NODE</a> = 11; const unsigned short <a class='noxref' href='core.html#Node-NOTATION_NODE'>NOTATION_NODE</a> = 12; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-F68D095'>nodeName</a>; attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-F68D080'>nodeValue</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on retrieval readonly attribute unsigned short <a class='noxref' href='core.html#ID-111237558'>nodeType</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-1060184317'>parentNode</a>; readonly attribute <a class='noxref' href='core.html#ID-536297177'>NodeList</a> <a class='noxref' href='core.html#ID-1451460987'>childNodes</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-169727388'>firstChild</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-61AD09FB'>lastChild</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-640FB3C8'>previousSibling</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-6AC54C2F'>nextSibling</a>; readonly attribute <a class='noxref' href='core.html#ID-1780488922'>NamedNodeMap</a> <a class='noxref' href='core.html#ID-84CF096'>attributes</a>; // Modified in DOM Level 2: readonly attribute <a class='noxref' href='core.html#i-Document'>Document</a> <a class='noxref' href='core.html#node-ownerDoc'>ownerDocument</a>; // Modified in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-952280727'>insertBefore</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> newChild, in <a class='noxref' href='core.html#ID-1950641247'>Node</a> refChild) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Modified in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-785887307'>replaceChild</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> newChild, in <a class='noxref' href='core.html#ID-1950641247'>Node</a> oldChild) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Modified in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-1734834066'>removeChild</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> oldChild) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Modified in DOM Level 3: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-184E7107'>appendChild</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> newChild) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); boolean <a class='noxref' href='core.html#ID-810594187'>hasChildNodes</a>(); <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-3A0ED0A4'>cloneNode</a>(in boolean deep); // Modified in DOM Level 3: void <a class='noxref' href='core.html#ID-normalize'>normalize</a>(); // Introduced in DOM Level 2: boolean <a class='noxref' href='core.html#Level-2-Core-Node-supports'>isSupported</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> feature, in <a class='noxref' href='core.html#DOMString'>DOMString</a> version); // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-NodeNSname'>namespaceURI</a>; // Introduced in DOM Level 2: attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-NodeNSPrefix'>prefix</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-NodeNSLocalN'>localName</a>; // Introduced in DOM Level 2: boolean <a class='noxref' href='core.html#ID-NodeHasAttrs'>hasAttributes</a>(); // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Node3-baseURI'>baseURI</a>; // DocumentPosition const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_DISCONNECTED'>DOCUMENT_POSITION_DISCONNECTED</a> = 0x01; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_PRECEDING'>DOCUMENT_POSITION_PRECEDING</a> = 0x02; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_FOLLOWING'>DOCUMENT_POSITION_FOLLOWING</a> = 0x04; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_CONTAINS'>DOCUMENT_POSITION_CONTAINS</a> = 0x08; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_CONTAINED_BY'>DOCUMENT_POSITION_CONTAINED_BY</a> = 0x10; const unsigned short <a class='noxref' href='core.html#Node-DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC'>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC</a> = 0x20; // Introduced in DOM Level 3: unsigned short <a class='noxref' href='core.html#Node3-compareDocumentPosition'>compareDocumentPosition</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> other) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Node3-textContent'>textContent</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on retrieval // Introduced in DOM Level 3: boolean <a class='noxref' href='core.html#Node3-isSameNode'>isSameNode</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> other); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Node3-lookupNamespacePrefix'>lookupPrefix</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI); // Introduced in DOM Level 3: boolean <a class='noxref' href='core.html#Node3-isDefaultNamespace'>isDefaultNamespace</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Node3-lookupNamespaceURI'>lookupNamespaceURI</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> prefix); // Introduced in DOM Level 3: boolean <a class='noxref' href='core.html#Node3-isEqualNode'>isEqualNode</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> arg); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMObject'>DOMObject</a> <a class='noxref' href='core.html#Node3-getFeature'>getFeature</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> feature, in <a class='noxref' href='core.html#DOMString'>DOMString</a> version); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> <a class='noxref' href='core.html#Node3-setUserData'>setUserData</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> key, in <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> data, in <a class='noxref' href='core.html#UserDataHandler'>UserDataHandler</a> handler); // Introduced in DOM Level 3: <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> <a class='noxref' href='core.html#Node3-getUserData'>getUserData</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> key); }; </pre> </div><br> </dd> <dt><b>Definition group <i><a name='ID-1841493061'>NodeType</a></i></b></dt> <dd><p>An integer indicating which type of node this is.<p><b>Note:</b> Numeric codes up to 200 are reserved to W3C for possible future use.</p> <dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='Node-ATTRIBUTE_NODE'><code class='constant-name'>ATTRIBUTE_NODE</code></a></dt><dd> The node is an <a href='core.html#ID-637646024'><code>Attr</code></a>.</dd> <dt><a name='Node-CDATA_SECTION_NODE'><code class='constant-name'>CDATA_SECTION_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-667469212'><code>CDATASection</code></a>.</dd> <dt><a name='Node-COMMENT_NODE'><code class='constant-name'>COMMENT_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-1728279322'><code>Comment</code></a>.</dd> <dt><a name='Node-DOCUMENT_FRAGMENT_NODE'><code class='constant-name'>DOCUMENT_FRAGMENT_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>.</dd> <dt><a name='Node-DOCUMENT_NODE'><code class='constant-name'>DOCUMENT_NODE</code></a></dt><dd> The node is a <a href='core.html#i-Document'><code>Document</code></a>.</dd> <dt><a name='Node-DOCUMENT_TYPE_NODE'><code class='constant-name'>DOCUMENT_TYPE_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-412266927'><code>DocumentType</code></a>.</dd> <dt><a name='Node-ELEMENT_NODE'><code class='constant-name'>ELEMENT_NODE</code></a></dt><dd> The node is an <a href='core.html#ID-745549614'><code>Element</code></a>.</dd> <dt><a name='Node-ENTITY_NODE'><code class='constant-name'>ENTITY_NODE</code></a></dt><dd> The node is an <a href='core.html#ID-527DCFF2'><code>Entity</code></a>.</dd> <dt><a name='Node-ENTITY_REFERENCE_NODE'><code class='constant-name'>ENTITY_REFERENCE_NODE</code></a></dt><dd> The node is an <a href='core.html#ID-11C98490'><code>EntityReference</code></a>.</dd> <dt><a name='Node-NOTATION_NODE'><code class='constant-name'>NOTATION_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-5431D1B9'><code>Notation</code></a>.</dd> <dt><a name='Node-PROCESSING_INSTRUCTION_NODE'><code class='constant-name'>PROCESSING_INSTRUCTION_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a>.</dd> <dt><a name='Node-TEXT_NODE'><code class='constant-name'>TEXT_NODE</code></a></dt><dd> The node is a <a href='core.html#ID-1312295772'><code>Text</code></a> node.</dd> </dl> </dd></dl> </dd> <dd><p>The values of <code>nodeName</code>, <code>nodeValue</code>, and <code>attributes</code> vary according to the node type as follows: <table border='1' summary='Layout table: the first cell contains the name of the interface, the second contains the value of the nodeName attribute for this interface, the third contains the value of the nodeValue attribute for this interface and the fourth contains the value of the attributes attribute for this interface' cellpadding='3' > <tr> <th rowspan='1' colspan='1'> Interface</th><th rowspan='1' colspan='1'> nodeName</th><th rowspan='1' colspan='1'> nodeValue</th><th rowspan='1' colspan='1'> attributes</th></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-637646024'><code>Attr</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-1112119403'><code>Attr.name</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-221662474'><code>Attr.value</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-667469212'><code>CDATASection</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>"#cdata-section"</code></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-72AB8359'><code>CharacterData.data</code></a>, the content of the CDATA Section</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-1728279322'><code>Comment</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>"#comment"</code></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-72AB8359'><code>CharacterData.data</code></a>, the content of the comment</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#i-Document'><code>Document</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>"#document"</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>"#document-fragment"</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-412266927'><code>DocumentType</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-1844763134'><code>DocumentType.name</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-745549614'><code>Element</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-104682815'><code>Element.tagName</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-527DCFF2'><code>Entity</code></a></td><td valign='top' rowspan='1' colspan='1'> entity name</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-11C98490'><code>EntityReference</code></a></td><td valign='top' rowspan='1' colspan='1'> name of entity referenced</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-5431D1B9'><code>Notation</code></a></td><td valign='top' rowspan='1' colspan='1'> notation name</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-1478689192'><code>ProcessingInstruction.target</code></a></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-837822393'><code>ProcessingInstruction.data</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> <a href='core.html#ID-1312295772'><code>Text</code></a></td><td valign='top' rowspan='1' colspan='1'> <code>"#text"</code></td><td valign='top' rowspan='1' colspan='1'> same as <a href='core.html#ID-72AB8359'><code>CharacterData.data</code></a>, the content of the text node</td><td valign='top' rowspan='1' colspan='1'> <code>null</code></td></tr> </table> </dd><dt><b>Definition group <i><a name='DocumentPosition'>DocumentPosition</a></i></b></dt> <dd><p>A bitmask indicating the relative document position of a node with respect to another node.<p>If the two nodes being compared are the same node, then no flags are set on the return.<p>Otherwise, the order of two nodes is determined by looking for common containers -- containers which contain both. A node directly contains any child nodes. A node also directly contains any other nodes attached to it such as attributes contained in an element or entities and notations contained in a document type. Nodes contained in contained nodes are also contained, but less-directly as the number of intervening containers increases.<p>If there is no common container node, then the order is based upon order between the root container of each node that is in no container. In this case, the result is disconnected and implementation-specific. This result is stable as long as these outer-most containing nodes remain in memory and are not inserted into some other containing node. This would be the case when the nodes belong to different documents or fragments, and cloning the document or inserting a fragment might change the order.<p>If one of the nodes being compared contains the other node, then the container precedes the contained node, and reversely the contained node follows the container. For example, when comparing an element against its own attribute or child, the element node precedes its attribute node and its child node, which both follow it.<p>If neither of the previous cases apply, then there exists a most-direct container common to both nodes being compared. In this case, the order is determined based upon the two determining nodes directly contained in this most-direct common container that either are or contain the corresponding nodes being compared.<p>If these two determining nodes are both child nodes, then the natural DOM order of these determining nodes within the containing node is returned as the order of the corresponding nodes. This would be the case, for example, when comparing two child elements of the same element.<p>If one of the two determining nodes is a child node and the other is not, then the corresponding node of the child node follows the corresponding node of the non-child node. This would be the case, for example, when comparing an attribute of an element with a child element of the same element.<p>If neither of the two determining node is a child node and one determining node has a greater value of <code>nodeType</code> than the other, then the corresponding node precedes the other. This would be the case, for example, when comparing an entity of a document type against a notation of the same document type.<p>If neither of the two determining node is a child node and <code>nodeType</code> is the same for both determining nodes, then an implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of the same nodeType are inserted into or removed from the direct container. This would be the case, for example, when comparing two attributes of the same element, and inserting or removing additional attributes might change the order between existing attributes.<dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='Node-DOCUMENT_POSITION_CONTAINED_BY'><code class='constant-name'>DOCUMENT_POSITION_CONTAINED_BY</code></a></dt><dd> The node is contained by the reference node. A node which is contained is always following, too.</dd> <dt><a name='Node-DOCUMENT_POSITION_CONTAINS'><code class='constant-name'>DOCUMENT_POSITION_CONTAINS</code></a></dt><dd> The node contains the reference node. A node which contains is always preceding, too.</dd> <dt><a name='Node-DOCUMENT_POSITION_DISCONNECTED'><code class='constant-name'>DOCUMENT_POSITION_DISCONNECTED</code></a></dt><dd> The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.</dd> <dt><a name='Node-DOCUMENT_POSITION_FOLLOWING'><code class='constant-name'>DOCUMENT_POSITION_FOLLOWING</code></a></dt><dd> The node follows the reference node.</dd> <dt><a name='Node-DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC'><code class='constant-name'>DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC</code></a></dt><dd> The determination of preceding versus following is implementation-specific.</dd> <dt><a name='Node-DOCUMENT_POSITION_PRECEDING'><code class='constant-name'>DOCUMENT_POSITION_PRECEDING</code></a></dt><dd> The second node precedes the reference node.</dd> </dl> </dd></dl> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-84CF096'>attributes</a></code> of type <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a>, readonly</dt> <dd>A <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> containing the attributes of this node (if it is an <a href='core.html#ID-745549614'><code>Element</code></a>) or <code>null</code> otherwise.<br> </dd> <dt><code class='attribute-name'><a name='Node3-baseURI'>baseURI</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>The absolute base URI of this node or <code>null</code> if the implementation wasn't able to obtain an absolute URI. This value is computed as described in <a href='core.html#baseURIs-Considerations'>Base URIs</a>. However, when the <a href='core.html#i-Document'><code>Document</code></a> supports the feature "HTML" [<cite><a class='noxref informative' href='references.html#DOM2HTML'>DOM Level 2 HTML</a></cite>], the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of the <code>documentURI</code> attribute from the <a class='noxref' href='core.html#i-Document'><code>Document</code></a> interface otherwise.<br> </dd> <dt><code class='attribute-name'><a name='ID-1451460987'>childNodes</a></code> of type <a href='core.html#ID-536297177'><code>NodeList</code></a>, readonly</dt> <dd>A <a href='core.html#ID-536297177'><code>NodeList</code></a> that contains all children of this node. If there are no children, this is a <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> containing no nodes.<br> </dd> <dt><code class='attribute-name'><a name='ID-169727388'>firstChild</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The first child of this node. If there is no such node, this returns <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-61AD09FB'>lastChild</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The last child of this node. If there is no such node, this returns <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-NodeNSLocalN'>localName</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>Returns the local part of the <a href='glossary.html#dt-qualifiedname'>qualified name</a> of this node.<br> For nodes of any type other than <code>ELEMENT_NODE</code> and <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 method, such as <a href='core.html#ID-2141741547'><code>Document.createElement()</code></a>, this is always <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-NodeNSname'>namespaceURI</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of this node, or <code>null</code> if it is unspecified (see <a href='core.html#Namespaces-Considerations'>XML Namespaces</a>).<br> This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.<br> For nodes of any type other than <code>ELEMENT_NODE</code> and <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 method, such as <a href='core.html#ID-2141741547'><code>Document.createElement()</code></a>, this is always <code>null</code>.<p><b>Note:</b> Per the <em>Namespaces in XML</em> Specification [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>] an attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.</p> </dd> <dt><code class='attribute-name'><a name='ID-6AC54C2F'>nextSibling</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The node immediately following this node. If there is no such node, this returns <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-F68D095'>nodeName</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The name of this node, depending on its type; see the table above.<br> </dd> <dt><code class='attribute-name'><a name='ID-111237558'>nodeType</a></code> of type <code>unsigned short</code>, readonly</dt> <dd>A code representing the type of the underlying object, as defined above.<br> </dd> <dt><code class='attribute-name'><a name='ID-F68D080'>nodeValue</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt> <dd>The value of this node, depending on its type; see the table above. When it is defined to be <code>null</code>, setting it has no effect, including if the node is <a href='glossary.html#dt-readonly-node'>read-only</a>.<br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if it is not defined to be <code>null</code>.</td></tr> </table> </div></div> <!-- exceptions --> <div class='exceptions'> <b>Exceptions on retrieval</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a <a href='core.html#DOMString'><code>DOMString</code></a> variable on the implementation platform.</td></tr> </table> </div></div> <!-- exceptions --> </dd> <dt><code class='attribute-name'><a name='node-ownerDoc'>ownerDocument</a></code> of type <a href='core.html#i-Document'><code>Document</code></a>, readonly, modified in <b class='version'>DOM Level 2</b></dt> <dd>The <a href='core.html#i-Document'><code>Document</code></a> object associated with this node. This is also the <a class='noxref' href='core.html#i-Document'><code>Document</code></a> object used to create new nodes. When this node is a <a class='noxref' href='core.html#i-Document'><code>Document</code></a> or a <a href='core.html#ID-412266927'><code>DocumentType</code></a> which is not used with any <a class='noxref' href='core.html#i-Document'><code>Document</code></a> yet, this is <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-1060184317'>parentNode</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The <a href='glossary.html#dt-parent'>parent</a> of this node. All nodes, except <a href='core.html#ID-637646024'><code>Attr</code></a>, <a href='core.html#i-Document'><code>Document</code></a>, <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>, <a href='core.html#ID-527DCFF2'><code>Entity</code></a>, and <a href='core.html#ID-5431D1B9'><code>Notation</code></a> may have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this is <code>null</code>. <br> </dd> <dt><code class='attribute-name'><a name='ID-NodeNSPrefix'>prefix</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a> of this node, or <code>null</code> if it is unspecified. When it is defined to be <code>null</code>, setting it has no effect, including if the node is <a href='glossary.html#dt-readonly-node'>read-only</a>.<br> Note that setting this attribute, when permitted, changes the <code>nodeName</code> attribute, which holds the <a href='glossary.html#dt-qualifiedname'>qualified name</a>, as well as the <code>tagName</code> and <code>name</code> attributes of the <a href='core.html#ID-745549614'><code>Element</code></a> and <a href='core.html#ID-637646024'><code>Attr</code></a> interfaces, when applicable.<br> Setting the prefix to <code>null</code> makes it unspecified, setting it to an empty string is implementation dependent.<br> Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since the <code>namespaceURI</code> and <code>localName</code> do not change.<br> For nodes of any type other than <code>ELEMENT_NODE</code> and <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1 method, such as <code>createElement</code> from the <a href='core.html#i-Document'><code>Document</code></a> interface, this is always <code>null</code>.<br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is malformed per the Namespaces in XML specification, if the <code>namespaceURI</code> of this node is <code>null</code>, if the specified prefix is "xml" and the <code>namespaceURI</code> of this node is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>", if this node is an attribute and the specified prefix is "xmlns" and the <code>namespaceURI</code> of this node is different from "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if this node is an attribute and the <code>qualifiedName</code> of this node is "xmlns" [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>].</td></tr> </table> </div></div> <!-- exceptions --> </dd> <dt><code class='attribute-name'><a name='ID-640FB3C8'>previousSibling</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The node immediately preceding this node. If there is no such node, this returns <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='Node3-textContent'>textContent</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, introduced in <b class='version'>DOM Level 3</b></dt> <dd>This attribute returns the text content of this node and its descendants. When it is defined to be <code>null</code>, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty or <code>null</code>, replaced by a single <a href='core.html#ID-1312295772'><code>Text</code></a> node containing the string this attribute is set to. <br> On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attribute <a href='core.html#Text3-isElementContentWhitespace'><code>Text.isElementContentWhitespace</code></a>). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content. <br> The string returned is made of the text content of this node depending on its type, as defined below: <table border='1' summary='The string returned is made of the text content of the node. The first cell of this table contains the type of the Node, the second cell indicates the string returned by textContent.' cellpadding='3' > <tr> <th rowspan='1' colspan='1'> Node type</th><th rowspan='1' colspan='1'> Content</th></tr> <tr> <td valign='top' rowspan='1' colspan='1'> ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODE</td><td valign='top' rowspan='1' colspan='1'> concatenation of the <code>textContent</code> attribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.</td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODE</td><td valign='top' rowspan='1' colspan='1'> <code>nodeValue</code></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODE</td><td valign='top' rowspan='1' colspan='1'> <em>null</em></td></tr> </table> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div class='exceptions'> <b>Exceptions on retrieval</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a <a href='core.html#DOMString'><code>DOMString</code></a> variable on the implementation platform.</td></tr> </table> </div></div> <!-- exceptions --> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-184E7107'>appendChild</a></code> modified in <b class='version'>DOM Level 3</b></dt> <dd> <div class='method'> Adds the node <code>newChild</code> to the end of the list of children of this node. If the <code>newChild</code> is already in the tree, it is first removed.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>newChild</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to add.<br> If it is a <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> object, the entire contents of the document fragment are moved into the child list of this node<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node added.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the <code>newChild</code> node, or if the node to append is one of this node's <a href='glossary.html#dt-ancestor'>ancestors</a> or this node itself, or if this node is of type <a href='core.html#i-Document'><code>Document</code></a> and the DOM application attempts to append a second <a href='core.html#ID-412266927'><code>DocumentType</code></a> or <a href='core.html#ID-745549614'><code>Element</code></a> node.<p>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created from a different document than the one that created this node.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.<p>NOT_SUPPORTED_ERR: if the <code>newChild</code> node is a child of the <a href='core.html#i-Document'><code>Document</code></a> node, this exception might be raised if the DOM implementation doesn't support the removal of the <a href='core.html#ID-412266927'><code>DocumentType</code></a> child or <a href='core.html#ID-745549614'><code>Element</code></a> child.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-3A0ED0A4'>cloneNode</a></code></dt> <dd> <div class='method'> Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (<code>parentNode</code> is <code>null</code>) and no user data. User data associated to the imported node is not carried over. However, if any <a href='core.html#UserDataHandler'><code>UserDataHandlers</code></a> has been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.<br> Cloning an <a href='core.html#ID-745549614'><code>Element</code></a> copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an the <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a> since the text is contained in a child <a href='core.html#ID-1312295772'><code>Text</code></a> node. Cloning an <a href='core.html#ID-637646024'><code>Attr</code></a> directly, as opposed to be cloned as part of an <a class='noxref' href='core.html#ID-745549614'><code>Element</code></a> cloning operation, returns a specified attribute (<code>specified</code> is <code>true</code>). Cloning an <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> always clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning an <a href='core.html#ID-11C98490'><code>EntityReference</code></a> automatically constructs its subtree if a corresponding <a href='core.html#ID-527DCFF2'><code>Entity</code></a> is available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.<br> Note that cloning an immutable subtree results in a mutable copy, but the children of an <a href='core.html#ID-11C98490'><code>EntityReference</code></a> clone are <a href='glossary.html#dt-readonly-node'>readonly</a>. In addition, clones of unspecified <a href='core.html#ID-637646024'><code>Attr</code></a> nodes are specified. And, cloning <a href='core.html#i-Document'><code>Document</code></a>, <a href='core.html#ID-412266927'><code>DocumentType</code></a>, <a href='core.html#ID-527DCFF2'><code>Entity</code></a>, and <a href='core.html#ID-5431D1B9'><code>Notation</code></a> nodes is implementation dependent.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>deep</code> of type <code>boolean</code></dt><dd> If <code>true</code>, recursively clone the subtree under the specified node; if <code>false</code>, clone only the node itself (and its attributes, if it is an <a href='core.html#ID-745549614'><code>Element</code></a>).<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The duplicate node.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-compareDocumentPosition'>compareDocumentPosition</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the <a href='glossary.html#dt-document-order'>document order</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>other</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to compare against the reference node.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>unsigned short</code></p></td><td> <p> Returns how the node is positioned relatively to the reference node.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-getFeature'>getFeature</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in <a href='core.html#Embedded-DOM'>Mixed DOM Implementations</a>. This method also allow the implementation to provide specialized objects which do not support the <code>Node</code> interface. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>feature</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method. <br> </dd> <dt><code class='parameter-name'>version</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> This is the version number of the feature to test. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMObject'><code>DOMObject</code></a></p></td><td> <p> Returns an object which implements the specialized APIs of the specified feature and version, if any, or <code>null</code> if there is no object which implements interfaces associated with that feature. If the <a class='noxref' href='core.html#DOMObject'><code>DOMObject</code></a> returned by this method implements the <code>Node</code> interface, it must delegate to the primary core <code>Node</code> and not return results inconsistent with the primary core <code>Node</code> such as attributes, childNodes, etc. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-getUserData'>getUserData</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Retrieves the object associated to a key on a this node. The object must first have been set to this node by calling <code>setUserData</code> with the same key.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>key</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The key the object is associated to.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMUserData'><code>DOMUserData</code></a></p></td><td> <p> Returns the <a class='noxref' href='core.html#DOMUserData'><code>DOMUserData</code></a> associated to the given key on this node, or <code>null</code> if there was none.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-NodeHasAttrs'>hasAttributes</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns whether this node (if it is an element) has any attributes. <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if this node has any attributes, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Parameters</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-810594187'>hasChildNodes</a></code></dt> <dd> <div class='method'> Returns whether this node has any children. <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if this node has any children, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Parameters</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-952280727'>insertBefore</a></code> modified in <b class='version'>DOM Level 3</b></dt> <dd> <div class='method'> Inserts the node <code>newChild</code> before the existing child node <code>refChild</code>. If <code>refChild</code> is <code>null</code>, insert <code>newChild</code> at the end of the list of children.<br> If <code>newChild</code> is a <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> object, all of its children are inserted, in the same order, before <code>refChild</code>. If the <code>newChild</code> is already in the tree, it is first removed.<p><b>Note:</b> Inserting a node before itself is implementation dependent. </p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>newChild</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to insert.<br> </dd> <dt><code class='parameter-name'>refChild</code> of type <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The reference node, i.e., the node before which the new node must be inserted.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node being inserted.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the <code>newChild</code> node, or if the node to insert is one of this node's <a href='glossary.html#dt-ancestor'>ancestors</a> or this node itself, or if this node is of type <a href='core.html#i-Document'><code>Document</code></a> and the DOM application attempts to insert a second <a href='core.html#ID-412266927'><code>DocumentType</code></a> or <a href='core.html#ID-745549614'><code>Element</code></a> node.<p>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created from a different document than the one that created this node.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.<p>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of this node.<p>NOT_SUPPORTED_ERR: if this node is of type <a href='core.html#i-Document'><code>Document</code></a>, this exception might be raised if the DOM implementation doesn't support the insertion of a <a href='core.html#ID-412266927'><code>DocumentType</code></a> or <a href='core.html#ID-745549614'><code>Element</code></a> node.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-isDefaultNamespace'>isDefaultNamespace</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> This method checks if the specified <code>namespaceURI</code> is the default namespace or not. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The namespace URI to look for.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if the specified <code>namespaceURI</code> is the default namespace, <code>false</code> otherwise. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-isEqualNode'>isEqualNode</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Tests whether two nodes are equal.<br> This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested with <a href='core.html#Node3-isSameNode'><code>Node.isSameNode()</code></a>. All nodes that are the same will also be equal, though the reverse may not be true.<br> Two nodes are equal if and only if the following conditions are satisfied: <ul> <li> The two nodes are of the same type.</li> <li> The following string attributes are equal: <code>nodeName</code>, <code>localName</code>, <code>namespaceURI</code>, <code>prefix</code>, <code>nodeValue</code>. This is: they are both <code>null</code>, or they have the same length and are character for character identical.</li> <li> The <code>attributes</code> <a href='core.html#ID-1780488922'><code>NamedNodeMaps</code></a> are equal. This is: they are both <code>null</code>, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.</li> <li> The <code>childNodes</code> <a href='core.html#ID-536297177'><code>NodeLists</code></a> are equal. This is: they are both <code>null</code>, or they have the same length and contain equal nodes at the same index. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.</li> </ul> <br> For two <a href='core.html#ID-412266927'><code>DocumentType</code></a> nodes to be equal, the following conditions must also be satisfied: <ul> <li> The following string attributes are equal: <code>publicId</code>, <code>systemId</code>, <code>internalSubset</code>.</li> <li> The <code>entities</code> <a href='core.html#ID-1780488922'><code>NamedNodeMaps</code></a> are equal.</li> <li> The <code>notations</code> <a href='core.html#ID-1780488922'><code>NamedNodeMaps</code></a> are equal.</li> </ul> <br> On the other hand, the following do not affect equality: the <code>ownerDocument</code>, <code>baseURI</code>, and <code>parentNode</code> attributes, the <code>specified</code> attribute for <a href='core.html#ID-637646024'><code>Attr</code></a> nodes, the <code>schemaTypeInfo</code> attribute for <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> and <a href='core.html#ID-745549614'><code>Element</code></a> nodes, the <a href='core.html#Text3-isElementContentWhitespace'><code>Text.isElementContentWhitespace</code></a> attribute for <a href='core.html#ID-1312295772'><code>Text</code></a> nodes, as well as any user data or event listeners registered on the nodes. <p><b>Note:</b> As a general rule, anything not mentioned in the description above is not significant in consideration of equality checking. Note that future versions of this specification may take into account more attributes and implementations conform to this specification are expected to be updated accordingly. </p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to compare equality with.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if the nodes are equal, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-isSameNode'>isSameNode</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Returns whether this node is the same node as the given one.<br> This method provides a way to determine whether two <code>Node</code> references returned by the implementation reference the same object. When two <code>Node</code> references are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>other</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node to test against.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if the nodes are the same, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Level-2-Core-Node-supports'>isSupported</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in <a href='core.html#DOMFeatures'>DOM Features</a>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>feature</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the feature to test. <br> </dd> <dt><code class='parameter-name'>version</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> This is the version number of the feature to test. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> Returns <code>true</code> if the specified feature is supported on this node, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-lookupNamespaceURI'>lookupNamespaceURI</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Look up the namespace URI associated to the given prefix, starting from this node.<br> See <a href='namespaces-algorithms.html#lookupNamespaceURIAlgo'>Namespace URI Lookup</a> for details on the algorithm used by this method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>prefix</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The prefix to look for. If this parameter is <code>null</code>, the method will return the default namespace URI if any.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> Returns the associated namespace URI or <code>null</code> if none is found.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-lookupNamespacePrefix'>lookupPrefix</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method.<br> See <a href='namespaces-algorithms.html#lookupNamespacePrefixAlgo'>Namespace Prefix Lookup</a> for details on the algorithm used by this method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The namespace URI to look for.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> Returns an associated namespace prefix if found or <code>null</code> if none is found. If more than one prefix are associated to the namespace prefix, the returned namespace prefix is implementation dependent.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-normalize'>normalize</a></code> modified in <b class='version'>DOM Level 3</b></dt> <dd> <div class='method'> Puts all <a href='core.html#ID-1312295772'><code>Text</code></a> nodes in the full depth of the sub-tree underneath this <code>Node</code>, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> nodes, i.e., there are neither adjacent <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> nodes nor empty <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer [<cite><a class='noxref informative' href='references.html#XPointer'>XPointer</a></cite>] lookups) that depend on a particular document tree structure are to be used. If the parameter "<a href='core.html#parameter-normalize-characters'>normalize-characters</a>" of the <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a> object attached to the <a href='core.html#node-ownerDoc'><code>Node.ownerDocument</code></a> is <code>true</code>, this method will also fully normalize the characters of the <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> nodes. <p><b>Note:</b> In cases where the document contains <a href='core.html#ID-667469212'><code>CDATASections</code></a>, the normalize operation alone may not be sufficient, since XPointers do not differentiate between <a href='core.html#ID-1312295772'><code>Text</code></a> nodes and <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes.</p> <p> <div><b>No Parameters</b></div> <div><b>No Return Value</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1734834066'>removeChild</a></code> modified in <b class='version'>DOM Level 3</b></dt> <dd> <div class='method'> Removes the child node indicated by <code>oldChild</code> from the list of children, and returns it.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>oldChild</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node being removed.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node removed.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of this node.<p>NOT_SUPPORTED_ERR: if this node is of type <a href='core.html#i-Document'><code>Document</code></a>, this exception might be raised if the DOM implementation doesn't support the removal of the <a href='core.html#ID-412266927'><code>DocumentType</code></a> child or the <a href='core.html#ID-745549614'><code>Element</code></a> child.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-785887307'>replaceChild</a></code> modified in <b class='version'>DOM Level 3</b></dt> <dd> <div class='method'> Replaces the child node <code>oldChild</code> with <code>newChild</code> in the list of children, and returns the <code>oldChild</code> node.<br> If <code>newChild</code> is a <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> object, <code>oldChild</code> is replaced by all of the <a class='noxref' href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a> children, which are inserted in the same order. If the <code>newChild</code> is already in the tree, it is first removed.<p><b>Note:</b> Replacing a node with itself is implementation dependent. </p> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>newChild</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The new node to put in the child list.<br> </dd> <dt><code class='parameter-name'>oldChild</code> of type <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> The node being replaced in the list.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node replaced.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of the <code>newChild</code> node, or if the node to put in is one of this node's <a href='glossary.html#dt-ancestor'>ancestors</a> or this node itself, or if this node is of type <a href='core.html#i-Document'><code>Document</code></a> and the result of the replacement operation would add a second <a href='core.html#ID-412266927'><code>DocumentType</code></a> or <a href='core.html#ID-745549614'><code>Element</code></a> on the <a class='noxref' href='core.html#i-Document'><code>Document</code></a> node.<p>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created from a different document than the one that created this node.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.<p>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of this node.<p>NOT_SUPPORTED_ERR: if this node is of type <a href='core.html#i-Document'><code>Document</code></a>, this exception might be raised if the DOM implementation doesn't support the replacement of the <a href='core.html#ID-412266927'><code>DocumentType</code></a> child or <a href='core.html#ID-745549614'><code>Element</code></a> child.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='Node3-setUserData'>setUserData</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Associate an object to a key on this node. The object can later be retrieved from this node by calling <code>getUserData</code> with the same key.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>key</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The key to associate the object to.<br> </dd> <dt><code class='parameter-name'>data</code> of type <a href='core.html#DOMUserData'><code>DOMUserData</code></a></dt><dd> The object to associate to the given key, or <code>null</code> to remove any existing association to that key.<br> </dd> <dt><code class='parameter-name'>handler</code> of type <a href='core.html#UserDataHandler'><code>UserDataHandler</code></a></dt><dd> The handler to associate to that key, or <code>null</code>.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMUserData'><code>DOMUserData</code></a></p></td><td> <p> Returns the <a class='noxref' href='core.html#DOMUserData'><code>DOMUserData</code></a> previously associated to the given key on this node, or <code>null</code> if there was none.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-536297177'>NodeList</a></i></b></dt> <dd> <p>The <code>NodeList</code> interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. <code>NodeList</code> objects in the DOM are <a href='core.html#td-live'>live</a>.<p>The items in the <code>NodeList</code> are accessible via an integral index, starting from 0. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-536297177'>NodeList</a> { <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-844377136'>item</a>(in unsigned long index); readonly attribute unsigned long <a class='noxref' href='core.html#ID-203510337'>length</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-203510337'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd>The number of nodes in the list. The range of valid child node indices is 0 to <code>length-1</code> inclusive.<br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-844377136'>item</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th item in the collection. If <code>index</code> is greater than or equal to the number of nodes in the list, this returns <code>null</code>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into the collection.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node at the <code>index</code>th position in the <code>NodeList</code>, or <code>null</code> if that is not a valid index.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-1780488922'>NamedNodeMap</a></i></b></dt> <dd> <p>Objects implementing the <code>NamedNodeMap</code> interface are used to represent collections of nodes that can be accessed by name. Note that <code>NamedNodeMap</code> does not inherit from <a href='core.html#ID-536297177'><code>NodeList</code></a>; <code>NamedNodeMaps</code> are not maintained in any particular order. Objects contained in an object implementing <code>NamedNodeMap</code> may also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of a <code>NamedNodeMap</code>, and does not imply that the DOM specifies an order to these Nodes. <p><code>NamedNodeMap</code> objects in the DOM are <a href='core.html#td-live'>live</a>. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-1780488922'>NamedNodeMap</a> { <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-1074577549'>getNamedItem</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-1025163788'>setNamedItem</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> arg) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-D58B193'>removeNamedItem</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-349467F9'>item</a>(in unsigned long index); readonly attribute unsigned long <a class='noxref' href='core.html#ID-6D0FB19E'>length</a>; // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-getNamedItemNS'>getNamedItemNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-setNamedItemNS'>setNamedItemNS</a>(in <a class='noxref' href='core.html#ID-1950641247'>Node</a> arg) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#ID-removeNamedItemNS'>removeNamedItemNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-6D0FB19E'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd>The number of nodes in this map. The range of valid child node indices is <code>0</code> to <code>length-1</code> inclusive.<br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-1074577549'>getNamedItem</a></code></dt> <dd> <div class='method'> Retrieves a node specified by name.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <code>nodeName</code> of a node to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> A <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> (of any type) with the specified <code>nodeName</code>, or <code>null</code> if it does not identify any node in this map.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-getNamedItemNS'>getNamedItemNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Retrieves a node specified by local name and namespace URI.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the node to retrieve.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the node to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> A <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> (of any type) with the specified local name and namespace URI, or <code>null</code> if they do not identify any node in this map.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-349467F9'>item</a></code></dt> <dd> <div class='method'> Returns the <code>index</code>th item in the map. If <code>index</code> is greater than or equal to the number of nodes in this map, this returns <code>null</code>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>index</code> of type <code>unsigned long</code></dt><dd> Index into this map.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node at the <code>index</code>th position in the map, or <code>null</code> if that is not a valid index.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-D58B193'>removeNamedItem</a></code></dt> <dd> <div class='method'> Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <code>nodeName</code> of the node to remove.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node removed from this map if a node with such a name exists.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in this map.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-removeNamedItemNS'>removeNamedItemNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of the <a href='core.html#ID-1950641247'><code>Node</code></a> interface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the node to remove.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the node to remove.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> The node removed from this map if a node with such a local name and namespace URI exists.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_FOUND_ERR: Raised if there is no node with the specified <code>namespaceURI</code> and <code>localName</code> in this map.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1025163788'>setNamedItem</a></code></dt> <dd> <div class='method'> Adds a node using its <code>nodeName</code> attribute. If a node with that name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.<br> As the <code>nodeName</code> attribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> A node to store in this map. The node will later be accessible using the value of its <code>nodeName</code> attribute.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> If the new <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> replaces an existing node the replaced <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> is returned, otherwise <code>null</code> is returned.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a different document than the one that created this map.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.<p>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an <a href='core.html#ID-637646024'><code>Attr</code></a> that is already an attribute of another <a href='core.html#ID-745549614'><code>Element</code></a> object. The DOM user must explicitly clone <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> nodes to re-use them in other elements.<p>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-setNamedItemNS'>setNamedItemNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Adds a node using its <code>namespaceURI</code> and <code>localName</code>. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> A node to store in this map. The node will later be accessible using the value of its <code>namespaceURI</code> and <code>localName</code> attributes.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1950641247'><code>Node</code></a></p></td><td> <p> If the new <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> replaces an existing node the replaced <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> is returned, otherwise <code>null</code> is returned.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a different document than the one that created this map.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.<p>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an <a href='core.html#ID-637646024'><code>Attr</code></a> that is already an attribute of another <a href='core.html#ID-745549614'><code>Element</code></a> object. The DOM user must explicitly clone <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> nodes to re-use them in other elements.<p>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-FF21A306'>CharacterData</a></i></b></dt> <dd> <p>The <code>CharacterData</code> interface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly to <code>CharacterData</code>, though <a href='core.html#ID-1312295772'><code>Text</code></a> and others do inherit the interface from it. All <code>offsets</code> in this interface start from <code>0</code>.<p>As explained in the <a href='core.html#DOMString'><code>DOMString</code></a> interface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term <a href='glossary.html#dt-16-bit-unit'>16-bit units</a> is used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-FF21A306'>CharacterData</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-72AB8359'>data</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on retrieval readonly attribute unsigned long <a class='noxref' href='core.html#ID-7D61178C'>length</a>; <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-6531BCCF'>substringData</a>(in unsigned long offset, in unsigned long count) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); void <a class='noxref' href='core.html#ID-32791A2F'>appendData</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> arg) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); void <a class='noxref' href='core.html#ID-3EDB695F'>insertData</a>(in unsigned long offset, in <a class='noxref' href='core.html#DOMString'>DOMString</a> arg) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); void <a class='noxref' href='core.html#ID-7C603781'>deleteData</a>(in unsigned long offset, in unsigned long count) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); void <a class='noxref' href='core.html#ID-E5CBA7FB'>replaceData</a>(in unsigned long offset, in unsigned long count, in <a class='noxref' href='core.html#DOMString'>DOMString</a> arg) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-72AB8359'>data</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt> <dd>The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in a <code>CharacterData</code> node. However, implementation limits may mean that the entirety of a node's data may not fit into a single <a href='core.html#DOMString'><code>DOMString</code></a>. In such cases, the user may call <code>substringData</code> to retrieve the data in appropriately sized pieces.<br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div class='exceptions'> <b>Exceptions on retrieval</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in a <a href='core.html#DOMString'><code>DOMString</code></a> variable on the implementation platform.</td></tr> </table> </div></div> <!-- exceptions --> </dd> <dt><code class='attribute-name'><a name='ID-7D61178C'>length</a></code> of type <code>unsigned long</code>, readonly</dt> <dd>The number of <a href='glossary.html#dt-16-bit-unit'>16-bit units</a> that are available through <code>data</code> and the <code>substringData</code> method below. This may have the value zero, i.e., <code>CharacterData</code> nodes may be empty.<br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-32791A2F'>appendData</a></code></dt> <dd> <div class='method'> Append the string to the end of the character data of the node. Upon success, <code>data</code> provides access to the concatenation of <code>data</code> and the <a href='core.html#DOMString'><code>DOMString</code></a> specified.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a> to append.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-7C603781'>deleteData</a></code></dt> <dd> <div class='method'> Remove a range of <a href='glossary.html#dt-16-bit-unit'>16-bit units</a> from the node. Upon success, <code>data</code> and <code>length</code> reflect the change.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>offset</code> of type <code>unsigned long</code></dt><dd> The offset from which to start removing.<br> </dd> <dt><code class='parameter-name'>count</code> of type <code>unsigned long</code></dt><dd> The number of 16-bit units to delete. If the sum of <code>offset</code> and <code>count</code> exceeds <code>length</code> then all 16-bit units from <code>offset</code> to the end of the data are deleted.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative or greater than the number of 16-bit units in <code>data</code>, or if the specified <code>count</code> is negative.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-3EDB695F'>insertData</a></code></dt> <dd> <div class='method'> Insert a string at the specified <a href='glossary.html#dt-16-bit-unit'>16-bit unit</a> offset.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>offset</code> of type <code>unsigned long</code></dt><dd> The character offset at which to insert.<br> </dd> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a> to insert.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative or greater than the number of 16-bit units in <code>data</code>.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-E5CBA7FB'>replaceData</a></code></dt> <dd> <div class='method'> Replace the characters starting at the specified <a href='glossary.html#dt-16-bit-unit'>16-bit unit</a> offset with the specified string.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>offset</code> of type <code>unsigned long</code></dt><dd> The offset from which to start replacing.<br> </dd> <dt><code class='parameter-name'>count</code> of type <code>unsigned long</code></dt><dd> The number of 16-bit units to replace. If the sum of <code>offset</code> and <code>count</code> exceeds <code>length</code>, then all 16-bit units to the end of the data are replaced; (i.e., the effect is the same as a <code>remove</code> method call with the same range, followed by an <code>append</code> method invocation).<br> </dd> <dt><code class='parameter-name'>arg</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a> with which the range must be replaced.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative or greater than the number of 16-bit units in <code>data</code>, or if the specified <code>count</code> is negative.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-6531BCCF'>substringData</a></code></dt> <dd> <div class='method'> Extracts a range of data from the node.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>offset</code> of type <code>unsigned long</code></dt><dd> Start offset of substring to extract.<br> </dd> <dt><code class='parameter-name'>count</code> of type <code>unsigned long</code></dt><dd> The number of 16-bit units to extract.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The specified substring. If the sum of <code>offset</code> and <code>count</code> exceeds the <code>length</code>, then all 16-bit units to the end of the data are returned.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is negative or greater than the number of 16-bit units in <code>data</code>, or if the specified <code>count</code> is negative.<p>DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into a <a href='core.html#DOMString'><code>DOMString</code></a>.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-637646024'>Attr</a></i></b></dt> <dd> <p>The <code>Attr</code> interface represents an attribute in an <a href='core.html#ID-745549614'><code>Element</code></a> object. Typically the allowable values for the attribute are defined in a schema associated with the document.</p><p><code>Attr</code> objects inherit the <a href='core.html#ID-1950641247'><code>Node</code></a> interface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> attributes <code>parentNode</code>, <code>previousSibling</code>, and <code>nextSibling</code> have a <code>null</code> value for <code>Attr</code> objects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore, <code>Attr</code> nodes may not be immediate children of a <a href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>. However, they can be associated with <a href='core.html#ID-745549614'><code>Element</code></a> nodes contained within a <a class='noxref' href='core.html#ID-B63ED1A3'><code>DocumentFragment</code></a>. In short, users and implementors of the DOM need to be aware that <code>Attr</code> nodes have some things in common with other objects inheriting the <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface, but they also are quite distinct.</p><p>The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that the <a href='core.html#ID-F68D080'><code>Node.nodeValue</code></a> attribute on the <code>Attr</code> instance can also be used to retrieve the string version of the attribute's value(s).</p><p> If the attribute was not explicitly given a value in the instance document but has a default value provided by the schema associated with the document, an attribute node will be created with <code>specified</code> set to <code>false</code>. Removing attribute nodes for which a default value is defined in the schema generates a new attribute node with the default value and <code>specified</code> set to <code>false</code>. If validation occurred while invoking <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, attribute nodes with <code>specified</code> equals to <code>false</code> are recomputed according to the default attribute values provided by the schema. If no default value is associate with this attribute in the schema, the attribute node is discarded. </p><p>In XML, where the value of an attribute can contain entity references, the child nodes of the <code>Attr</code> node may be either <a href='core.html#ID-1312295772'><code>Text</code></a> or <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes (when these are in use; see the description of <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> for discussion). </p><p>The DOM Core represents all attribute values as simple strings, even if the DTD or schema associated with the document declares them of some specific type such as <a href='glossary.html#dt-tokenized'>tokenized</a>. </p><p>The way attribute value normalization is performed by the DOM implementation depends on how much the implementation knows about the schema in use. Typically, the <code>value</code> and <code>nodeValue</code> attributes of an <code>Attr</code> node initially returns the normalized value given by the parser. It is also the case after <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> is called (assuming the right options have been set). But this may not be the case after mutation, independently of whether the mutation is performed by setting the string value directly or by changing the <code>Attr</code> child nodes. In particular, this is true when <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#dt-charref'><em>character references</em></a> are involved, given that they are not represented in the DOM and they impact attribute value normalization. On the other hand, if the implementation knows about the schema in use when the attribute value is changed, and it is of a different type than CDATA, it may normalize it again at that time. This is especially true of specialized DOM implementations, such as SVG DOM implementations, which store attribute values in an internal form different from a string.</p><p>The following table gives some examples of the relations between the attribute value in the original document (parsed attribute), the value as exposed in the DOM, and the serialization of the value: </p><table border='1' summary='Examples of differences between a parsed attribute, its DOM representation, and its serialization' cellpadding='3' > <tr> <th rowspan='1' colspan='1'> Examples</th><th rowspan='1' colspan='1'> Parsed attribute value</th><th rowspan='1' colspan='1'> Initial <a href='core.html#ID-221662474'><code>Attr.value</code></a></th><th rowspan='1' colspan='1'> Serialized attribute value</th></tr> <tr> <td valign='top' rowspan='1' colspan='1'> Character reference</td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x&#178;=5"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x²=5"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x&#178;=5"</pre> </div></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> Built-in character entity</td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"y&lt;6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"y<6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"y&lt;6"</pre> </div></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> Literal newline between</td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5&#10;y=6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5 y=6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5&#10;y=6"</pre> </div></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> Normalized newline between</td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5 y=6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5 y=6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre>"x=5 y=6"</pre> </div></td></tr> <tr> <td valign='top' rowspan='1' colspan='1'> Entity <code>e</code> with literal newline</td><td valign='top' rowspan='1' colspan='1'> <div class='eg'> <pre><!ENTITY e '...&#10;...'> [...]> "x=5&e;y=6"</pre> </div></td><td valign='top' rowspan='1' colspan='1'> <em>Dependent on Implementation and Load Options</em></td><td valign='top' rowspan='1' colspan='1'> <em>Dependent on Implementation and Load/Save Options</em></td></tr> </table> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-637646024'>Attr</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-1112119403'>name</a>; readonly attribute boolean <a class='noxref' href='core.html#ID-862529273'>specified</a>; attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-221662474'>value</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#ID-745549614'>Element</a> <a class='noxref' href='core.html#Attr-ownerElement'>ownerElement</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#TypeInfo'>TypeInfo</a> <a class='noxref' href='core.html#Attr-schemaTypeInfo'>schemaTypeInfo</a>; // Introduced in DOM Level 3: readonly attribute boolean <a class='noxref' href='core.html#Attr-isId'>isId</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='Attr-isId'>isId</a></code> of type <code>boolean</code>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd> Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, the <code>ownerElement</code> of this attribute can be retrieved using the method <a href='core.html#ID-getElBId'><code>Document.getElementById</code></a>. The implementation could use several ways to determine if an attribute node is known to contain an identifier: <ul> <li> If validation occurred using an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>] while loading the document or while invoking <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is a <i>schema-determined ID attribute</i> using the <a class='normative' href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-sdi'>schema-determined ID</a> definition in [<cite><a class='noxref normative' href='references.html#XPointer'>XPointer</a></cite>]. </li> <li> If validation occurred using a DTD while loading the document or while invoking <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, the infoset <b>[type definition]</b> value is used to determine if this attribute is a <i>DTD-determined ID attribute</i> using the <a class='normative' href='http://www.w3.org/TR/2003/REC-xptr-framework-20030325/#term-ddi'>DTD-determined ID</a> definition in [<cite><a class='noxref normative' href='references.html#XPointer'>XPointer</a></cite>]. </li> <li> from the use of the methods <a href='core.html#ID-ElSetIdAttr'><code>Element.setIdAttribute()</code></a>, <a href='core.html#ID-ElSetIdAttrNS'><code>Element.setIdAttributeNS()</code></a>, or <a href='core.html#ID-ElSetIdAttrNode'><code>Element.setIdAttributeNode()</code></a>, i.e. it is an <i>user-determined ID attribute</i>; <p><b>Note:</b> XPointer framework (see section 3.2 in [<cite><a class='noxref informative' href='references.html#XPointer'>XPointer</a></cite>]) consider the DOM <i>user-determined ID attribute</i> as being part of the XPointer <i>externally-determined ID</i> definition. </p> </li> <li> using mechanisms that are outside the scope of this specification, it is then an <i>externally-determined ID attribute</i>. This includes using schema languages different from XML schema and DTD. </li> </ul> <br> If validation occurred while invoking <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, all <i>user-determined ID attributes</i> are reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if the <a href='core.html#Attr-schemaTypeInfo'><code>Attr.schemaTypeInfo</code></a> attribute contains an ID type, <code>isId</code> will always return true. <br> </dd> <dt><code class='attribute-name'><a name='ID-1112119403'>name</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>Returns the name of this attribute. If <a href='core.html#ID-NodeNSLocalN'><code>Node.localName</code></a> is different from <code>null</code>, this attribute is a <a href='glossary.html#dt-qualifiedname'>qualified name</a>.<br> </dd> <dt><code class='attribute-name'><a name='Attr-ownerElement'>ownerElement</a></code> of type <a href='core.html#ID-745549614'><code>Element</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The <a href='core.html#ID-745549614'><code>Element</code></a> node this attribute is attached to or <code>null</code> if this attribute is not in use.<br> </dd> <dt><code class='attribute-name'><a name='Attr-schemaTypeInfo'>schemaTypeInfo</a></code> of type <a href='core.html#TypeInfo'><code>TypeInfo</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd> The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invoking <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>, <code>schemaTypeInfo</code> may not be reliable if the node was moved. <br> </dd> <dt><code class='attribute-name'><a name='ID-862529273'>specified</a></code> of type <code>boolean</code>, readonly</dt> <dd> <code>True</code> if this attribute was explicitly given a value in the instance document, <code>false</code> otherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set to <code>true</code>. The implementation may handle attributes with default values from other schemas similarly but applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> to guarantee this information is up-to-date. <br> </dd> <dt><code class='attribute-name'><a name='ID-221662474'>value</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt> <dd>On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the method <code>getAttribute</code> on the <a href='core.html#ID-745549614'><code>Element</code></a> interface.<br> On setting, this creates a <a href='core.html#ID-1312295772'><code>Text</code></a> node with the unparsed contents of the string, i.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the method <a href='core.html#ID-F68F082'><code>Element.setAttribute()</code></a>.<br> Some specialized implementations, such as some [<cite><a class='noxref informative' href='references.html#SVG1'>SVG 1.1</a></cite>] implementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting. <br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-745549614'>Element</a></i></b></dt> <dd> <p>The <code>Element</code> interface represents an <a href='glossary.html#dt-element'>element</a> in an HTML or XML document. Elements may have attributes associated with them; since the <code>Element</code> interface inherits from <a href='core.html#ID-1950641247'><code>Node</code></a>, the generic <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a> interface attribute <code>attributes</code> may be used to retrieve the set of all attributes for an element. There are methods on the <code>Element</code> interface to retrieve either an <a href='core.html#ID-637646024'><code>Attr</code></a> object by name or an attribute value by name. In XML, where an attribute value may contain entity references, an <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> object should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as a <a href='glossary.html#dt-convenience'>convenience</a>.<p><b>Note:</b> In DOM Level 2, the method <code>normalize</code> is inherited from the <a href='core.html#ID-1950641247'><code>Node</code></a> interface where it was moved.</p> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-745549614'>Element</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-104682815'>tagName</a>; <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-666EE0F9'>getAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); void <a class='noxref' href='core.html#ID-F68F082'>setAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name, in <a class='noxref' href='core.html#DOMString'>DOMString</a> value) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); void <a class='noxref' href='core.html#ID-6D6AC0F9'>removeAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-217A91B8'>getAttributeNode</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-887236154'>setAttributeNode</a>(in <a class='noxref' href='core.html#ID-637646024'>Attr</a> newAttr) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-D589198'>removeAttributeNode</a>(in <a class='noxref' href='core.html#ID-637646024'>Attr</a> oldAttr) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#ID-536297177'>NodeList</a> <a class='noxref' href='core.html#ID-1938918D'>getElementsByTagName</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); // Introduced in DOM Level 2: <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-ElGetAttrNS'>getAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: void <a class='noxref' href='core.html#ID-ElSetAttrNS'>setAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> qualifiedName, in <a class='noxref' href='core.html#DOMString'>DOMString</a> value) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: void <a class='noxref' href='core.html#ID-ElRemAtNS'>removeAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-ElGetAtNodeNS'>getAttributeNodeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-637646024'>Attr</a> <a class='noxref' href='core.html#ID-ElSetAtNodeNS'>setAttributeNodeNS</a>(in <a class='noxref' href='core.html#ID-637646024'>Attr</a> newAttr) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: <a class='noxref' href='core.html#ID-536297177'>NodeList</a> <a class='noxref' href='core.html#ID-A6C90942'>getElementsByTagNameNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 2: boolean <a class='noxref' href='core.html#ID-ElHasAttr'>hasAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name); // Introduced in DOM Level 2: boolean <a class='noxref' href='core.html#ID-ElHasAttrNS'>hasAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#TypeInfo'>TypeInfo</a> <a class='noxref' href='core.html#Element-schemaTypeInfo'>schemaTypeInfo</a>; // Introduced in DOM Level 3: void <a class='noxref' href='core.html#ID-ElSetIdAttr'>setIdAttribute</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name, in boolean isId) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: void <a class='noxref' href='core.html#ID-ElSetIdAttrNS'>setIdAttributeNS</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> namespaceURI, in <a class='noxref' href='core.html#DOMString'>DOMString</a> localName, in boolean isId) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: void <a class='noxref' href='core.html#ID-ElSetIdAttrNode'>setIdAttributeNode</a>(in <a class='noxref' href='core.html#ID-637646024'>Attr</a> idAttr, in boolean isId) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='Element-schemaTypeInfo'>schemaTypeInfo</a></code> of type <a href='core.html#TypeInfo'><code>TypeInfo</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd> The type information associated with this element. <br> </dd> <dt><code class='attribute-name'><a name='ID-104682815'>tagName</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The name of the element. If <a href='core.html#ID-NodeNSLocalN'><code>Node.localName</code></a> is different from <code>null</code>, this attribute is a <a href='glossary.html#dt-qualifiedname'>qualified name</a>. For example, in: <div class='code-block'> <pre> <elementExample id="demo"> ... </elementExample> , </pre> </div> <code>tagName</code> has the value <code>"elementExample"</code>. Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns the <code>tagName</code> of an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.<br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-666EE0F9'>getAttribute</a></code></dt> <dd> <div class='method'> Retrieves an attribute value by name.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The <a href='core.html#ID-637646024'><code>Attr</code></a> value as a string, or the empty string if that attribute does not have a specified or default value.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElGetAttrNS'>getAttributeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Retrieves an attribute value by local name and namespace URI.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to retrieve.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the attribute to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMString'><code>DOMString</code></a></p></td><td> <p> The <a href='core.html#ID-637646024'><code>Attr</code></a> value as a string, or the empty string if that attribute does not have a specified or default value.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-217A91B8'>getAttributeNode</a></code></dt> <dd> <div class='method'> Retrieves an attribute node by name.<br> To retrieve an attribute node by qualified name and namespace URI, use the <code>getAttributeNodeNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name (<code>nodeName</code>) of the attribute to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node with the specified name (<code>nodeName</code>) or <code>null</code> if there is no such attribute.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElGetAtNodeNS'>getAttributeNodeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Retrieves an <a href='core.html#ID-637646024'><code>Attr</code></a> node by local name and namespace URI.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to retrieve.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the attribute to retrieve.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node with the specified attribute local name and namespace URI or <code>null</code> if there is no such attribute.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-1938918D'>getElementsByTagName</a></code></dt> <dd> <div class='method'> Returns a <a href='core.html#ID-536297177'><code>NodeList</code></a> of all <a href='glossary.html#dt-descendant'>descendant</a> <code>Elements</code> with a given tag name, in <a href='glossary.html#dt-document-order'>document order</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the tag to match on. The special value "*" matches all tags.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-536297177'><code>NodeList</code></a></p></td><td> <p> A list of matching <code>Element</code> nodes.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-A6C90942'>getElementsByTagNameNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns a <a href='core.html#ID-536297177'><code>NodeList</code></a> of all the <a href='glossary.html#dt-descendant'>descendant</a> <code>Elements</code> with a given local name and namespace URI in <a href='glossary.html#dt-document-order'>document order</a>.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the elements to match on. The special value "*" matches all namespaces.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the elements to match on. The special value "*" matches all local names.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-536297177'><code>NodeList</code></a></p></td><td> <p> A new <a class='noxref' href='core.html#ID-536297177'><code>NodeList</code></a> object containing all the matched <code>Elements</code>.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElHasAttr'>hasAttribute</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns <code>true</code> when an attribute with a given name is specified on this element or has a default value, <code>false</code> otherwise.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute to look for.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if an attribute with the given name is specified on this element or has a default value, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElHasAttrNS'>hasAttributeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Returns <code>true</code> when an attribute with a given local name and namespace URI is specified on this element or has a default value, <code>false</code> otherwise.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to look for.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the attribute to look for.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if an attribute with the given local name and namespace URI is specified or has a default value on this element, <code>false</code> otherwise.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-6D6AC0F9'>removeAttribute</a></code></dt> <dd> <div class='method'> Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> to guarantee this information is up-to-date.<br> If no attribute with this name is found, this method has no effect.<br> To remove an attribute by local name and namespace URI, use the <code>removeAttributeNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute to remove.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElRemAtNS'>removeAttributeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Removes an attribute by local name and namespace URI. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> to guarantee this information is up-to-date.<br> If no attribute with this local name and namespace URI is found, this method has no effect.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to remove.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the attribute to remove.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-D589198'>removeAttributeNode</a></code></dt> <dd> <div class='method'> Removes the specified attribute node. If a default value for the removed <a href='core.html#ID-637646024'><code>Attr</code></a> node is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should use <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> to guarantee this information is up-to-date.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>oldAttr</code> of type <a href='core.html#ID-637646024'><code>Attr</code></a></dt><dd> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node to remove from the attribute list.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node that was removed.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute of the element.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-F68F082'>setAttribute</a></code></dt> <dd> <div class='method'> Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an <a href='core.html#ID-637646024'><code>Attr</code></a> node plus any <a href='core.html#ID-1312295772'><code>Text</code></a> and <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes, build the appropriate subtree, and use <code>setAttributeNode</code> to assign it as the value of an attribute.<br> To set an attribute with a qualified name and namespace URI, use the <code>setAttributeNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute to create or alter.<br> </dd> <dt><code class='parameter-name'>value</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> Value to set in string form.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElSetAttrNS'>setAttributeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of the <code>qualifiedName</code>, and its value is changed to be the <code>value</code> parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an <a href='core.html#ID-637646024'><code>Attr</code></a> node plus any <a href='core.html#ID-1312295772'><code>Text</code></a> and <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes, build the appropriate subtree, and use <code>setAttributeNodeNS</code> or <code>setAttributeNode</code> to assign it as the value of an attribute.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute to create or alter.<br> </dd> <dt><code class='parameter-name'>qualifiedName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-qualifiedname'>qualified name</a> of the attribute to create or alter.<br> </dd> <dt><code class='parameter-name'>value</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The value to set in string form.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to the XML version in use specified in the <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a> attribute.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is malformed per the Namespaces in XML specification, if the <code>qualifiedName</code> has a prefix and the <code>namespaceURI</code> is <code>null</code>, if the <code>qualifiedName</code> has a prefix that is "xml" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/XML/1998/namespace'>http://www.w3.org/XML/1998/namespace</a>", if the <code>qualifiedName</code> or its prefix is "xmlns" and the <code>namespaceURI</code> is different from "<a class='normative' href='http://www.w3.org/2000/xmlns/'>http://www.w3.org/2000/xmlns/</a>", or if the <code>namespaceURI</code> is "<a class='normative' 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".<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-887236154'>setAttributeNode</a></code></dt> <dd> <div class='method'> Adds a new attribute node. If an attribute with that name (<code>nodeName</code>) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.<br> To add a new attribute node with a qualified name and namespace URI, use the <code>setAttributeNodeNS</code> method.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>newAttr</code> of type <a href='core.html#ID-637646024'><code>Attr</code></a></dt><dd> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node to add to the attribute list.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> If the <code>newAttr</code> attribute replaces an existing attribute, the replaced <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node is returned, otherwise <code>null</code> is returned.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a different document than the one that created the element.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an attribute of another <code>Element</code> object. The DOM user must explicitly clone <a href='core.html#ID-637646024'><code>Attr</code></a> nodes to re-use them in other elements.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElSetAtNodeNS'>setAttributeNodeNS</a></code> introduced in <b class='since'>DOM Level 2</b></dt> <dd> <div class='method'> Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.<br> Per [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>], applications must use the value <code>null</code> as the <code>namespaceURI</code> parameter for methods if they wish to have no namespace.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>newAttr</code> of type <a href='core.html#ID-637646024'><code>Attr</code></a></dt><dd> The <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node to add to the attribute list.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-637646024'><code>Attr</code></a></p></td><td> <p> If the <code>newAttr</code> attribute replaces an existing attribute with the same <a href='glossary.html#dt-localname'>local name</a> and <a href='glossary.html#dt-namespaceURI'>namespace URI</a>, the replaced <a class='noxref' href='core.html#ID-637646024'><code>Attr</code></a> node is returned, otherwise <code>null</code> is returned.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a different document than the one that created the element.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an attribute of another <code>Element</code> object. The DOM user must explicitly clone <a href='core.html#ID-637646024'><code>Attr</code></a> nodes to re-use them in other elements.<p>NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature <code>"XML"</code> and the language exposed through the Document does not support XML Namespaces (such as [<cite><a class='noxref informative' href='references.html#HTML40'>HTML 4.01</a></cite>]). </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElSetIdAttr'>setIdAttribute</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> If the parameter <code>isId</code> is <code>true</code>, this method declares the specified attribute to be a <i>user-determined ID attribute</i>. This affects the value of <a href='core.html#Attr-isId'><code>Attr.isId</code></a> and the behavior of <a href='core.html#ID-getElBId'><code>Document.getElementById</code></a>, but does not change any schema that may be in use, in particular this does not affect the <a href='core.html#Attr-schemaTypeInfo'><code>Attr.schemaTypeInfo</code></a> of the specified <a href='core.html#ID-637646024'><code>Attr</code></a> node. Use the value <code>false</code> for the parameter <code>isId</code> to undeclare an attribute for being a <i>user-determined ID attribute</i>. <br> To specify an attribute by local name and namespace URI, use the <code>setIdAttributeNS</code> method. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the attribute.<br> </dd> <dt><code class='parameter-name'>isId</code> of type <code>boolean</code></dt><dd> Whether the attribute is a of type ID.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElSetIdAttrNS'>setIdAttributeNS</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> If the parameter <code>isId</code> is <code>true</code>, this method declares the specified attribute to be a <i>user-determined ID attribute</i>. This affects the value of <a href='core.html#Attr-isId'><code>Attr.isId</code></a> and the behavior of <a href='core.html#ID-getElBId'><code>Document.getElementById</code></a>, but does not change any schema that may be in use, in particular this does not affect the <a href='core.html#Attr-schemaTypeInfo'><code>Attr.schemaTypeInfo</code></a> of the specified <a href='core.html#ID-637646024'><code>Attr</code></a> node. Use the value <code>false</code> for the parameter <code>isId</code> to undeclare an attribute for being a <i>user-determined ID attribute</i>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>namespaceURI</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-namespaceURI'>namespace URI</a> of the attribute.<br> </dd> <dt><code class='parameter-name'>localName</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The <a href='glossary.html#dt-localname'>local name</a> of the attribute.<br> </dd> <dt><code class='parameter-name'>isId</code> of type <code>boolean</code></dt><dd> Whether the attribute is a of type ID.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-ElSetIdAttrNode'>setIdAttributeNode</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> If the parameter <code>isId</code> is <code>true</code>, this method declares the specified attribute to be a <i>user-determined ID attribute</i>. This affects the value of <a href='core.html#Attr-isId'><code>Attr.isId</code></a> and the behavior of <a href='core.html#ID-getElBId'><code>Document.getElementById</code></a>, but does not change any schema that may be in use, in particular this does not affect the <a href='core.html#Attr-schemaTypeInfo'><code>Attr.schemaTypeInfo</code></a> of the specified <a href='core.html#ID-637646024'><code>Attr</code></a> node. Use the value <code>false</code> for the parameter <code>isId</code> to undeclare an attribute for being a <i>user-determined ID attribute</i>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>idAttr</code> of type <a href='core.html#ID-637646024'><code>Attr</code></a></dt><dd> The attribute node.<br> </dd> <dt><code class='parameter-name'>isId</code> of type <code>boolean</code></dt><dd> Whether the attribute is a of type ID.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.<p>NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.</td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-1312295772'>Text</a></i></b></dt> <dd> <p>The <code>Text</code> interface inherits from <a href='core.html#ID-FF21A306'><code>CharacterData</code></a> and represents the textual content (termed <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#syntax'><em>character data</em></a> in XML) of an <a href='core.html#ID-745549614'><code>Element</code></a> or <a href='core.html#ID-637646024'><code>Attr</code></a>. If there is no markup inside an element's content, the text is contained in a single object implementing the <code>Text</code> interface that is the only child of the element. If there is markup, it is parsed into the <a href='glossary.html#dt-infoitem'>information items</a> (elements, comments, etc.) and <code>Text</code> nodes that form the list of children of the element.<p>When a document is first made available via the DOM, there is only one <code>Text</code> node for each block of text. Users may create adjacent <code>Text</code> nodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. The <a href='core.html#ID-normalize'><code>Node.normalize()</code></a> method merges any such adjacent <code>Text</code> objects into a single node for each block of text.<p> No lexical check is done on the content of a <code>Text</code> node and, depending on its position in the document, some characters must be escaped during serialization using character references; e.g. the characters "<&" if the textual content is part of an element or of an attribute, the character sequence "]]>" when part of an element, the quotation mark character " or the apostrophe character ' when part of an attribute. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-1312295772'>Text</a> : <a class='noxref' href='core.html#ID-FF21A306'>CharacterData</a> { <a class='noxref' href='core.html#ID-1312295772'>Text</a> <a class='noxref' href='core.html#ID-38853C1D'>splitText</a>(in unsigned long offset) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); // Introduced in DOM Level 3: readonly attribute boolean <a class='noxref' href='core.html#Text3-isElementContentWhitespace'>isElementContentWhitespace</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Text3-wholeText'>wholeText</a>; // Introduced in DOM Level 3: <a class='noxref' href='core.html#ID-1312295772'>Text</a> <a class='noxref' href='core.html#Text3-replaceWholeText'>replaceWholeText</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> content) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='Text3-isElementContentWhitespace'>isElementContentWhitespace</a></code> of type <code>boolean</code>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>Returns whether this text node contains <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'><em>element content whitespace</em></a>, often abusively called "ignorable whitespace". The text node is determined to contain whitespace in element content during the load of the document or if validation occurs while using <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a>.<br> </dd> <dt><code class='attribute-name'><a name='Text3-wholeText'>wholeText</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>Returns all text of <code>Text</code> nodes <a href='glossary.html#dt-logically-adjacent-text-nodes'>logically-adjacent text nodes</a> to this node, concatenated in document order.<br> For instance, in the example below <code>wholeText</code> on the <code>Text</code> node that contains "bar" returns "barfoo", while on the <code>Text</code> node that contains "foo" it returns "barfoo". <div class='figure' style='text-align: center'> <img src='./images/wholeTextExmpl.png' alt='barTextNode.wholeText value is "barfoo"' title='barTextNode.wholeText value is "barfoo"'> <p style='text-align:left'><i>Figure: barTextNode.wholeText value is "barfoo" </i> [<a href='./images/wholeTextExmpl'>SVG 1.0 version</a>] </p> </div> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='Text3-replaceWholeText'>replaceWholeText</a></code> introduced in <b class='since'>DOM Level 3</b></dt> <dd> <div class='method'> Replaces the text of the current node and all <a href='glossary.html#dt-logically-adjacent-text-nodes'>logically-adjacent text nodes</a> with the specified text. All <a href='glossary.html#dt-logically-adjacent-text-nodes'>logically-adjacent text nodes</a> are removed including the current node unless it was the recipient of the replacement text.<br> This method returns the node which received the replacement text. The returned node is: <ul> <li> <code>null</code>, when the replacement text is the empty string;</li> <li> the current node, except when the current node is <a href='glossary.html#dt-readonly-node'>read-only</a>;</li> <li> a new <code>Text</code> node of the same type (<code>Text</code> or <a href='core.html#ID-667469212'><code>CDATASection</code></a>) as the current node inserted at the location of the replacement.</li> </ul> <br> For instance, in the above example calling <code>replaceWholeText</code> on the <code>Text</code> node that contains "bar" with "yo" in argument results in the following: <div class='figure' style='text-align: center'> <img src='./images/wholeTextExmpl2.png' alt='barTextNode.replaceWholeText("yo") modifies the textual content of barTextNode with "yo"' title='barTextNode.replaceWholeText("yo") modifies the textual content of barTextNode with "yo"'> <p style='text-align:left'><i>Figure: barTextNode.replaceWholeText("yo") modifies the textual content of barTextNode with "yo" </i> [<a href='./images/wholeTextExmpl2'>SVG 1.0 version</a>] </p> </div> <br> Where the nodes to be removed are read-only descendants of an <a href='core.html#ID-11C98490'><code>EntityReference</code></a>, the <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> must be removed instead of the read-only nodes. If any <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a> to be removed has descendants that are not <a class='noxref' href='core.html#ID-11C98490'><code>EntityReference</code></a>, <code>Text</code>, or <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes, the <code>replaceWholeText</code> method must fail before performing any modification of the document, raising a <a href='core.html#ID-17189187'><code>DOMException</code></a> with the code <a href='core.html#DOMException-NO_MODIFICATION_ALLOWED_ERR'><code>NO_MODIFICATION_ALLOWED_ERR</code></a>.<br> For instance, in the example below calling <code>replaceWholeText</code> on the <code>Text</code> node that contains "bar" fails, because the <a href='core.html#ID-11C98490'><code>EntityReference</code></a> node "ent" contains an <a href='core.html#ID-745549614'><code>Element</code></a> node which cannot be removed.<div class='figure' style='text-align: center'> <img src='./images/wholeTextExmpl3.png' alt='barTextNode.replaceWholeText("yo") raises a NO_MODIFICATION_ALLOWED_ERR DOMException' title='barTextNode.replaceWholeText("yo") raises a NO_MODIFICATION_ALLOWED_ERR DOMException'> <p style='text-align:left'><i>Figure: barTextNode.replaceWholeText("yo") raises a NO_MODIFICATION_ALLOWED_ERR DOMException </i> [<a href='./images/wholeTextExmpl3'>SVG 1.0 version</a>] </p> </div> <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>content</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The content of the replacing <code>Text</code> node.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1312295772'><code>Text</code></a></p></td><td> <p> The <code>Text</code> node created with the specified content.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised if one of the <code>Text</code> nodes being replaced is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='ID-38853C1D'>splitText</a></code></dt> <dd> <div class='method'> Breaks this node into two nodes at the specified <code>offset</code>, keeping both in the tree as <a href='glossary.html#dt-sibling'>siblings</a>. After being split, this node will contain all the content up to the <code>offset</code> point. A new node of the same type, which contains all the content at and after the <code>offset</code> point, is returned. If the original node had a parent node, the new node is inserted as the next <a href='glossary.html#dt-sibling'>sibling</a> of the original node. When the <code>offset</code> is equal to the length of this node, the new node has no data.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>offset</code> of type <code>unsigned long</code></dt><dd> The <a href='glossary.html#dt-16-bit-unit'>16-bit unit</a> offset at which to split, starting from <code>0</code>.<br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#ID-1312295772'><code>Text</code></a></p></td><td> <p> The new node, of the same type as this node.</td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units in <code>data</code>.<p>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-1728279322'>Comment</a></i></b></dt> <dd> <p>This interface inherits from <a href='core.html#ID-FF21A306'><code>CharacterData</code></a> and represents the content of a comment, i.e., all the characters between the starting '<code><!--</code>' and ending '<code>--></code>'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure. <p> No lexical check is done on the content of a comment and it is therefore possible to have the character sequence <code>"--"</code> (double-hyphen) in the content, which is illegal in a comment per section 2.5 of [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. The presence of this character sequence must generate a fatal error during serialization. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-1728279322'>Comment</a> : <a class='noxref' href='core.html#ID-FF21A306'>CharacterData</a> { }; </pre> </div><br> </dd> </dl></dd> <dt><b>Interface <i><a name='TypeInfo'>TypeInfo</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> The <code>TypeInfo</code> interface represents a type referenced from <a href='core.html#ID-745549614'><code>Element</code></a> or <a href='core.html#ID-637646024'><code>Attr</code></a> nodes, specified in the <a href='glossary.html#dt-schema'>schemas</a> associated with the document. The type is a pair of a <a href='glossary.html#dt-namespaceURI'>namespace URI</a> and name properties, and depends on the document's schema. <p> If the document's schema is an XML DTD [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>], the values are computed as follows: <ul> <li> If this type is referenced from an <a href='core.html#ID-637646024'><code>Attr</code></a> node, <code>typeNamespace</code> is <code>"http://www.w3.org/TR/REC-xml"</code> and <code>typeName</code> represents the <b>[attribute type]</b> property in the [<cite><a class='noxref normative' href='references.html#InfoSet'>XML Information Set</a></cite>]. If there is no declaration for the attribute, <code>typeNamespace</code> and <code>typeName</code> are <code>null</code>. </li> <li> If this type is referenced from an <a href='core.html#ID-745549614'><code>Element</code></a> node, <code>typeNamespace</code> and <code>typeName</code> are <code>null</code>. </li> </ul> <p> If the document's schema is an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], the values are computed as follows using the post-schema-validation infoset contributions (also called PSVI contributions): <ul> <li> If the <b>[validity]</b> property exists AND is <em>"invalid"</em> or <em>"notKnown"</em>: the {target namespace} and {name} properties of the declared type if available, otherwise <code>null</code>. <p><b>Note:</b> At the time of writing, the XML Schema specification does not require exposing the declared type. Thus, DOM implementations might choose not to provide type information if validity is not valid. </p> </li> <li> If the <b>[validity]</b> property exists and is <em>"valid"</em>: <ol> <li> If <b>[member type definition]</b> exists: <ol> <li> If {name} is not absent, then expose {name} and {target namespace} properties of the <b>[member type definition]</b> property;</li> <li> Otherwise, expose the namespace and local name of the corresponding <a href='glossary.html#dt-anonymous'>anonymous type name</a>.</li> </ol> </li> <li> If the <b>[type definition]</b> property exists: <ol> <li> If {name} is not absent, then expose {name} and {target namespace} properties of the <b>[type definition]</b> property;</li> <li> Otherwise, expose the namespace and local name of the corresponding <a href='glossary.html#dt-anonymous'>anonymous type name</a>.</li> </ol> </li> <li> If the <b>[member type definition anonymous]</b> exists: <ol> <li> If it is false, then expose <b>[member type definition name]</b> and <b>[member type definition namespace]</b> properties;</li> <li> Otherwise, expose the namespace and local name of the corresponding <a href='glossary.html#dt-anonymous'>anonymous type name</a>.</li> </ol> </li> <li> If the <b>[type definition anonymous]</b> exists: <ol> <li> If it is false, then expose <b>[type definition name]</b> and <b>[type definition namespace]</b> properties;</li> <li> Otherwise, expose the namespace and local name of the corresponding <a href='glossary.html#dt-anonymous'>anonymous type name</a>.</li> </ol> </li> </ol> </li> </ul> <p><b>Note:</b> Other schema languages are outside the scope of the W3C and therefore should define how to represent their type systems using <code>TypeInfo</code>. </p> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#TypeInfo'>TypeInfo</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#TypeInfo-typeName'>typeName</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#TypeInfo-typeNamespace'>typeNamespace</a>; // DerivationMethods const unsigned long <a class='noxref' href='core.html#TypeInfo-DERIVATION_RESTRICTION'>DERIVATION_RESTRICTION</a> = 0x00000001; const unsigned long <a class='noxref' href='core.html#TypeInfo-DERIVATION_EXTENSION'>DERIVATION_EXTENSION</a> = 0x00000002; const unsigned long <a class='noxref' href='core.html#TypeInfo-DERIVATION_UNION'>DERIVATION_UNION</a> = 0x00000004; const unsigned long <a class='noxref' href='core.html#TypeInfo-DERIVATION_LIST'>DERIVATION_LIST</a> = 0x00000008; boolean <a class='noxref' href='core.html#TypeInfo-isDerivedFrom'>isDerivedFrom</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> typeNamespaceArg, in <a class='noxref' href='core.html#DOMString'>DOMString</a> typeNameArg, in unsigned long derivationMethod); }; </pre> </div><br> </dd> <dt><b>Definition group <i><a name='TypeInfo-DerivationMethods'>DerivationMethods</a></i></b></dt> <dd><p> These are the available values for the <code>derivationMethod</code> parameter used by the method <a href='core.html#TypeInfo-isDerivedFrom'><code>TypeInfo.isDerivedFrom()</code></a>. It is a set of possible types of derivation, and the values represent bit positions. If a bit in the <code>derivationMethod</code> parameter is set to <code>1</code>, the corresponding type of derivation will be taken into account when evaluating the derivation between the reference type definition and the other type definition. When using the <code>isDerivedFrom</code> method, combining all of them in the <code>derivationMethod</code> parameter is equivalent to invoking the method for each of them separately and combining the results with the OR boolean function. This specification only defines the type of derivation for XML Schema. <p> In addition to the types of derivation listed below, please note that: <ul> <li> any type derives from <code>xsd:anyType</code>. </li> <li> any simple type derives from <code>xsd:anySimpleType</code> by <i>restriction</i>. </li> <li> any complex type does not derive from <code>xsd:anySimpleType</code> by <i>restriction</i>. </li> </ul> <dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='TypeInfo-DERIVATION_EXTENSION'><code class='constant-name'>DERIVATION_EXTENSION</code></a></dt><dd> If the document's schema is an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], this constant represents the derivation by <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeExtension'><em>extension</em></a>. <br> <a name='id-extension'></a> The reference type definition is derived by <i>extension</i> from the other type definition if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and at least one of the <em>derivation methods</em> involved is an <i>extension</i>. </dd> <dt><a name='TypeInfo-DERIVATION_LIST'><code class='constant-name'>DERIVATION_LIST</code></a></dt><dd> If the document's schema is an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], this constant represents the <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-list'><em>list</em></a>. <br> <a name='id-list'></a>The reference type definition is derived by <i>list</i> from the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 by <code>DERIVATION_RESTRICTION</code> or <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>list</em>, and T2 is the {item type definition}. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition. </dd> <dt><a name='TypeInfo-DERIVATION_RESTRICTION'><code class='constant-name'>DERIVATION_RESTRICTION</code></a></dt><dd> If the document's schema is an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], this constant represents the derivation by <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-typeRestriction'><em>restriction</em></a> if complex types are involved, or a <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-restriction'><em>restriction</em></a> if simple types are involved. <br> <a name='id-restriction'></a> The reference type definition is derived by <i>restriction</i> from the other type definition if the other type definition is the same as the reference type definition, or if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and all the <em>derivation methods</em> involved are <i>restriction</i>. </dd> <dt><a name='TypeInfo-DERIVATION_UNION'><code class='constant-name'>DERIVATION_UNION</code></a></dt><dd> If the document's schema is an XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], this constant represents the <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-union'><em>union</em></a> if simple types are involved. <br> <a name='id-union'></a>The reference type definition is derived by <i>union</i> from the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 by <code>DERIVATION_RESTRICTION</code> or <code>DERIVATION_EXTENSION</code>, T2 is derived from the other type definition by <code>DERIVATION_RESTRICTION</code>, T1 has {variety} <em>union</em>, and one of the {member type definitions} is T2. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition. </dd> </dl> </dd></dl> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='TypeInfo-typeName'>typeName</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd> The name of a type declared for the associated element or attribute, or <code>null</code> if unknown. <br> </dd> <dt><code class='attribute-name'><a name='TypeInfo-typeNamespace'>typeNamespace</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd> The namespace of the type declared for the associated element or attribute or <code>null</code> if the element does not have declaration or if no namespace information is available. <br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='TypeInfo-isDerivedFrom'>isDerivedFrom</a></code></dt> <dd> <div class='method'> This method returns if there is a derivation between the reference type definition, i.e. the <code>TypeInfo</code> on which the method is being called, and the other type definition, i.e. the one passed as parameters. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>typeNamespaceArg</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> the namespace of the other type definition. <br> </dd> <dt><code class='parameter-name'>typeNameArg</code> of type <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a></dt><dd> the name of the other type definition. <br> </dd> <dt><code class='parameter-name'>derivationMethod</code> of type <code>unsigned long</code></dt><dd> the type of derivation and conditions applied between two types, as described in the list of constants provided in this interface. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> If the document's schema is a DTD or no schema is associated with the document, this method will always return <code>false</code>. <br> If the document's schema is an XML Schema, the method will <code>true</code> if the reference type definition is derived from the other type definition according to the derivation parameter. If the value of the parameter is <code>0</code> (no bit is set to <code>1</code> for the <code>derivationMethod</code> parameter), the method will return <code>true</code> if the other type definition can be reached by recursing any combination of {base type definition}, {item type definition}, or {member type definitions} from the reference type definition. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='UserDataHandler'>UserDataHandler</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p>When associating an object to a key on a node using <a href='core.html#Node3-setUserData'><code>Node.setUserData()</code></a> the application can provide a handler that gets called when the node the object is associated to is being cloned, imported, or renamed. This can be used by the application to implement various behaviors regarding the data it associates to the DOM nodes. This interface defines that handler. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#UserDataHandler'>UserDataHandler</a> { // OperationType const unsigned short <a class='noxref' href='core.html#UserDataHandler-CLONED'>NODE_CLONED</a> = 1; const unsigned short <a class='noxref' href='core.html#UserDataHandler-IMPORTED'>NODE_IMPORTED</a> = 2; const unsigned short <a class='noxref' href='core.html#UserDataHandler-DELETED'>NODE_DELETED</a> = 3; const unsigned short <a class='noxref' href='core.html#UserDataHandler-RENAMED'>NODE_RENAMED</a> = 4; const unsigned short <a class='noxref' href='core.html#UserDataHandler-ADOPTED'>NODE_ADOPTED</a> = 5; void <a class='noxref' href='core.html#ID-handleUserDataEvent'>handle</a>(in unsigned short operation, in <a class='noxref' href='core.html#DOMString'>DOMString</a> key, in <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> data, in <a class='noxref' href='core.html#ID-1950641247'>Node</a> src, in <a class='noxref' href='core.html#ID-1950641247'>Node</a> dst); }; </pre> </div><br> </dd> <dt><b>Definition group <i><a name='ID-UserDataOperation'>OperationType</a></i></b></dt> <dd><p>An integer indicating the type of operation being performed on a node.<dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='UserDataHandler-ADOPTED'><code class='constant-name'>NODE_ADOPTED</code></a></dt><dd> The node is adopted, using <a href='core.html#Document3-adoptNode'><code>Document.adoptNode()</code></a>.</dd> <dt><a name='UserDataHandler-CLONED'><code class='constant-name'>NODE_CLONED</code></a></dt><dd> The node is cloned, using <a href='core.html#ID-3A0ED0A4'><code>Node.cloneNode()</code></a>.</dd> <dt><a name='UserDataHandler-DELETED'><code class='constant-name'>NODE_DELETED</code></a></dt><dd> The node is deleted.<p><b>Note:</b> This may not be supported or may not be reliable in certain environments, such as Java, where the implementation has no real control over when objects are actually deleted.</p> </dd> <dt><a name='UserDataHandler-IMPORTED'><code class='constant-name'>NODE_IMPORTED</code></a></dt><dd> The node is imported, using <a href='core.html#Core-Document-importNode'><code>Document.importNode()</code></a>.</dd> <dt><a name='UserDataHandler-RENAMED'><code class='constant-name'>NODE_RENAMED</code></a></dt><dd> The node is renamed, using <a href='core.html#Document3-renameNode'><code>Document.renameNode()</code></a>.</dd> </dl> </dd></dl> </dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-handleUserDataEvent'>handle</a></code></dt> <dd> <div class='method'> This method is called whenever the node for which this handler is registered is imported or cloned.<br> DOM applications must not raise exceptions in a <code>UserDataHandler</code>. The effect of throwing exceptions from the handler is DOM implementation dependent. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>operation</code> of type <code>unsigned short</code></dt><dd> Specifies the type of operation that is being performed on the node.<br> </dd> <dt><code class='parameter-name'>key</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> Specifies the key for which this handler is being called. <br> </dd> <dt><code class='parameter-name'>data</code> of type <a href='core.html#DOMUserData'><code>DOMUserData</code></a></dt><dd> Specifies the data for which this handler is being called. <br> </dd> <dt><code class='parameter-name'>src</code> of type <a href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> Specifies the node being cloned, adopted, imported, or renamed. This is <code>null</code> when the node is being deleted.<br> </dd> <dt><code class='parameter-name'>dst</code> of type <a class='noxref' href='core.html#ID-1950641247'><code>Node</code></a></dt><dd> Specifies the node newly created if any, or <code>null</code>.<br> </dd> </dl> </div></div> <!-- parameters --> <p> <div><b>No Return Value</b></div> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='ERROR-Interfaces-DOMError'>DOMError</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p><code>DOMError</code> is an interface that describes an error. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#ERROR-Interfaces-DOMError'>DOMError</a> { // ErrorSeverity const unsigned short <a class='noxref' href='core.html#ERROR-DOMError-severity-warning'>SEVERITY_WARNING</a> = 1; const unsigned short <a class='noxref' href='core.html#ERROR-DOMError-severity-error'>SEVERITY_ERROR</a> = 2; const unsigned short <a class='noxref' href='core.html#ERROR-DOMError-severity-fatal-error'>SEVERITY_FATAL_ERROR</a> = 3; readonly attribute unsigned short <a class='noxref' href='core.html#ERROR-DOMError-severity'>severity</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ERROR-DOMError-message'>message</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ERROR-DOMError-type'>type</a>; readonly attribute <a class='noxref' href='core.html#DOMObject'>DOMObject</a> <a class='noxref' href='core.html#ERROR-DOMError-relatedException'>relatedException</a>; readonly attribute <a class='noxref' href='core.html#DOMObject'>DOMObject</a> <a class='noxref' href='core.html#ERROR-DOMError-relatedData'>relatedData</a>; readonly attribute <a class='noxref' href='core.html#Interfaces-DOMLocator'>DOMLocator</a> <a class='noxref' href='core.html#ERROR-DOMError-location'>location</a>; }; </pre> </div><br> </dd> <dt><b>Definition group <i><a name='DOMError-errorSeverityCodes'>ErrorSeverity</a></i></b></dt> <dd><p> An integer indicating the severity of the error. <dl> <dt><b>Defined Constants</b></dt> <dd><dl> <dt><a name='ERROR-DOMError-severity-error'><code class='constant-name'>SEVERITY_ERROR</code></a></dt><dd> The severity of the error described by the <code>DOMError</code> is error. A <code>SEVERITY_ERROR</code> may not cause the processing to stop if the error can be recovered, unless <a href='core.html#ID-ERRORS-DOMErrorHandler-handleError'><code>DOMErrorHandler.handleError()</code></a> returns <code>false</code>.</dd> <dt><a name='ERROR-DOMError-severity-fatal-error'><code class='constant-name'>SEVERITY_FATAL_ERROR</code></a></dt><dd> The severity of the error described by the <code>DOMError</code> is fatal error. A <code>SEVERITY_FATAL_ERROR</code> will cause the normal processing to stop. The return value of <a href='core.html#ID-ERRORS-DOMErrorHandler-handleError'><code>DOMErrorHandler.handleError()</code></a> is ignored unless the implementation chooses to continue, in which case the behavior becomes undefined.</dd> <dt><a name='ERROR-DOMError-severity-warning'><code class='constant-name'>SEVERITY_WARNING</code></a></dt><dd> The severity of the error described by the <code>DOMError</code> is warning. A <code>SEVERITY_WARNING</code> will not cause the processing to stop, unless <a href='core.html#ID-ERRORS-DOMErrorHandler-handleError'><code>DOMErrorHandler.handleError()</code></a> returns <code>false</code>.</dd> </dl> </dd></dl> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ERROR-DOMError-location'>location</a></code> of type <a href='core.html#Interfaces-DOMLocator'><code>DOMLocator</code></a>, readonly</dt> <dd>The location of the error.<br> </dd> <dt><code class='attribute-name'><a name='ERROR-DOMError-message'>message</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>An implementation specific string describing the error that occurred.<br> </dd> <dt><code class='attribute-name'><a name='ERROR-DOMError-relatedData'>relatedData</a></code> of type <a href='core.html#DOMObject'><code>DOMObject</code></a>, readonly</dt> <dd> The related <a href='core.html#ERROR-DOMError-type'><code>DOMError.type</code></a> dependent data if any. <br> </dd> <dt><code class='attribute-name'><a name='ERROR-DOMError-relatedException'>relatedException</a></code> of type <a href='core.html#DOMObject'><code>DOMObject</code></a>, readonly</dt> <dd>The related platform dependent exception if any.<br> </dd> <dt><code class='attribute-name'><a name='ERROR-DOMError-severity'>severity</a></code> of type <code>unsigned short</code>, readonly</dt> <dd>The severity of the error, either <code>SEVERITY_WARNING</code>, <code>SEVERITY_ERROR</code>, or <code>SEVERITY_FATAL_ERROR</code>.<br> </dd> <dt><code class='attribute-name'><a name='ERROR-DOMError-type'>type</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd> A <a href='core.html#DOMString'><code>DOMString</code></a> indicating which related data is expected in <code>relatedData</code>. Users should refer to the specification of the error in order to find its <a class='noxref' href='core.html#DOMString'><code>DOMString</code></a> type and <code>relatedData</code> definitions if any. <p><b>Note:</b> As an example, <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> does generate warnings when the "<a href='core.html#parameter-split-cdata-sections'>split-cdata-sections</a>" parameter is in use. Therefore, the method generates a <code>SEVERITY_WARNING</code> with <code>type</code> <code>"cdata-sections-splitted"</code> and the first <a href='core.html#ID-667469212'><code>CDATASection</code></a> node in document order resulting from the split is returned by the <code>relatedData</code> attribute. </p> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='ERROR-Interfaces-DOMErrorHandler'>DOMErrorHandler</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> <code>DOMErrorHandler</code> is a callback interface that the DOM implementation can call when reporting errors that happens while processing XML data, or when doing some other processing (e.g. validating a document). A <code>DOMErrorHandler</code> object can be attached to a <a href='core.html#i-Document'><code>Document</code></a> using the "<a href='core.html#parameter-error-handler'>error-handler</a>" on the <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a> interface. If more than one error needs to be reported during an operation, the sequence and numbers of the errors passed to the error handler are implementation dependent. <p> The application that is using the DOM implementation is expected to implement this interface. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#ERROR-Interfaces-DOMErrorHandler'>DOMErrorHandler</a> { boolean <a class='noxref' href='core.html#ID-ERRORS-DOMErrorHandler-handleError'>handleError</a>(in <a class='noxref' href='core.html#ERROR-Interfaces-DOMError'>DOMError</a> error); }; </pre> </div><br> </dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='ID-ERRORS-DOMErrorHandler-handleError'>handleError</a></code></dt> <dd> <div class='method'> This method is called on the error handler when an error occurs.<br> If an exception is thrown from this method, it is considered to be equivalent of returning <code>true</code>. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>error</code> of type <a href='core.html#ERROR-Interfaces-DOMError'><code>DOMError</code></a></dt><dd> The error object that describes the error. This object may be reused by the DOM implementation across multiple calls to the <code>handleError</code> method. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> If the <code>handleError</code> method returns <code>false</code>, the DOM implementation should stop the current processing when possible. If the method returns <code>true</code>, the processing may continue depending on <a href='core.html#ERROR-DOMError-severity'><code>DOMError.severity</code></a>. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> <dt><b>Interface <i><a name='Interfaces-DOMLocator'>DOMLocator</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p><code>DOMLocator</code> is an interface that describes a location (e.g. where an error occurred). <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#Interfaces-DOMLocator'>DOMLocator</a> { readonly attribute long <a class='noxref' href='core.html#DOMLocator-line-number'>lineNumber</a>; readonly attribute long <a class='noxref' href='core.html#DOMLocator-column-number'>columnNumber</a>; readonly attribute long <a class='noxref' href='core.html#DOMLocator-byteOffset'>byteOffset</a>; readonly attribute long <a class='noxref' href='core.html#DOMLocator-utf16Offset'>utf16Offset</a>; readonly attribute <a class='noxref' href='core.html#ID-1950641247'>Node</a> <a class='noxref' href='core.html#DOMLocator-node'>relatedNode</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#DOMLocator-uri'>uri</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='DOMLocator-byteOffset'>byteOffset</a></code> of type <code>long</code>, readonly</dt> <dd>The byte offset into the input source this locator is pointing to or <code>-1</code> if there is no byte offset available.<br> </dd> <dt><code class='attribute-name'><a name='DOMLocator-column-number'>columnNumber</a></code> of type <code>long</code>, readonly</dt> <dd>The column number this locator is pointing to, or <code>-1</code> if there is no column number available.<br> </dd> <dt><code class='attribute-name'><a name='DOMLocator-line-number'>lineNumber</a></code> of type <code>long</code>, readonly</dt> <dd>The line number this locator is pointing to, or <code>-1</code> if there is no column number available.<br> </dd> <dt><code class='attribute-name'><a name='DOMLocator-node'>relatedNode</a></code> of type <a href='core.html#ID-1950641247'><code>Node</code></a>, readonly</dt> <dd>The node this locator is pointing to, or <code>null</code> if no node is available.<br> </dd> <dt><code class='attribute-name'><a name='DOMLocator-uri'>uri</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The URI this locator is pointing to, or <code>null</code> if no URI is available.<br> </dd> <dt><code class='attribute-name'><a name='DOMLocator-utf16Offset'>utf16Offset</a></code> of type <code>long</code>, readonly</dt> <dd>The UTF-16, as defined in [<cite><a class='noxref normative' href='references.html#Unicode'>Unicode</a></cite>] and Amendment 1 of [<cite><a class='noxref normative' href='references.html#ISO10646'>ISO/IEC 10646</a></cite>], offset into the input source this locator is pointing to or <code>-1</code> if there is no UTF-16 offset available.<br> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='DOMConfiguration'>DOMConfiguration</a></i></b> (introduced in <b class='since'>DOM Level 3</b>)</dt> <dd> <p> The <code>DOMConfiguration</code> interface represents the configuration of a document and maintains a table of recognized parameters. Using the configuration, it is possible to change <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> behavior, such as replacing the <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes with <a href='core.html#ID-1312295772'><code>Text</code></a> nodes or specifying the type of the <a href='glossary.html#dt-schema'>schema</a> that must be used when the validation of the <a href='core.html#i-Document'><code>Document</code></a> is requested. <code>DOMConfiguration</code> objects are also used in [<cite><a class='noxref informative' href='references.html#DOMLS'>DOM Level 3 Load and Save</a></cite>] in the <code>DOMParser</code> and <code>DOMSerializer</code> interfaces. <p> The parameter names used by the <code>DOMConfiguration</code> object are defined throughout the DOM Level 3 specifications. Names are case-insensitive. To avoid possible conflicts, as a convention, names referring to parameters defined outside the DOM specification should be made unique. Because parameters are exposed as properties in the <a href='ecma-script-binding.html#ecma-binding'>ECMAScript Language Binding</a>, names are recommended to follow the section <cite>"5.16 Identifiers"</cite> of [<cite><a class='noxref informative' href='references.html#Unicode'>Unicode</a></cite>] with the addition of the character '-' (HYPHEN-MINUS) but it is not enforced by the DOM implementation. DOM Level 3 Core Implementations are required to recognize all parameters defined in this specification. Some parameter values may also be required to be supported by the implementation. Refer to the definition of the parameter to know if a value must be supported or not. <p><b>Note:</b> Parameters are similar to features and properties used in SAX2 [<cite><a class='noxref informative' href='references.html#SAX'>SAX</a></cite>]. </p> <p> The following list of parameters defined in the DOM: <dl> <dt><a name='parameter-canonical-form'><code>"canonical-form"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> Canonicalize the document according to the rules specified in [<cite><a class='noxref informative' href='references.html#c14n'>Canonical XML</a></cite>], such as removing the <a href='core.html#ID-412266927'><code>DocumentType</code></a> node (if any) from the tree, or removing superfluous namespace declarations from each element. Note that this is limited to what can be represented in the DOM; in particular, there is no way to specify the order of the attributes in the DOM. In addition, <br> Setting this parameter to <code>true</code> will also set the state of the parameters listed below. Later changes to the state of one of those parameters will revert "<a href='core.html#parameter-canonical-form'>canonical-form</a>" back to <code>false</code>. <br> Parameters set to <code>false</code>: "<a href='core.html#parameter-entities'>entities</a>", "<a href='core.html#parameter-normalize-characters'>normalize-characters</a>", "<a href='core.html#parameter-cdata-sections'>cdata-sections</a>". <br> Parameters set to <code>true</code>: "<a href='core.html#parameter-namespaces'>namespaces</a>", "<a href='core.html#parameter-namespace-declarations'>namespace-declarations</a>", "<a href='core.html#parameter-well-formed'>well-formed</a>", "<a href='core.html#parameter-element-content-whitespace'>element-content-whitespace</a>". <br> Other parameters are not changed unless explicitly specified in the description of the parameters.</dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Do not canonicalize the document.</dd></dl> </dd><dt><a name='parameter-cdata-sections'><code>"cdata-sections"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Keep <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes in the document.</dd><dt><code>false</code></dt> <dd>[<em>required</em>]<br> Transform <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes in the document into <a href='core.html#ID-1312295772'><code>Text</code></a> nodes. The new <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> node is then combined with any adjacent <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> node.</dd></dl> </dd><dt><a name='parameter-check-character-normalization'><code>"check-character-normalization"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> Check if the characters in the document are <a class='normative' href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>fully normalized</a>, as defined in appendix B of [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>]. When a sequence of characters is encountered that fails normalization checking, an error with the <a href='core.html#ERROR-DOMError-type'><code>DOMError.type</code></a> equals to "check-character-normalization-failure" is issued. </dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Do not check if characters are normalized.</dd></dl> </dd><dt><a name='parameter-comments'><code>"comments"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Keep <a href='core.html#ID-1728279322'><code>Comment</code></a> nodes in the document.</dd><dt><code>false</code></dt> <dd>[<em>required</em>]<br> Discard <a href='core.html#ID-1728279322'><code>Comment</code></a> nodes in the document.</dd></dl> </dd><dt><a name='parameter-datatype-normalization'><code>"datatype-normalization"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> Expose schema normalized values in the tree, such as <a class='normative' href='http://www.w3.org/TR/2001/REC-xmlschema-1-20010502/#key-nv'>XML Schema normalized values</a> in the case of XML Schema. Since this parameter requires to have <a href='glossary.html#dt-schema'>schema</a> information, the "<a href='core.html#parameter-validate'>validate</a>" parameter will also be set to <code>true</code>. Having this parameter activated when "validate" is <code>false</code> has no effect and no schema-normalization will happen. <p><b>Note:</b> Since the document contains the result of the XML 1.0 processing, this parameter does not apply to attribute value normalization as defined in section 3.3.3 of [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>] and is only meant for <a href='glossary.html#dt-schema'>schema</a> languages other than Document Type Definition (DTD). </p> </dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Do not perform schema normalization on the tree. </dd></dl> </dd><dt><a name='parameter-element-content-whitespace'><code>"element-content-whitespace"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Keep all whitespaces in the document.</dd><dt><code>false</code></dt> <dd>[<em>optional</em>]<br> Discard all <a href='core.html#ID-1312295772'><code>Text</code></a> nodes that contain whitespaces in element content, as described in <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204#infoitem.character'><em>[element content whitespace]</em></a>. The implementation is expected to use the attribute <a href='core.html#Text3-isElementContentWhitespace'><code>Text.isElementContentWhitespace</code></a> to determine if a <a class='noxref' href='core.html#ID-1312295772'><code>Text</code></a> node should be discarded or not.</dd></dl> </dd><dt><a name='parameter-entities'><code>"entities"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Keep <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes in the document.</dd><dt><code>false</code></dt> <dd>[<em>required</em>]<br> Remove all <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes from the document, putting the entity expansions directly in their place. <a href='core.html#ID-1312295772'><code>Text</code></a> nodes are normalized, as defined in <a href='core.html#ID-normalize'><code>Node.normalize</code></a>. Only <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.rse'>unexpanded entity references</a> are kept in the document. </dd></dl> <p><b>Note:</b> This parameter does not affect <a href='core.html#ID-527DCFF2'><code>Entity</code></a> nodes. </p> </dd><dt><a name='parameter-error-handler'><code>"error-handler"</code></a></dt> <dd>[<em>required</em>]<br> Contains a <a href='core.html#ERROR-Interfaces-DOMErrorHandler'><code>DOMErrorHandler</code></a> object. If an error is encountered in the document, the implementation will call back the <a class='noxref' href='core.html#ERROR-Interfaces-DOMErrorHandler'><code>DOMErrorHandler</code></a> registered using this parameter. The implementation may provide a default <a class='noxref' href='core.html#ERROR-Interfaces-DOMErrorHandler'><code>DOMErrorHandler</code></a> object. <br> When called, <a href='core.html#ERROR-DOMError-relatedData'><code>DOMError.relatedData</code></a> will contain the closest node to where the error occurred. If the implementation is unable to determine the node where the error occurs, <a class='noxref' href='core.html#ERROR-DOMError-relatedData'><code>DOMError.relatedData</code></a> will contain the <a href='core.html#i-Document'><code>Document</code></a> node. Mutations to the document from within an error handler will result in implementation dependent behavior. </dd><dt><a name='parameter-infoset'><code>"infoset"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>]<br> Keep in the document the information defined in the XML Information Set [<cite><a class='noxref normative' href='references.html#InfoSet'>XML Information Set</a></cite>].<br> This forces the following parameters to <code>false</code>: "<a href='core.html#parameter-validate-if-schema'>validate-if-schema</a>", "<a href='core.html#parameter-entities'>entities</a>", "<a href='core.html#parameter-datatype-normalization'>datatype-normalization</a>", "<a href='core.html#parameter-cdata-sections'>cdata-sections</a>".<br> This forces the following parameters to <code>true</code>: "<a href='core.html#parameter-namespace-declarations'>namespace-declarations</a>", "<a href='core.html#parameter-well-formed'>well-formed</a>", "<a href='core.html#parameter-element-content-whitespace'>element-content-whitespace</a>", "<a href='core.html#parameter-comments'>comments</a>", "<a href='core.html#parameter-namespaces'>namespaces</a>".<br> Other parameters are not changed unless explicitly specified in the description of the parameters.<br> Note that querying this parameter with <code>getParameter</code> returns <code>true</code> only if the individual parameters specified above are appropriately set.</dd><dt><code>false</code></dt> <dd>Setting <code>infoset</code> to <code>false</code> has no effect.</dd></dl> </dd><dt><a name='parameter-namespaces'><code>"namespaces"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Perform the namespace processing as defined in <a href='namespaces-algorithms.html#normalizeDocumentAlgo'>Namespace Normalization</a>. </dd><dt><code>false</code></dt> <dd>[<em>optional</em>]<br> Do not perform the namespace processing. </dd></dl> </dd><dt><a name='parameter-namespace-declarations'><code>"namespace-declarations"</code></a></dt> <dd> This parameter has no effect if the parameter "<a href='core.html#parameter-namespaces'>namespaces</a>" is set to <code>false</code>. <dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Include namespace declaration attributes, specified or defaulted from the <a href='glossary.html#dt-schema'>schema</a>, in the document. See also the sections "Declaring Namespaces" in [<cite><a class='noxref normative' href='references.html#Namespaces'>XML Namespaces</a></cite>] and [<cite><a class='noxref normative' href='references.html#Namespaces11'>XML Namespaces 1.1</a></cite>].</dd><dt><code>false</code></dt> <dd>[<em>required</em>]<br> Discard all namespace declaration attributes. The namespace prefixes (<a href='core.html#ID-NodeNSPrefix'><code>Node.prefix</code></a>) are retained even if this parameter is set to <code>false</code>.</dd></dl> </dd><dt><a name='parameter-normalize-characters'><code>"normalize-characters"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> <a class='normative' href='http://www.w3.org/TR/2004/REC-xml11-20040204/#dt-fullnorm'>Fully normalized</a> the characters in the document as defined in appendix B of [<cite><a class='noxref normative' href='references.html#XML11'>XML 1.1</a></cite>]. </dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Do not perform character normalization.</dd></dl> </dd><dt><a name='parameter-schema-location'><code>"schema-location"</code></a></dt> <dd>[<em>optional</em>]<br> Represent a <a href='core.html#DOMString'><code>DOMString</code></a> object containing a list of URIs, separated by whitespaces (characters matching the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#NT-S'><em>nonterminal production S</em></a> defined in section 2.3 [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]), that represents the <a href='glossary.html#dt-schema'>schemas</a> against which validation should occur, i.e. the current schema. The types of schemas referenced in this list must match the type specified with <code>schema-type</code>, otherwise the behavior of an implementation is undefined. <br> The schemas specified using this property take precedence to the schema information specified in the document itself. For namespace aware schema, if a schema specified using this property and a schema specified in the document instance (i.e. using the <code>schemaLocation</code> attribute) in a schema document (i.e. using schema <code>import</code> mechanisms) share the same <code>targetNamespace</code>, the schema specified by the user using this property will be used. If two schemas specified using this property share the same <code>targetNamespace</code> or have no namespace, the behavior is implementation dependent. <br> If no location has been provided, this parameter is <code>null</code>. <p><b>Note:</b> The <code>"schema-location"</code> parameter is ignored unless the "<a href='core.html#parameter-schema-type'>schema-type</a>" parameter value is set. It is strongly recommended that <a href='core.html#Document3-documentURI'><code>Document.documentURI</code></a> will be set so that an implementation can successfully resolve any external entities referenced. </p> </dd><dt><a name='parameter-schema-type'><code>"schema-type"</code></a></dt> <dd>[<em>optional</em>]<br> Represent a <a href='core.html#DOMString'><code>DOMString</code></a> object containing an absolute URI and representing the type of the <a href='glossary.html#dt-schema'>schema</a> language used to validate a document against. Note that no lexical checking is done on the absolute URI. <br> If this parameter is not set, a default value may be provided by the implementation, based on the schema languages supported and on the schema language used at load time. If no value is provided, this parameter is <code>null</code>. <p><b>Note:</b> For XML Schema [<cite><a class='noxref normative' href='references.html#XMLSchema1'>XML Schema Part 1</a></cite>], applications must use the value <code>"http://www.w3.org/2001/XMLSchema"</code>. For XML DTD [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>], applications must use the value <code>"http://www.w3.org/TR/REC-xml"</code>. Other schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method. </p> </dd><dt><a name='parameter-split-cdata-sections'><code>"split-cdata-sections"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Split CDATA sections containing the CDATA section termination marker ']]>'. When a CDATA section is split a warning is issued with a <a href='core.html#ERROR-DOMError-type'><code>DOMError.type</code></a> equals to <code>"cdata-sections-splitted"</code> and <a href='core.html#ERROR-DOMError-relatedData'><code>DOMError.relatedData</code></a> equals to the first <a href='core.html#ID-667469212'><code>CDATASection</code></a> node in document order resulting from the split.</dd><dt><code>false</code></dt> <dd>[<em>required</em>]<br> Signal an error if a <a href='core.html#ID-667469212'><code>CDATASection</code></a> contains an unrepresentable character.</dd></dl> </dd><dt><a name='parameter-validate'><code>"validate"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> Require the validation against a <a href='glossary.html#dt-schema'>schema</a> (i.e. XML schema, DTD, any other type or representation of schema) of the document as it is being normalized as defined by [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. If validation errors are found, or no schema was found, the error handler is notified. Schema-normalized values will not be exposed according to the schema in used unless the parameter "<a href='core.html#parameter-datatype-normalization'>datatype-normalization</a>" is <code>true</code>. <br> This parameter will reevaluate: <ul> <li> Attribute nodes with <a href='core.html#ID-862529273'><code>Attr.specified</code></a> equals to <code>false</code>, as specified in the description of the <a href='core.html#ID-637646024'><code>Attr</code></a> interface; </li> <li> The value of the attribute <a href='core.html#Text3-isElementContentWhitespace'><code>Text.isElementContentWhitespace</code></a> for all <a href='core.html#ID-1312295772'><code>Text</code></a> nodes; </li> <li> The value of the attribute <a href='core.html#Attr-isId'><code>Attr.isId</code></a> for all <a href='core.html#ID-637646024'><code>Attr</code></a> nodes; </li> <li> The attributes <a href='core.html#Element-schemaTypeInfo'><code>Element.schemaTypeInfo</code></a> and <a href='core.html#Attr-schemaTypeInfo'><code>Attr.schemaTypeInfo</code></a>. </li> </ul> <p><b>Note:</b> "<a href='core.html#parameter-validate-if-schema'>validate-if-schema</a>" and "validate" are mutually exclusive, setting one of them to <code>true</code> will set the other one to <code>false</code>. Applications should also consider setting the parameter "<a href='core.html#parameter-well-formed'>well-formed</a>" to <code>true</code>, which is the default for that option, when validating the document. </p> </dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Do not accomplish schema processing, including the internal subset processing. Default attribute values information are kept. Note that validation might still happen if "<a href='core.html#parameter-validate-if-schema'>validate-if-schema</a>" is <code>true</code>. </dd></dl> </dd><dt><a name='parameter-validate-if-schema'><code>"validate-if-schema"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>optional</em>]<br> Enable validation only if a declaration for the document element can be found in a <a href='glossary.html#dt-schema'>schema</a> (independently of where it is found, i.e. XML schema, DTD, or any other type or representation of schema). If validation is enabled, this parameter has the same behavior as the parameter "<a href='core.html#parameter-validate'>validate</a>" set to <code>true</code>. <p><b>Note:</b> "validate-if-schema" and "<a href='core.html#parameter-validate'>validate</a>" are mutually exclusive, setting one of them to <code>true</code> will set the other one to <code>false</code>. </p> </dd><dt><code>false</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> No schema processing should be performed if the document has a schema, including internal subset processing. Default attribute values information are kept. Note that validation must still happen if "<a href='core.html#parameter-validate'>validate</a>" is <code>true</code>. </dd></dl> </dd><dt><a name='parameter-well-formed'><code>"well-formed"</code></a></dt> <dd><dl> <dt><code>true</code></dt> <dd>[<em>required</em>] (<em>default</em>)<br> Check if all nodes are XML <a href='glossary.html#dt-well-formed'>well formed</a> according to the XML version in use in <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a>: <ul> <li> check if the attribute <a href='core.html#ID-F68D095'><code>Node.nodeName</code></a> contains invalid characters according to its node type and generate a <a href='core.html#ERROR-Interfaces-DOMError'><code>DOMError</code></a> of type <code>"wf-invalid-character-in-node-name"</code>, with a <a href='core.html#ERROR-DOMError-severity-error'><code>DOMError.SEVERITY_ERROR</code></a> severity, if necessary; </li> <li> check if the text content inside <a href='core.html#ID-637646024'><code>Attr</code></a>, <a href='core.html#ID-745549614'><code>Element</code></a>, <a href='core.html#ID-1728279322'><code>Comment</code></a>, <a href='core.html#ID-1312295772'><code>Text</code></a>, <a href='core.html#ID-667469212'><code>CDATASection</code></a> nodes for invalid characters and generate a <a href='core.html#ERROR-Interfaces-DOMError'><code>DOMError</code></a> of type <code>"wf-invalid-character"</code>, with a <a href='core.html#ERROR-DOMError-severity-error'><code>DOMError.SEVERITY_ERROR</code></a> severity, if necessary; </li> <li> check if the data inside <a href='core.html#ID-1004215813'><code>ProcessingInstruction</code></a> nodes for invalid characters and generate a <a href='core.html#ERROR-Interfaces-DOMError'><code>DOMError</code></a> of type <code>"wf-invalid-character"</code>, with a <a href='core.html#ERROR-DOMError-severity-error'><code>DOMError.SEVERITY_ERROR</code></a> severity, if necessary; </li> </ul> </dd><dt><code>false</code></dt> <dd>[<em>optional</em>]<br> Do not check for XML well-formedness. </dd></dl> </dd></dl> <p> The resolution of the system identifiers associated with entities is done using <a href='core.html#Document3-documentURI'><code>Document.documentURI</code></a>. However, when the feature "LS" defined in [<cite><a class='noxref informative' href='references.html#DOMLS'>DOM Level 3 Load and Save</a></cite>] is supported by the DOM implementation, the parameter "resource-resolver" can also be used on <code>DOMConfiguration</code> objects attached to <a href='core.html#i-Document'><code>Document</code></a> nodes. If this parameter is set, <a href='core.html#Document3-normalizeDocument'><code>Document.normalizeDocument()</code></a> will invoke the resource resolver instead of using <a class='noxref' href='core.html#Document3-documentURI'><code>Document.documentURI</code></a>. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> // Introduced in DOM Level 3: interface <a class='noxref' href='core.html#DOMConfiguration'>DOMConfiguration</a> { void <a class='noxref' href='core.html#DOMConfiguration-property'>setParameter</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name, in <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> value) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> <a class='noxref' href='core.html#DOMConfiguration-getParameter'>getParameter</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name) raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>); boolean <a class='noxref' href='core.html#DOMConfiguration-canSetParameter'>canSetParameter</a>(in <a class='noxref' href='core.html#DOMString'>DOMString</a> name, in <a class='noxref' href='core.html#DOMUserData'>DOMUserData</a> value); readonly attribute <a class='noxref' href='core.html#DOMStringList'>DOMStringList</a> <a class='noxref' href='core.html#DOMConfiguration-parameterNames'>parameterNames</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='DOMConfiguration-parameterNames'>parameterNames</a></code> of type <a href='core.html#DOMStringList'><code>DOMStringList</code></a>, readonly</dt> <dd> The list of the parameters supported by this <code>DOMConfiguration</code> object and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification. <br> </dd></dl></dd> <dt><b>Methods</b></dt> <dd><dl> <dt><code class='method-name'><a name='DOMConfiguration-canSetParameter'>canSetParameter</a></code></dt> <dd> <div class='method'> Check if setting a parameter to a specific value is supported.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the parameter to check.<br> </dd> <dt><code class='parameter-name'>value</code> of type <a href='core.html#DOMUserData'><code>DOMUserData</code></a></dt><dd> An object. if <code>null</code>, the returned value is <code>true</code>. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><code>boolean</code></p></td><td> <p> <code>true</code> if the parameter could be successfully set to the specified value, or <code>false</code> if the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself. </td></tr></table> </div></div> <!-- return --> <div><b>No Exceptions</b></div> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='DOMConfiguration-getParameter'>getParameter</a></code></dt> <dd> <div class='method'> Return the value of a parameter if known. <div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the parameter. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='return'> <b>Return Value</b> <div class='returntable'> <table summary='Layout table: the first cell contains the type of the return value, the second contains a short description' border='0'><tr><td valign='top'><p><a href='core.html#DOMUserData'><code>DOMUserData</code></a></p></td><td> <p> The current object associated with the specified parameter or <code>null</code> if no object has been associated or if the parameter is not supported. </td></tr></table> </div></div> <!-- return --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p> NOT_FOUND_ERR: Raised when the parameter name is not recognized. </td></tr> </table> </div></div> <!-- exceptions --> </div> <!-- method --> </dd> <dt><code class='method-name'><a name='DOMConfiguration-property'>setParameter</a></code></dt> <dd> <div class='method'> Set the value of a parameter.<div class='parameters'> <b>Parameters</b> <div class='paramtable'> <dl> <dt><code class='parameter-name'>name</code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt><dd> The name of the parameter to set.<br> </dd> <dt><code class='parameter-name'>value</code> of type <a href='core.html#DOMUserData'><code>DOMUserData</code></a></dt><dd> The new value or <code>null</code> if the user wishes to unset the parameter. While the type of the value parameter is defined as <a class='noxref' href='core.html#DOMUserData'><code>DOMUserData</code></a>, the object type must match the type defined by the definition of the parameter. For example, if the parameter is <a href='core.html#parameter-error-handler'>"error-handler"</a>, the value must be of type <a href='core.html#ERROR-Interfaces-DOMErrorHandler'><code>DOMErrorHandler</code></a>. <br> </dd> </dl> </div></div> <!-- parameters --> <div class='exceptions'> <b>Exceptions</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p> NOT_FOUND_ERR: Raised when the parameter name is not recognized. <p> NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set. <p> TYPE_MISMATCH_ERR: Raised if the value type for this parameter name is incompatible with the expected value type. </td></tr> </table> </div></div> <!-- exceptions --> <div><b>No Return Value</b></div> </div> <!-- method --> </dd> </dl></dd> </dl></dd> </dl> </div> <!-- div2 ID-BBACDC08 --> <div class='div2'><a name='ID-E067D597'></a> <h2 id='ID-E067D597-h2' class='div2'>1.5 Extended Interfaces: XML Module</h2><p>The interfaces defined here form part of the DOM Core specification, but objects that expose these interfaces will never be encountered in a DOM implementation that deals only with HTML.<p> The interfaces found within this section are not mandatory. A DOM application may use the <a href='core.html#ID-5CED94D7'><code>DOMImplementation.hasFeature(feature, version)</code></a> method with parameter values "XML" and "3.0" (respectively) to determine whether or not this module is supported by the implementation. In order to fully support this module, an implementation must also support the "Core" feature defined in <a href='core.html#ID-BBACDC08'>Fundamental Interfaces: Core Module</a> and the feature "XMLVersion" with version "1.0" defined in <a href='core.html#Document3-version'><code>Document.xmlVersion</code></a>. Please refer to additional information about <a href='introduction.html#ID-Conformance'>Conformance</a> in this specification. The DOM Level 3 XML module is backward compatible with the DOM Level 2 XML [<cite><a class='noxref informative' href='references.html#DOM2Core'>DOM Level 2 Core</a></cite>] and DOM Level 1 XML [<cite><a class='noxref informative' href='references.html#DOM-Level-1'>DOM Level 1</a></cite>] modules, i.e. a DOM Level 3 XML implementation who returns <code>true</code> for "XML" with the <code>version</code> number <code>"3.0"</code> must also return <code>true</code> for this <code>feature</code> when the <code>version</code> number is <code>"2.0"</code>, <code>"1.0"</code>, <code>""</code> or, <code>null</code>. <dl> <dt><b>Interface <i><a name='ID-667469212'>CDATASection</a></i></b></dt> <dd> <p>CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.<p>The <a href='core.html#ID-72AB8359'><code>CharacterData.data</code></a> attribute holds the text that is contained by the CDATA section. Note that this <em>may</em> contain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.<p>The <code>CDATASection</code> interface inherits from the <a href='core.html#ID-FF21A306'><code>CharacterData</code></a> interface through the <a href='core.html#ID-1312295772'><code>Text</code></a> interface. Adjacent <code>CDATASection</code> nodes are not merged by use of the <code>normalize</code> method of the <a href='core.html#ID-1950641247'><code>Node</code></a> interface.<p> No lexical check is done on the content of a CDATA section and it is therefore possible to have the character sequence <code>"]]>"</code> in the content, which is illegal in a CDATA section per section 2.7 of [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. The presence of this character sequence must generate a fatal error during serialization or the cdata section must be splitted before the serialization (see also the parameter <code>"split-cdata-sections"</code> in the <a href='core.html#DOMConfiguration'><code>DOMConfiguration</code></a> interface). <p><b>Note:</b> Because no markup is recognized within a <code>CDATASection</code>, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing a <code>CDATASection</code> with a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.<br> One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.</p> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-667469212'>CDATASection</a> : <a class='noxref' href='core.html#ID-1312295772'>Text</a> { }; </pre> </div><br> </dd> </dl></dd> <dt><b>Interface <i><a name='ID-412266927'>DocumentType</a></i></b></dt> <dd> <p>Each <a href='core.html#i-Document'><code>Document</code></a> has a <code>doctype</code> attribute whose value is either <code>null</code> or a <code>DocumentType</code> object. The <code>DocumentType</code> interface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing.<p>DOM Level 3 doesn't support editing <code>DocumentType</code> nodes. <code>DocumentType</code> nodes are <a href='glossary.html#dt-readonly-node'>read-only</a>. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-412266927'>DocumentType</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-1844763134'>name</a>; readonly attribute <a class='noxref' href='core.html#ID-1780488922'>NamedNodeMap</a> <a class='noxref' href='core.html#ID-1788794630'>entities</a>; readonly attribute <a class='noxref' href='core.html#ID-1780488922'>NamedNodeMap</a> <a class='noxref' href='core.html#ID-D46829EF'>notations</a>; // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-Core-DocType-publicId'>publicId</a>; // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-Core-DocType-systemId'>systemId</a>; // Introduced in DOM Level 2: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-Core-DocType-internalSubset'>internalSubset</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-1788794630'>entities</a></code> of type <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a>, readonly</dt> <dd>A <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> containing the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in: <div class='code-block'> <pre><!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/></pre> </div> the interface provides access to <code>foo</code> and the first declaration of <code>bar</code> but not the second declaration of <code>bar</code> or <code>baz</code>. Every node in this map also implements the <a href='core.html#ID-527DCFF2'><code>Entity</code></a> interface.<br> The DOM Level 2 does not support editing entities, therefore <code>entities</code> cannot be altered in any way.<br> </dd> <dt><code class='attribute-name'><a name='ID-Core-DocType-internalSubset'>internalSubset</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The internal subset as a string, or <code>null</code> if there is none. This is does not contain the delimiting square brackets.<p><b>Note:</b> The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.</p> </dd> <dt><code class='attribute-name'><a name='ID-1844763134'>name</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The name of DTD; i.e., the name immediately following the <code>DOCTYPE</code> keyword.<br> </dd> <dt><code class='attribute-name'><a name='ID-D46829EF'>notations</a></code> of type <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a>, readonly</dt> <dd>A <a href='core.html#ID-1780488922'><code>NamedNodeMap</code></a> containing the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements the <a href='core.html#ID-5431D1B9'><code>Notation</code></a> interface.<br> The DOM Level 2 does not support editing notations, therefore <code>notations</code> cannot be altered in any way.<br> </dd> <dt><code class='attribute-name'><a name='ID-Core-DocType-publicId'>publicId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The public identifier of the external subset.<br> </dd> <dt><code class='attribute-name'><a name='ID-Core-DocType-systemId'>systemId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 2</b></dt> <dd>The system identifier of the external subset. This may be an absolute URI or not.<br> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-5431D1B9'>Notation</a></i></b></dt> <dd> <p>This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (see <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#Notations'><em>section 4.7</em></a> of the XML 1.0 specification [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]), or is used for formal declaration of processing instruction targets (see <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#sec-pi'><em>section 2.6</em></a> of the XML 1.0 specification [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]). The <code>nodeName</code> attribute inherited from <a href='core.html#ID-1950641247'><code>Node</code></a> is set to the declared name of the notation.<p>The DOM Core does not support editing <code>Notation</code> nodes; they are therefore <a href='glossary.html#dt-readonly-node'>readonly</a>.<p>A <code>Notation</code> node does not have any parent. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-5431D1B9'>Notation</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-54F2B4D0'>publicId</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-E8AAB1D0'>systemId</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-54F2B4D0'>publicId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The public identifier of this notation. If the public identifier was not specified, this is <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-E8AAB1D0'>systemId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The system identifier of this notation. If the system identifier was not specified, this is <code>null</code>. This may be an absolute URI or not.<br> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-527DCFF2'>Entity</a></i></b></dt> <dd> <p>This interface represents a known entity, either parsed or unparsed, in an XML document. Note that this models the entity itself <em>not</em> the entity declaration.<p>The <code>nodeName</code> attribute that is inherited from <a href='core.html#ID-1950641247'><code>Node</code></a> contains the name of the entity.<p>An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be no <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes in the document tree.<p>XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement text of the entity may not be available. When the <a class='normative' href='http://www.w3.org/TR/2004/REC-xml-20040204#intern-replacement'><em>replacement text</em></a> is available, the corresponding <code>Entity</code> node's child list represents the structure of that replacement value. Otherwise, the child list is empty.<p>DOM Level 3 does not support editing <code>Entity</code> nodes; if a user wants to make changes to the contents of an <code>Entity</code>, every related <a href='core.html#ID-11C98490'><code>EntityReference</code></a> node has to be replaced in the structure model by a clone of the <code>Entity</code>'s contents, and then the desired changes must be made to each of those clones instead. <code>Entity</code> nodes and all their <a href='glossary.html#dt-descendant'>descendants</a> are <a href='glossary.html#dt-readonly-node'>readonly</a>.<p>An <code>Entity</code> node does not have any parent.<p><b>Note:</b> If the entity contains an unbound <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a>, the <code>namespaceURI</code> of the corresponding node in the <code>Entity</code> node subtree is <code>null</code>. The same is true for <a href='core.html#ID-11C98490'><code>EntityReference</code></a> nodes that refer to this entity, when they are created using the <code>createEntityReference</code> method of the <a href='core.html#i-Document'><code>Document</code></a> interface.</p> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-527DCFF2'>Entity</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-D7303025'>publicId</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-D7C29F3E'>systemId</a>; readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-6ABAEB38'>notationName</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Entity3-inputEncoding'>inputEncoding</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Entity3-encoding'>xmlEncoding</a>; // Introduced in DOM Level 3: readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#Entity3-version'>xmlVersion</a>; }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='Entity3-inputEncoding'>inputEncoding</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying the encoding used for this entity at the time of parsing, when it is an external parsed entity. This is <code>null</code> if it an entity from the internal subset or if it is not known.<br> </dd> <dt><code class='attribute-name'><a name='ID-6ABAEB38'>notationName</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>For unparsed entities, the name of the notation for the entity. For parsed entities, this is <code>null</code>.<br> </dd> <dt><code class='attribute-name'><a name='ID-D7303025'>publicId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The public identifier associated with the entity if specified, and <code>null</code> otherwise.<br> </dd> <dt><code class='attribute-name'><a name='ID-D7C29F3E'>systemId</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The system identifier associated with the entity if specified, and <code>null</code> otherwise. This may be an absolute URI or not.<br> </dd> <dt><code class='attribute-name'><a name='Entity3-encoding'>xmlEncoding</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity. This is <code>null</code> otherwise.<br> </dd> <dt><code class='attribute-name'><a name='Entity3-version'>xmlVersion</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly, introduced in <b class='version'>DOM Level 3</b></dt> <dd>An attribute specifying, as part of the text declaration, the version number of this entity, when it is an external parsed entity. This is <code>null</code> otherwise.<br> </dd></dl></dd> </dl></dd> <dt><b>Interface <i><a name='ID-11C98490'>EntityReference</a></i></b></dt> <dd> <p><code>EntityReference</code> nodes may be used to represent an entity reference in the tree. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building the <a href='core.html#i-Document'><code>Document</code></a>, instead of providing <code>EntityReference</code> nodes. If it does provide such nodes, then for an <code>EntityReference</code> node that represents a reference to a known entity an <a href='core.html#ID-527DCFF2'><code>Entity</code></a> exists, and the subtree of the <code>EntityReference</code> node is a copy of the <a class='noxref' href='core.html#ID-527DCFF2'><code>Entity</code></a> node subtree. However, the latter may not be true when an entity contains an unbound <a href='glossary.html#dt-namespaceprefix'>namespace prefix</a>. In such a case, because the namespace prefix resolution depends on where the entity reference is, the <a href='glossary.html#dt-descendant'>descendants</a> of the <code>EntityReference</code> node may be bound to different <a href='glossary.html#dt-namespaceURI'>namespace URIs</a>. When an <code>EntityReference</code> node represents a reference to an unknown entity, the node has no children and its replacement value, when used by <a href='core.html#ID-221662474'><code>Attr.value</code></a> for example, is empty.<p>As for <a href='core.html#ID-527DCFF2'><code>Entity</code></a> nodes, <code>EntityReference</code> nodes and all their <a href='glossary.html#dt-descendant'>descendants</a> are <a href='glossary.html#dt-readonly-node'>readonly</a>.<p><b>Note:</b> <code>EntityReference</code> nodes may cause element content and attribute value normalization problems when, such as in XML 1.0 and XML Schema, the normalization is performed after entity reference are expanded.</p> <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-11C98490'>EntityReference</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { }; </pre> </div><br> </dd> </dl></dd> <dt><b>Interface <i><a name='ID-1004215813'>ProcessingInstruction</a></i></b></dt> <dd> <p>The <code>ProcessingInstruction</code> interface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.<p> No lexical check is done on the content of a processing instruction and it is therefore possible to have the character sequence <code>"?>"</code> in the content, which is illegal a processing instruction per section 2.6 of [<cite><a class='noxref normative' href='references.html#XML'>XML 1.0</a></cite>]. The presence of this character sequence must generate a fatal error during serialization. <dl> <dt><br><b>IDL Definition</b></dt> <dd> <div class='idl-code'> <pre> interface <a class='noxref' href='core.html#ID-1004215813'>ProcessingInstruction</a> : <a class='noxref' href='core.html#ID-1950641247'>Node</a> { readonly attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-1478689192'>target</a>; attribute <a class='noxref' href='core.html#DOMString'>DOMString</a> <a class='noxref' href='core.html#ID-837822393'>data</a>; // raises(<a class='noxref' href='core.html#ID-17189187'>DOMException</a>) on setting }; </pre> </div><br> </dd> <dt><b>Attributes</b></dt> <dd><dl> <dt><code class='attribute-name'><a name='ID-837822393'>data</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a></dt> <dd>The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the <code>?></code>.<br> <div class='exceptions'> <b>Exceptions on setting</b> <div class='exceptiontable'> <table summary='Layout table: the first cell contains the type of the exception, the second contains the specific error code and a short description' border='0'> <tr><td valign='top'><p><a href='core.html#ID-17189187'><code>DOMException</code></a></p></td><td> <p>NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.</td></tr> </table> </div></div> <!-- exceptions --> </dd> <dt><code class='attribute-name'><a name='ID-1478689192'>target</a></code> of type <a href='core.html#DOMString'><code>DOMString</code></a>, readonly</dt> <dd>The target of this processing instruction. XML defines this as being the first <a href='glossary.html#dt-token'>token</a> following the markup that begins the processing instruction.<br> </dd></dl></dd> </dl></dd> </dl> </div> <!-- div2 ID-E067D597 --></div> <!-- div1 Core --><div class='navbar' style='text-align: center'> <map id='navbar-bottom' name='navbar-bottom' title='Navigation Bar'><hr title='Navigation area separator'><p> [<a title='What is the Document Object Model?' href='introduction.html'><strong><u>p</u></strong>revious</a>] [<a title='Changes' href='changes.html'><strong><u>n</u></strong>ext</a>] [<a title='Table of Contents' href='Overview.html#contents'><strong><u>c</u></strong>ontents</a>] [<a title='Index' href='def-index.html'><strong><u>i</u></strong>ndex</a>]</p> </map></div> </body> </html>