10 |
|
|
11 |
<div class="header"> |
<div class="header"> |
12 |
<h1>DOM Document Type Definition Module</h1> |
<h1>DOM Document Type Definition Module</h1> |
13 |
<h2>Working Draft <time datetime=2007-12-03>3 December 2007</time></h2> |
<h2>Working Draft <time datetime=2007-12-04>4 December 2007</time></h2> |
14 |
|
|
15 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
<dt>This Version</dt> |
125 |
interface.</p> |
interface.</p> |
126 |
|
|
127 |
<p class=ed>@@ ref to DOM Binding Spec</p> |
<p class=ed>@@ ref to DOM Binding Spec</p> |
128 |
|
|
129 |
|
<p>If the <code>strictErrorChecking</code> attribute of the |
130 |
|
<code>Document</code> node is <code>false</code>, the methods are |
131 |
|
not required to raise exceptions <span class=ed>[DOM3]</span>.</p> |
132 |
|
|
133 |
|
<div class=ed> |
134 |
|
<p>Conformant product classes: implementation, XML parser (XML document -> |
135 |
|
DOM converter), XML serializer (DOM -> XML document covnerter). |
136 |
|
XML Infoset -> DOM converter, and DOM -> XML Infoset converter.</p> |
137 |
|
</div> |
138 |
</div> |
</div> |
139 |
|
|
140 |
<div class=section id=dom-dtdef> |
<div class=section id=dom-dtdef> |
149 |
<li><a href="#AttributeDefinition"><code>AttributeDefinition</code></a></li> |
<li><a href="#AttributeDefinition"><code>AttributeDefinition</code></a></li> |
150 |
</ul> |
</ul> |
151 |
|
|
152 |
<p>In addition, it adds methods, attributes, and/or constants to interfaces |
<p>In addition, it modifies interfaces |
153 |
<a href="#Node"><code>Node</code></a>, |
<a href="#Node"><code>Node</code></a>, |
154 |
|
<a href="#DocumentType"><code>DocumentType</code></a>, |
155 |
<a href="#Entity"><code>Entity</code></a>, |
<a href="#Entity"><code>Entity</code></a>, |
156 |
<a href="#EntityReference"><code>EntityReference</code></a>, and |
<a href="#EntityReference"><code>EntityReference</code></a>, |
157 |
<a href="#Notation"><code>Notation</code></a>. |
<a href="#Notation"><code>Notation</code></a>, and |
158 |
It modifies semantics of some of methods and attributes in |
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a>.</p> |
|
<a href="#Node"><code>Node</code></a> and |
|
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> |
|
|
interfaces, for the support of new interfaces.</p> |
|
159 |
|
|
160 |
<div class=section id=features> |
<div class=section id=features> |
161 |
<h3>Feature Name</h3> |
<h3>Feature Name</h3> |
180 |
aforementioned cases.</p> |
aforementioned cases.</p> |
181 |
</div> |
</div> |
182 |
|
|
183 |
|
<div class=section id=section-node> |
184 |
|
<h3>Modifications to the <code id=Node>Node</code> Interface</h3> |
185 |
|
|
186 |
|
<p>The implementation of the |
187 |
|
<a href="#Node"><code>Node</code></a> interface |
188 |
|
<em class=rfc2119>MUST</em> be modified as following:</p> |
189 |
|
<pre class=idl><code>// Additions to the Node interface |
190 |
|
|
191 |
|
// Additions to the NodeType definition group |
192 |
|
const unsigned short <a href="#ELEMENT_TYPE_DEFINITION_NODE">ELEMENT_TYPE_DEFINITION_NODE</a> = 81001; |
193 |
|
const unsigned short <a href="#ATTRIBUTE_DEFINITION_NODE">ATTRIBUTE_DEFINITION_NODE</a> = 81002; |
194 |
|
</pre> |
195 |
|
|
196 |
|
<p>This specification adds two new types (subinterfaces) of |
197 |
|
<a href="#Node"><code>Node</code></a>: element type definition (node type |
198 |
|
<a href="#ELEMENT_TYPE_DEFINITION_NODE"><code>ELEMENT_TYPE_DEFINITION_NODE</code></a>, |
199 |
|
interface |
200 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>) and |
201 |
|
attribute definition (node type |
202 |
|
<a href="#ATTRIBUTE_DEFINITION_NODE"><code>ATTRIBUTE_DEFINITION_NODE</code></a>, |
203 |
|
interface |
204 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a>). For |
205 |
|
these kinds of nodes, methods and attributes in the |
206 |
|
<a href="#Node"><code>Node</code></a> interface must behave as following:</p> |
207 |
|
|
208 |
|
<dl> |
209 |
|
<dt><code id=attributes>attributes</code></dt> |
210 |
|
<dd> |
211 |
|
<p>On getting, the attribute <em class=rfc2119>MUST</em> return |
212 |
|
<code>null</code>.</p> |
213 |
|
</dd> |
214 |
|
<dt><code id=baseURI>baseURI</code></dt> |
215 |
|
<dd> |
216 |
|
<p>On getting, the attribute <em class=rfc2119>MUST</em> return the |
217 |
|
value of the <a href="#baseURI"><code>baseURI</code></a> attribute |
218 |
|
of the node in the <code>ownerDocument</code> attribute of the node. |
219 |
|
Note that the value might be <code>null</code>.</p> |
220 |
|
</dd> |
221 |
|
<dt><code id=nodeName>nodeName</code></dt> |
222 |
|
<dd> |
223 |
|
<p>If the node is an |
224 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>: |
225 |
|
On getting, the attribute <em class=rfc2119>MUST</em> return the |
226 |
|
name of the element type definition represented by the node.</p> |
227 |
|
|
228 |
|
<p>If the node is an |
229 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a>: |
230 |
|
On getting, the attribute <em class=rfc2119>MUST</em> return the |
231 |
|
name of the attribute definition represented by the node.</p> |
232 |
|
</dd> |
233 |
|
<dt><code id=nodeType>nodeType</code></dt> |
234 |
|
<dd> |
235 |
|
<p>On getting, the attribute <em class=rfc2119>MUST</em> return |
236 |
|
<a href="#ELEMENT_TYPE_DEFINITION_NODE"><code>ELEMENT_TYPE_DEFINITION_NODE</code></a> |
237 |
|
(if the node is an |
238 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>) or |
239 |
|
<a href="#ATTRIBUTE_DEFINITION_NODE"><code>ATTRIBUTE_DEFINITION_NODE</code></a> |
240 |
|
(if the node is an |
241 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a>).</p> |
242 |
|
|
243 |
|
<!-- NodeType --> |
244 |
|
<p>Two constants are added to the <code id=NodeType>NodeType</code> |
245 |
|
definition group of the <a href="#Node"><code>Node</code></a> interface as |
246 |
|
following:</p> |
247 |
|
<table> |
248 |
|
<thead> |
249 |
|
<tr><th scope=col>Name<th scope=col>Value<th scope=col>Description</tr> |
250 |
|
</thead> |
251 |
|
<tbody> |
252 |
|
<tr> |
253 |
|
<th scope=row><dfn id=ELEMENT_TYPE_DEFINITION_NODE class=dom-const><code>ELEMENT_TYPE_DEFINITION_NODE</code></dfn> |
254 |
|
<td><code>81001</code><td>The node is an |
255 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>.</tr> |
256 |
|
<tr> |
257 |
|
<th scope=row><dfn id=ATTRIBUTE_DEFINITION_NODE class=dom-const><code>ATTRIBUTE_DEFINITION_NODE</code></dfn> |
258 |
|
<td><code>81002</code><td>The node is an |
259 |
|
<a href="#ElementTypeDefinition"><code>AttributeDefinition</code></a>.</tr> |
260 |
|
</tbody> |
261 |
|
</table> |
262 |
|
</dd> |
263 |
|
<dt><code id=nodeValue>nodeValue</code> and |
264 |
|
<code id=textContent>textContent</code></dt> |
265 |
|
<dd> |
266 |
|
<p>If the node is an |
267 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>: |
268 |
|
On getting, the attributes <em class=rfc2119>MUST</em> return the |
269 |
|
name of the element type.</p> |
270 |
|
|
271 |
|
<div class="note memo"> |
272 |
|
<p>Thus, on setting the attributes does nothing |
273 |
|
<span class=ed>[DOM3]</span>.</p> |
274 |
|
</div> |
275 |
|
|
276 |
|
<p>On setting, the <a href="#textContent"><code>textContent</code></a> |
277 |
|
attribute <em class=rfc2119>MUST NOT</em> raise a |
278 |
|
<code>NO_MODIFICATION_ALLOWED_ERR</code> <span class=ed>@@ ref</span>. |
279 |
|
<span class=ed>@@ I forgot why this requirement is necessary.</span></p> |
280 |
|
|
281 |
|
<p>If the node is an |
282 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a>:</p> |
283 |
|
|
284 |
|
<pre class=ed> |
285 |
|
The getter of the [CODE(DOMa)@en[[[nodeValue]]]] attribute |
286 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
287 |
|
[['''MUST''']] return the normalized default value |
288 |
|
of the attribute. |
289 |
|
|
290 |
|
@@ |
291 |
|
|
292 |
|
[4] The getter of the [CODE(DOMa)@en[[[textContent]]]] |
293 |
|
attribute of an [CODE(DOMi)@en[[[AttributeDefinition]]]] |
294 |
|
object [['''MUST''']] behave as if it were an |
295 |
|
[CODE(DOMi)@en[[[Attr]]]] object. |
296 |
|
|
297 |
|
The setter of the [CODE(DOMa)@en[[[textContent]]]] attribute |
298 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
299 |
|
[['''MUST''']] behave as if the following algorithm |
300 |
|
is performed: |
301 |
|
= If the [CODE(DOMi)@en[[[AttributeDefinition]]]] |
302 |
|
object is read-only, then throw an |
303 |
|
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]. |
304 |
|
= Remove any child node the node has. |
305 |
|
= If the new value is not empty and not [CODE(IDL)@en[[[null]]]], |
306 |
|
then create a [CODE(DOMi)@en[[[Text]]]] node |
307 |
|
whose [CODE(DOMa)@en[[[data]]]] is the new value |
308 |
|
and append it to the [CODE(DOMi)@en[[[AttributeDefinition]]]]. |
309 |
|
</pre> |
310 |
|
</dd> |
311 |
|
<dt class=ed>@@ ...</dt> |
312 |
|
</dl> |
313 |
|
|
314 |
|
</div> |
315 |
|
|
316 |
<div class=section id=section-documentxdoctype> |
<div class=section id=section-documentxdoctype> |
317 |
<h3>The <code>DocumentXDoctype</code> Interface</h3> |
<h3>The <code>DocumentXDoctype</code> Interface</h3> |
318 |
|
|
319 |
|
<p>The <a href="#DocumentXDoctype"><code>DocumentXDoctype</code></a> interface |
320 |
|
<em class=rfc2119>MUST</em> be implemented as following:</p> |
321 |
<pre class=idl><code>interface <dfn id=DocumentXDoctype><code>DocumentXDoctype</code></dfn> { |
<pre class=idl><code>interface <dfn id=DocumentXDoctype><code>DocumentXDoctype</code></dfn> { |
322 |
DocumentType <a href="#createDocumentTypeDefinition">createDocumentTypeDefinition</a> |
DocumentType <a href="#createDocumentTypeDefinition">createDocumentTypeDefinition</a> |
323 |
(in DOMString <a href="#createDocumentTypeDefinition-name"><var>name</var></a>) |
(in DOMString <a href="#createDocumentTypeDefinition-name"><var>name</var></a>) |
324 |
raises (DOMException); |
raises (DOMException); |
325 |
ElementTypeDefinition <a href="#createElementTypeDefinition">createElementTypeDefinition</a> |
<a href="#ElementTypeDefinition">ElementTypeDefinition</a> <a href="#createElementTypeDefinition">createElementTypeDefinition</a> |
326 |
(in DOMString <a href="#createElementTypeDefinition-name"><var>name</var></a>) |
(in DOMString <a href="#createElementTypeDefinition-name"><var>name</var></a>) |
327 |
raises (DOMException); |
raises (DOMException); |
328 |
AttributeDefinition <a href="#createAttributeDefinition">createAttributeDefinition</a> |
<a href="#AttributeDefinition">AttributeDefinition</a> <a href="#createAttributeDefinition">createAttributeDefinition</a> |
329 |
(in DOMString <a href="#createAttributeDefinition-name"><var>name</var></a>) |
(in DOMString <a href="#createAttributeDefinition-name"><var>name</var></a>) |
330 |
raises (DOMException); |
raises (DOMException); |
331 |
Entity <a href="#createGeneralEntity">createGeneralEntityDefinition</a> |
<a href="#Entity">Entity</a> <a href="#createGeneralEntity">createGeneralEntityDefinition</a> |
332 |
(in DOMString <a href="#createGeneralEntity-name"><var>name</var></a>) |
(in DOMString <a href="#createGeneralEntity-name"><var>name</var></a>) |
333 |
raises (DOMException); |
raises (DOMException); |
334 |
Notation <a href="#createNotation">createNotation</a> |
<a href="#Notation">Notation</a> <a href="#createNotation">createNotation</a> |
335 |
(in DOMString <a href="#createNotation-name"><var>name</var></a>) |
(in DOMString <a href="#createNotation-name"><var>name</var></a>) |
336 |
raises (DOMException); |
raises (DOMException); |
337 |
}</code></pre> |
}</code></pre> |
542 |
define it for <code>Document</code> methods.</p> |
define it for <code>Document</code> methods.</p> |
543 |
|
|
544 |
<p><var>name</var> does not have to be a namespace qualified name.</p> |
<p><var>name</var> does not have to be a namespace qualified name.</p> |
545 |
|
</div> |
546 |
|
|
|
<p>If the <code>strictErrorChecking</code> attribute of the |
|
|
<code>Document</code> node is <code>false</code>, the methods are |
|
|
not required to raise the exception <span class=ed>[DOM3]</span>.</p> |
|
547 |
</div> |
</div> |
548 |
|
|
549 |
|
|
550 |
|
<div class=section id=section-documenttype> |
551 |
|
<h3>Modifications to the <code id=DocumentType>DocumentType</code> |
552 |
|
Interface</h3> |
553 |
|
|
554 |
|
<p>A <a href="#DocumentType"><code>DocumentType</code></a> interface |
555 |
|
<em class=rfc2119>MAY</em> contain zero or more |
556 |
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> |
557 |
|
nodes in the <code>NodeList</code> object contained in the |
558 |
|
<code>childNodes</code> attribute of the |
559 |
|
<a href="#DocumentType"><code>DocumentType</code></a> node.</p> |
560 |
|
|
561 |
|
<p>If the <a href="#DocumentType"><code>DocumentType</code></a> node is created |
562 |
|
during the process to create a <abbr>DOM</abbr> from an <abbr>XML</abbr> |
563 |
|
document, the <code>NodeList</code> object in the <code>childNodes</code> |
564 |
|
object <em class=rfc2119>MUST</em> contains the |
565 |
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> |
566 |
|
nodes representing the processing instructions in the document type |
567 |
|
definition of the document processed <span class=ed>@@ ref</span> by |
568 |
|
the <abbr>XML</abbr> processor. If the |
569 |
|
<a href="#DocumentType"><code>DocumentType</code></a> node is marked |
570 |
|
as read$B!>(Bonly, then all the child nodes <em class=rfc2119>MUST</em> |
571 |
|
also be marked as read$B!>(Bonly.</p> |
572 |
|
|
573 |
|
<p>If a <a href="#DocumentType"><code>DocumentType</code></a> node is created |
574 |
|
from a document type declaration information item <span class=ed>@@ ref</span>, |
575 |
|
the <code>NodeList</code> object in the <code>childNodes</code> attribute |
576 |
|
of the node <em class=rfc2119>MUST</em> contain the |
577 |
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> nodes |
578 |
|
created from the processing instruction information items in the list in the |
579 |
|
[children] property of the document type declaration item in the same |
580 |
|
order.</p> |
581 |
|
|
582 |
|
<p>If a <a href="#DocumentType"><code>DocumentType</code></a> node is mapped to |
583 |
|
a document type declaration information item, the list in the [children] |
584 |
|
property <em class=rfc2119>MUST</em> contain the processng instruction |
585 |
|
information items created from the |
586 |
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> nodes |
587 |
|
in the <code>NodeList</code> object in the <code>childNodes</code> attribute |
588 |
|
of the <a href="#DocumentType"><code>DocumentType</code></a> node.</p> |
589 |
|
|
590 |
|
<p>The implementation of the |
591 |
|
<a href="#DocumentType"><code>DocumentType</code></a> interface |
592 |
|
<em class=rfc2119>MUST</em> be modified as following:</p> |
593 |
|
<pre class=idl><code>// Modifications to the DocumentType interface |
594 |
|
attribute DOMString <a href="#publicId">publicId</a>; |
595 |
|
attribute DOMString <a href="#systemId">systemId</a>; |
596 |
|
|
597 |
|
attribute DOMString <a href="#internalSubset">internalSubset</a>; |
598 |
|
</code></pre> |
599 |
|
|
600 |
|
<p>The <code id=publicId>publicId</code> attribute and the |
601 |
|
<code id=systemId>systemId</code> attribute of |
602 |
|
<a href="#DocumentType"><code>DocumentType</code></a>, |
603 |
|
<a href="#Entity"><code>Entity</code></a>, and |
604 |
|
<a href="#Notation"><code>Notation</code></a> interfaces are no longer |
605 |
|
read$B!>(Bonly.</p> |
606 |
|
|
607 |
|
<p>On setting, the attribute <em class=rfc2119>MUST</em> raise a |
608 |
|
<code>NO_MODIFICATION_ALLOWED_ERR</code> <span class=ed>@@ ref</span> |
609 |
|
exception if the node is read$B!>(Bonly <span class=ed>@@ ref</span>. |
610 |
|
Otherwise, it <em class=rfc2119>MUST</em> set the specified value as the value |
611 |
|
associated to the attribute. No normalization, relative reference resolution, |
612 |
|
or lexical validation is performed. <span class=ed>@@ If the new |
613 |
|
value is <code>null</code>, ...</span></p> |
614 |
|
|
615 |
|
<div class="note memo"> |
616 |
|
<p>Setting an invalid identifier might make the node unserializable. |
617 |
|
Setting a public identifier while leaveing system identifier unspecified |
618 |
|
would also make the <a href="#DocumentType"><code>DocumentType</code></a> |
619 |
|
or <a href="#Entity"><code>Entity</code></a> node unserializable.</p> |
620 |
|
</div> |
621 |
|
|
622 |
|
<div class=ed> |
623 |
|
<p>ISSUE: In HTML5, Firefox 1.5, and Opera 9, not specifying public or system identifier results in empty strings.</p> |
624 |
|
</div> |
625 |
|
|
626 |
|
<p>The <code id=internalSubset>internalSubset</code> attribute of the |
627 |
|
<a href="#DocumentType"><code>DocumentType</code></a> interface is no longer |
628 |
|
read$B!>(Bonly.</p> |
629 |
|
|
630 |
|
<p>On setting, the attribute <em class=rfc2119>MUST</em> raise a |
631 |
|
<code>NO_MODIFICATION_ALLOWED_ERR</code> <span class=ed>@@ ref</span> |
632 |
|
exception if the node is read$B!>(Bonly <span class=ed>@@ ref</span>. |
633 |
|
Otherwise, it <em class=rfc2119>MUST</em> set the specified value as the value |
634 |
|
associated to the attribute. No normalization, or lexical validation is |
635 |
|
performed. <span class=ed>@@ If the new value is <code>null</code>, |
636 |
|
...</span></p> |
637 |
|
|
638 |
</div> |
</div> |
639 |
|
|
640 |
<div class=section id=section-documenttypedefinition> |
<div class=section id=section-documenttypedefinition> |
641 |
<h3>The <code>DocumentTypeDefinition</code> Interface</h3> |
<h3>The <code>DocumentTypeDefinition</code> Interface</h3> |
642 |
|
|
643 |
|
<div class="note memo"> |
644 |
|
<p>This interface is a separated interface from the |
645 |
|
<a href="#DocumentType"><code>DocumentType</code></a>, not a set of extensions |
646 |
|
to the <a href="#DocumentType"><code>DocumentType</code></a>, |
647 |
|
for the historical reason.</p> |
648 |
|
</div> |
649 |
|
|
650 |
|
<p>The |
651 |
|
<a href="#DocumentTypeDefinition"><code>DocumentTypeDefinition</code></a> |
652 |
|
interface <em class=rfc2119>MUST</em> be implemented as following:</p> |
653 |
<pre class=idl><code>interface <dfn id=DocumentTypeDefinition><code>DocumentTypeDefinition</code></dfn> { |
<pre class=idl><code>interface <dfn id=DocumentTypeDefinition><code>DocumentTypeDefinition</code></dfn> { |
654 |
readonly attribute NamedNodeMap <a href="#elementTypes">elementTypes</a>; |
readonly attribute NamedNodeMap <a href="#elementTypes">elementTypes</a>; |
655 |
readonly attribute NamedNodeMap <a href="#generalEntities">generalEntities</a>; |
readonly attribute NamedNodeMap <a href="#generalEntities">generalEntities</a>; |
656 |
readonly attribute NamedNodeMap <a href="#notations">notations</a>; |
readonly attribute NamedNodeMap <a href="#notations">notations</a>; |
657 |
|
|
658 |
<span class=ed>more members come here...</span> |
<a href="#ElementTypeDefinition">ElementTypeDefinition</a> <a href="#getElementTypeDefinitionNode">getElementTypeDefinitionNode</a> |
659 |
|
(in DOMString <a href="#getElementTypeDefinitionNode-name"><var>name</var></a>); |
660 |
|
<a href="#Entity">Entity</a> <a href="#getGeneralEntityNode">getGeneralEntityNode</a> |
661 |
|
(in DOMString <a href="#getGeneralEntityNode-name"><var>name</var></a>); |
662 |
|
<a href="#Notation">Notation</a> <a href="#getNotationNode">getNotationNode</a> |
663 |
|
(in DOMString <a href="#getNotationNode-name"><var>name</var></a>); |
664 |
|
|
665 |
|
void <a href="#setElementTypeDefinitionNode">setElementTypeDefinitionNode</a> |
666 |
|
(in DOMString <a href="#setElementTypeDefinitionNode-node"><var>node</var></a>) |
667 |
|
raises (DOMException); |
668 |
|
void <a href="#setGeneralEntityNode">setGeneralEntityNode</a> |
669 |
|
(in DOMString <a href="#setGeneralEntityNode-node"><var>node</var></a>) |
670 |
|
raises (DOMException); |
671 |
|
void <a href="#setNotationNode">setNotationNode</a> |
672 |
|
(in DOMString <a href="#setNotationNode-node"><var>node</var></a>) |
673 |
|
raises (DOMException); |
674 |
}</code></pre> |
}</code></pre> |
675 |
|
|
676 |
<pre class=ed> |
<pre class=ed> |
797 |
<div class=section id=section-elementtypedefinition> |
<div class=section id=section-elementtypedefinition> |
798 |
<h3>The <code>ElementTypeDefinition</code> Interface</h3> |
<h3>The <code>ElementTypeDefinition</code> Interface</h3> |
799 |
|
|
800 |
|
<p>The nodes of type |
801 |
|
<a href="#ELEMENT_TYPE_DEFINITION_NODE"><code>ELEMENT_TYPE_DEFINITION_NODE</code></a> |
802 |
|
represents an element type definition. Such a node implements the |
803 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
804 |
|
interface, which extends the <a href="#Node"><code>Node</code></a> |
805 |
|
interface.</p> |
806 |
|
|
807 |
|
<p>An element type definition represents a definition of the element type. |
808 |
|
It is corresponding to the element type declaration in <abbr>DTD</abbr>. |
809 |
|
However, an |
810 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> node |
811 |
|
does not represent the element type definition in <abbr>DTD</abbr> itself. |
812 |
|
Even if there are more than one element type declarations for an element type |
813 |
|
in <abbr>DTD</abbr>, the result <abbr>DOM</abbr> will contain only an |
814 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
815 |
|
node for that element type. In addition, if there are attribute definition |
816 |
|
declarations for an element type, even when there is no element type |
817 |
|
declaration for that element type, the <abbr>DOM</abbr> will contain an |
818 |
|
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
819 |
|
node for that element type.</p> |
820 |
|
|
821 |
|
<p>The <a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
822 |
|
interface <em class=rfc2119>MUST</em> be implemented as following:</p> |
823 |
<pre class=idl><code>interface <dfn id=ElementTypeDefinition><code>ElementTypeDefinition</code></dfn> : <a href="#Node">Node</a> { |
<pre class=idl><code>interface <dfn id=ElementTypeDefinition><code>ElementTypeDefinition</code></dfn> : <a href="#Node">Node</a> { |
824 |
readonly attribute <a href="#ownerDocumentTypeDefinition">ownerDocumentTypeDefinition</a>; |
readonly attribute <a href="#ownerDocumentTypeDefinition">ownerDocumentTypeDefinition</a>; |
825 |
|
|
826 |
<span class=ed>@@ more</span> |
<span class=ed>@@ more</span> |
827 |
}</code></pre> |
}</code></pre> |
828 |
|
|
829 |
<pre class=ed>** Modifications to [CODE(DOMi)@en[[[Node]]]] members |
<pre class=ed> |
|
|
|
|
[3] The getter of the [CODE(DOMa)@en[[[attributes]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
|
|
[['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
|
|
|
|
|
[4] The getter of the [CODE(DOMa)@en[[[baseURI]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
|
|
[['''MUST''']] return the [CODE(DOMa)@en[[[baseURI]]]] |
|
|
of the [CDOE(DOMa)@en[[[ownerDocument]]]] of the |
|
|
[CODE(DOMi)@en[[[ElementTypeDefinition]]]] object. |
|
|
Note that it might be [CODE(IDL)@en[[[null]]]]. |
|
|
|
|
|
[1] The getter of the [CODE(DOMa)@en[[[nodeName]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
|
|
[['''MUST''']] return the name of the element type. |
|
|
|
|
|
[2] The getters of the [CODE(DOMa)@en[[[nodeValue]]]] |
|
|
and [CODE(DOMa)@en[[[textContent]]]] attributes |
|
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
|
|
object [['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
|
|
|
|
|
;; Thus, the setter of these attributes do nothing. |
|
|
|
|
|
The setter of the [CODE(DOMa)@en[[[textContent]]]] |
|
|
attribute of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
|
|
object [['''MUST NOT''']] throw a |
|
|
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]. |
|
|
|
|
|
** The [CODE(DOMi)@en[ElementTypeDefinition]] Interface |
|
|
|
|
|
[5] The |
|
830 |
[DFN@en[[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute]] |
[DFN@en[[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute]] |
831 |
of the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
of the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
832 |
interface is defined in [[manakai//DOM Extensions]>>50].</pre> |
interface is defined in [[manakai//DOM Extensions]>>50].</pre> |
835 |
<div class=section id=section-attributedefinition> |
<div class=section id=section-attributedefinition> |
836 |
<h3>The <code>AttributeDefinition</code> Interface</h3> |
<h3>The <code>AttributeDefinition</code> Interface</h3> |
837 |
|
|
838 |
|
<p>The nodes of type |
839 |
|
<a href="#ATTRIBUTE_DEFINITION_NODE"><code>ATTRIBUTE_DEFINITION_NODE</code></a> |
840 |
|
represents an attribute definition. Such a node implements the |
841 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> interface, |
842 |
|
which extends the <a href="#Node"><code>Node</code></a> interface.</p> |
843 |
|
|
844 |
|
<p>An attribute definition represents a definition of the attribute |
845 |
|
associated to an element type. It is corresponding to the attribute definition |
846 |
|
in the attribute list declaration in <abbr>DTD</abbr>. However, an |
847 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node does |
848 |
|
not represent the attribute definition in <abbr>DTD</abbr> itself. Even if |
849 |
|
there are more than one attribute definitions for an attribute of an element |
850 |
|
type in <abbr>DTD</abbr>, the result <abbr>DOM</abbr> will contain only an |
851 |
|
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node for |
852 |
|
that attribute.</p> |
853 |
|
|
854 |
|
<p>The <a href="#AttributeDefinition"><code>AttributeDefinition</code></a> |
855 |
|
interface <em class=rfc2119>MUST</em> be implemented as following:</p> |
856 |
<pre class=idl><code>interface <dfn id=AttributeDefinition><code>AttributeDefinition</code></dfn> : <a href="#Node">Node</a> { |
<pre class=idl><code>interface <dfn id=AttributeDefinition><code>AttributeDefinition</code></dfn> : <a href="#Node">Node</a> { |
857 |
<span class=comment>// <a href="#DeclaredValueType">DeclaredValueType</a></span> |
<span class=comment>// <a href="#DeclaredValueType">DeclaredValueType</a></span> |
858 |
const unsigned short <a href="#NO_TYPE_ATTR">NO_TYPE_ATTR</a> = 0; |
const unsigned short <a href="#NO_TYPE_ATTR">NO_TYPE_ATTR</a> = 0; |
867 |
const unsigned short <a href="#NOTATION_ATTR">NOTATION_ATTR</a> = 9; |
const unsigned short <a href="#NOTATION_ATTR">NOTATION_ATTR</a> = 9; |
868 |
const unsigned short <a href="#ENUMERATION_ATTR">ENUMERATION_ATTR</a> = 10; |
const unsigned short <a href="#ENUMERATION_ATTR">ENUMERATION_ATTR</a> = 10; |
869 |
const unsigned short <a href="#UNKNOWN_ATTR">UNKNOWN_ATTR</a> = 11; |
const unsigned short <a href="#UNKNOWN_ATTR">UNKNOWN_ATTR</a> = 11; |
870 |
|
|
871 |
|
<span class=comment>// <a href="#DefaultValueType">DefaultValueType</a></span> |
872 |
|
const unsigned short <a href="#UNKNOWN_DEFAULT">UNKNOWN_DEFAULT</a> = 0; |
873 |
|
const unsigned short <a href="#FIXED_DEFAULT">FIXED_DEFAULT</a> = 1; |
874 |
|
const unsigned short <a href="#REQUIRED_DEFAULT">REQUIRED_DEFAULT</a> = 2; |
875 |
|
const unsigned short <a href="#IMPLIED_DEFAULT">IMPLIED_DEFAULT</a> = 3; |
876 |
|
const unsigned short <a href="#EXPLICIT_DEFAULT">EXPLICIT_DEFAULT</a> = 4; |
877 |
|
|
878 |
readonly attribute <a href="#ElementTypeDefinition">ElementTypeDefinition</a> <a href="#ownerElementTypeDefinition">ownerElementTypeDefinition</a>; |
readonly attribute <a href="#ElementTypeDefinition">ElementTypeDefinition</a> <a href="#ownerElementTypeDefinition">ownerElementTypeDefinition</a>; |
879 |
|
|
883 |
<span class=ed>...</span> |
<span class=ed>...</span> |
884 |
}</code></pre> |
}</code></pre> |
885 |
|
|
|
<pre class=ed>** Modifications to [CODE(DOMi)@en[[[Node]]]] members |
|
|
|
|
|
[3] The getter of the [CODE(DOMa)@en[[[attributes]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
|
|
[['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
|
|
|
|
|
[9] The getter of the [CODE(DOMa)@en[[[baseURI]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
|
|
[['''MUST''']] return the [CODE(DOMa)@en[[[baseURI]]]] |
|
|
of the [CDOE(DOMa)@en[[[ownerDocument]]]] of the |
|
|
[CODE(DOMi)@en[[[AttributeDefinition]]]] object. |
|
|
Note that it might be [CODE(IDL)@en[[[null]]]]. |
|
|
|
|
|
[1] The getter of the [CODE(DOMa)@en[[[nodeName]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
|
|
[['''MUST''']] return the name of the attribute. |
|
|
|
|
|
[2] The getter of the [CODE(DOMa)@en[[[nodeValue]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
|
|
[['''MUST''']] return the normalized default value |
|
|
of the attribute. |
|
|
|
|
|
@@ |
|
|
|
|
|
[4] The getter of the [CODE(DOMa)@en[[[textContent]]]] |
|
|
attribute of an [CODE(DOMi)@en[[[AttributeDefinition]]]] |
|
|
object [['''MUST''']] behave as if it were an |
|
|
[CODE(DOMi)@en[[[Attr]]]] object. |
|
|
|
|
|
The setter of the [CODE(DOMa)@en[[[textContent]]]] attribute |
|
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
|
|
[['''MUST''']] behave as if the following algorithm |
|
|
is performed: |
|
|
= If the [CODE(DOMi)@en[[[AttributeDefinition]]]] |
|
|
object is read-only, then throw an |
|
|
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]. |
|
|
= Remove any child node the node has. |
|
|
= If the new value is not empty and not [CODE(IDL)@en[[[null]]]], |
|
|
then create a [CODE(DOMi)@en[[[Text]]]] node |
|
|
whose [CODE(DOMa)@en[[[data]]]] is the new value |
|
|
and append it to the [CODE(DOMi)@en[[[AttributeDefinition]]]]. |
|
|
</pre> |
|
|
|
|
886 |
<dl> |
<dl> |
887 |
<dt><dfn id=ownerElementTypeDefinition class=dom-attr><code>ownerElementTypeDefinition</code></dfn> |
<dt><dfn id=ownerElementTypeDefinition class=dom-attr><code>ownerElementTypeDefinition</code></dfn> |
888 |
of type |
of type |
1020 |
<em class=rfc2119>MUST</em> set the specified value as the value |
<em class=rfc2119>MUST</em> set the specified value as the value |
1021 |
associated to this attribute.</p> |
associated to this attribute.</p> |
1022 |
|
|
1023 |
<p>If the <code>AttributeDefinition</code> node is created during the process |
<p>If the |
1024 |
to create a <abbr>DOM</abbr> from an <abbr>XML</abbr> document, an |
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node is |
1025 |
appropriate value from the |
created during the process to create a <abbr>DOM</abbr> from an |
1026 |
|
<abbr>XML</abbr> document, an appropriate value from the |
1027 |
<a href="#DefaultValueType"><code>DefaultValueType</code></a> definition |
<a href="#DefaultValueType"><code>DefaultValueType</code></a> definition |
1028 |
group <em class=rfc2119>MUST</em> be set to the attribute.</p> |
group <em class=rfc2119>MUST</em> be set to the attribute.</p> |
1029 |
|
|