1 |
<!DOCTYPE html> |
2 |
<html lang="en" class="formal-specification status-work-in-progress"> |
3 |
<head> |
4 |
<title>DOM Document Type Definition Module</title> |
5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
6 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/def/dom"> |
7 |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
8 |
</head> |
9 |
<body class="has-abstract"> |
10 |
|
11 |
<div class="header"> |
12 |
<h1>DOM Document Type Definition Module</h1> |
13 |
<h2>Working Draft <time datetime=2007-12-04>4 December 2007</time></h2> |
14 |
|
15 |
<dl class="versions-uri"> |
16 |
<dt>This Version</dt> |
17 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work" |
18 |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work</a>></code></dd> |
19 |
<dt>Latest Version</dt> |
20 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef" |
21 |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef</a>></code></dd> |
22 |
<dt>Latest Working Draft</dt> |
23 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work" |
24 |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work</a>></code></dd> |
25 |
<!-- <dt>Previous Version</dt> --> |
26 |
<dt>Version History</dt> |
27 |
<dd><code class=URI><<a href="http://suika.fam.cx/gate/cvs/markup/xml/domdtdef/domdtdef-work.en.html">http://suika.fam.cx/gate/cvs/markup/xml/domdtdef/domdtdef-work.en.html</a>></code></dd> |
28 |
<dt id=author>Author</dt> |
29 |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
30 |
lang=ja>Wakaba</a> |
31 |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
32 |
>w@suika.fam.cx</a>></code></dd> |
33 |
</dl> |
34 |
|
35 |
<p class="copyright" lang="en">© <time>2007</time> <a |
36 |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
37 |
Permission is granted to copy, distribute and/or modify this document |
38 |
under the terms of the <a rel="license" |
39 |
href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>, |
40 |
Version 1.2 |
41 |
or any later version published by the <a |
42 |
href="http://www.fsf.org/">Free Software Foundation</a>; |
43 |
with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover |
44 |
Texts. A copy of the license is |
45 |
available at <code class="URI"><<a |
46 |
href="http://www.gnu.org/copyleft/fdl.html" |
47 |
rel="license">http://www.gnu.org/copyleft/fdl.html</a>></code>.</p> |
48 |
</div> |
49 |
|
50 |
<div id="abstract" class="section"> |
51 |
<h2>Abstract</h2> |
52 |
|
53 |
<div class="ed issue">...</div> |
54 |
|
55 |
</div> |
56 |
|
57 |
<div id="status" class="section"> |
58 |
<h2>Status of This Document</h2> |
59 |
|
60 |
<p class=section-info><em>This section describes the status of this document |
61 |
at the time of its publication. Other documents |
62 |
might supersede this document.</em></p> |
63 |
|
64 |
<p>This document is a working draft, produced as part of the |
65 |
<a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a> |
66 |
project. It might be updated, replaced, or obsoleted by |
67 |
other documents at any time. It is inappropriate to |
68 |
cite this document as other than <q>work in progress</q>.</p> |
69 |
|
70 |
<p>Comments on this document are welcome and |
71 |
may be sent to the <a href="#author">author</a>.</p> |
72 |
|
73 |
<p>Translations of thie document might be available. |
74 |
The English version of the document is the only |
75 |
normative version.</p> |
76 |
</div> |
77 |
|
78 |
<div id="introduction" class="section"> |
79 |
<h2>Introduction</h2> |
80 |
|
81 |
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
82 |
|
83 |
<div class="issue ed"> |
84 |
<p>This is a work-in-progress specification for DOM Document Type |
85 |
Definition module, as implemented by manakai and |
86 |
<a href="http://suika.fam.cx/gate/2005/sw/DOM%20XML%20Document%20Type%20Definition">partially documented in the SuikaWiki</a>.</p> |
87 |
</div> |
88 |
|
89 |
<p>The <dfn id=term-dom-dtdef><abbr>DOM</abbr> Document Type Definition</dfn> |
90 |
module is a set of <abbr>DOM</abbr> interfaces, including both new |
91 |
interfaces and modifications to existing <abbr>DOM</abbr> interfaces, |
92 |
over which <abbr>DOM</abbr> applications are able to access to the |
93 |
definitions of the document type.</p> |
94 |
|
95 |
<p>Interfaces defined in this specification are partially modeled from |
96 |
early drafts of <abbr>DOM</abbr> level 1 <span class=ed>@@ ref</span>, |
97 |
<abbr>DOM</abbr> Abstract Schema level 3 <span class=ed>@@ ref</span>, and |
98 |
<abbr>XML</abbr> Schema <abbr>API</abbr>, but are not compatible with |
99 |
any of them as a whole.</p> |
100 |
</div> |
101 |
|
102 |
<div class="section" id="terminology"> |
103 |
<h2>Terminology</h2> |
104 |
|
105 |
<p>The key words <q><em class="rfc2119">MUST</em></q>, |
106 |
<q><em class="rfc2119">MUST NOT</em></q>, |
107 |
<q><em class="rfc2119">SHOULD</em></q>, |
108 |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
109 |
<q><em class=rfc2119>MAY</em></q> in this |
110 |
document are to be interpreted as described in |
111 |
<a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr> |
112 |
2119</a> |
113 |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
114 |
|
115 |
<!-- Strictly speaking the paragraph below is not part of terminology. --> |
116 |
<p>All examples and notes in this specification are non$B!>(Bnormative, |
117 |
as are all sections explicitly marked non$B!>(Bnormative. Everything |
118 |
else in this specification is normative.</p> |
119 |
|
120 |
<p><span class=ed>Algorithm is normative but non-normative</span>. |
121 |
In addition, the order in which <a href="#errors">errors</a> are |
122 |
raised is undefined.</p> |
123 |
|
124 |
<p class=ed><var>A</var> object is an object implementing <var>A</var> |
125 |
interface.</p> |
126 |
|
127 |
<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> |
139 |
|
140 |
<div class=section id=dom-dtdef> |
141 |
<h2><abbr>DOM</abbr> Document Type Definition Module</h2> |
142 |
|
143 |
<p>The <abbr>DOM</abbr> Document Type Definition module, version 3.0, |
144 |
consists of three interfaces:</p> |
145 |
<ul> |
146 |
<li><a href="#DocumentXDoctype"><code>DocumentXDoctype</code></a></li> |
147 |
<li><a href="#DocumentTypeDefinition"><code>DocumentTypeDefinition</code></a></li> |
148 |
<li><a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a></li> |
149 |
<li><a href="#AttributeDefinition"><code>AttributeDefinition</code></a></li> |
150 |
</ul> |
151 |
|
152 |
<p>In addition, it modifies interfaces |
153 |
<a href="#Node"><code>Node</code></a>, |
154 |
<a href="#DocumentType"><code>DocumentType</code></a>, |
155 |
<a href="#Entity"><code>Entity</code></a>, |
156 |
<a href="#EntityReference"><code>EntityReference</code></a>, |
157 |
<a href="#Notation"><code>Notation</code></a>, and |
158 |
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a>.</p> |
159 |
|
160 |
<div class=section id=features> |
161 |
<h3>Feature Name</h3> |
162 |
|
163 |
<p>In a <abbr>DOM</abbr> implementation that supports the version 3.0 of |
164 |
the <abbr>DOM</abbr> Document Type Definition module, the |
165 |
<code>hasFeature</code> method of a <code>DOMImplementation</code> object |
166 |
<em class=rfc2119>MUST</em> return <code>true</code> when the parameters are |
167 |
set to <code>http://suika.fam.cx/www/2006/feature/XDoctype</code> and |
168 |
<code>3.0</code> respectively.</p> |
169 |
|
170 |
<p>In such an implementation, the <code>getFeature</code> method of a |
171 |
<code>Document</code> object <em class=rfc2119>MUST</em> return the (at least |
172 |
conceptually) same object implementing the |
173 |
<a href="#DocumentXDoctype"><code>DocumentXDoctype</code></a> interface when |
174 |
the parameters are set to |
175 |
<code>http://suika.fam.cx/www/2006/feature/XDoctype</code> and |
176 |
<code>3.0</code> respectively. Likewise, any method that takes one or more |
177 |
feature names with or without version number, including the methods |
178 |
<code>hasFeature</code> and <code>getFeature</code>, |
179 |
<em class=rfc2119>MUST</em> behave in a manner consistent with the |
180 |
aforementioned cases.</p> |
181 |
</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> |
317 |
<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> { |
322 |
DocumentType <a href="#createDocumentTypeDefinition">createDocumentTypeDefinition</a> |
323 |
(in DOMString <a href="#createDocumentTypeDefinition-name"><var>name</var></a>) |
324 |
raises (DOMException); |
325 |
<a href="#ElementTypeDefinition">ElementTypeDefinition</a> <a href="#createElementTypeDefinition">createElementTypeDefinition</a> |
326 |
(in DOMString <a href="#createElementTypeDefinition-name"><var>name</var></a>) |
327 |
raises (DOMException); |
328 |
<a href="#AttributeDefinition">AttributeDefinition</a> <a href="#createAttributeDefinition">createAttributeDefinition</a> |
329 |
(in DOMString <a href="#createAttributeDefinition-name"><var>name</var></a>) |
330 |
raises (DOMException); |
331 |
<a href="#Entity">Entity</a> <a href="#createGeneralEntity">createGeneralEntityDefinition</a> |
332 |
(in DOMString <a href="#createGeneralEntity-name"><var>name</var></a>) |
333 |
raises (DOMException); |
334 |
<a href="#Notation">Notation</a> <a href="#createNotation">createNotation</a> |
335 |
(in DOMString <a href="#createNotation-name"><var>name</var></a>) |
336 |
raises (DOMException); |
337 |
}</code></pre> |
338 |
|
339 |
<div class=ed>@@ cast definition</div> |
340 |
|
341 |
<dl> |
342 |
<dt><dfn id=createDocumentTypeDefinition class=dom-method><code>createDocumentTypeDefinition</code></dfn>, |
343 |
method</dt> |
344 |
<dd> |
345 |
<p>This method creates a <code>DocumentType</code> node with the specified |
346 |
name, belonging to the document.</p> |
347 |
<p>The <dfn id=createDocumentTypeDefinition-name class=dom-param><var>name</var></dfn> |
348 |
parameter is the name of the document type.</p> |
349 |
|
350 |
<p>When invoked, the method <em class=rfc2119>MUST</em> create and |
351 |
return a <code>DocumentType</code> node with the following attributes:</p> |
352 |
<dl> |
353 |
<dt><code>attributes</code>, <code>parentNode</code></dt> |
354 |
<dd><code>null</code>.</dd> |
355 |
<dt><code>elementTypes</code>, <code>generalEntities</code>, and |
356 |
<code>notations</code></dt> |
357 |
<dd>Empty <code>NamedNodeMap</code> objects.</dd> |
358 |
<dt><code>entities</code></dt> |
359 |
<dd>The same value as the <code>generalEntities</code> attribute.</dd> |
360 |
<dt><code>childNodes</code></dt> |
361 |
<dd>An empty <code>NodeList</code> object.</dd> |
362 |
<dt><code>internalSubset</code>, <code>publicId</code>, and |
363 |
<code>systemId</code></dt> |
364 |
<dd>Empty strings.</dd> |
365 |
<dt><code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
366 |
<dd><code>false</code>.</dd> |
367 |
<dt><code>nodeName</code></dt> |
368 |
<dd><a href="#createDocumentTypeDefinition-name"><var>name</var></a>.</dd> |
369 |
<dt><code>ownerDocument</code></dt> |
370 |
<dd>The <code>Document</code> over which the method is invoked.</dd> |
371 |
</dl> |
372 |
<p>In addition, the method <em class=rfc2119>MUST</em> be marked as |
373 |
containing five general entity declarations: <code>amp</code>, |
374 |
<code>lt</code>, <code>gt</code>, <code>quot</code>, and |
375 |
<code>apos</code>.</p> |
376 |
</dd> |
377 |
<dt><dfn id=createElementTypeDefinition class=dom-method><code>createElementTypeDefinition</code></dfn>, |
378 |
method</dt> |
379 |
<dd> |
380 |
<p>This method creates a <code>ElementTypeDefinition</code> node with the |
381 |
specified name, belonging to the document.</p> |
382 |
<p>The <dfn id=createElementTypeDefinition-name class=dom-param><var>name</var></dfn> |
383 |
parameter is the name of the element type defined by the element |
384 |
type definition.</p> |
385 |
|
386 |
<p>When invoked, the method <em class=rfc2119>MUST</em> create and |
387 |
return an |
388 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
389 |
node with the following attributes:</p> |
390 |
<dl> |
391 |
<dt><a href="#attributeDefinitions"><code>attributeDefinitions</code></a></dt> |
392 |
<dd>An empty <code>NamedNodeMap</code> object.</dd> |
393 |
<dt><code>attributes</code>, <code>parentNode</code></dt> |
394 |
<dd><code>null</code>.</dd> |
395 |
<dt><code>childNodes</code></dt> |
396 |
<dd>An empty <code>NodeList</code> object.</dd> |
397 |
<dt><code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
398 |
<dd><code>false</code>.</dd> |
399 |
<dt><code>nodeName</code></dt> |
400 |
<dd><a href="#createElementTypeDefinition-name"><var>name</var></a>.</dd> |
401 |
<dt><code>ownerDocument</code></dt> |
402 |
<dd>The <code>Document</code> node over which the method is invoked.</dd> |
403 |
<dt><a href="#ownerDocumentTypeDefinition"><code>ownerDocumentTypeDefinition</code></a></dt> |
404 |
<dd><code>null</code>.</dd> |
405 |
<dt class=ed>@@ Ensure all attributes are defined</dt> |
406 |
</dl> |
407 |
</dd> |
408 |
<dt><dfn id=createAttributeDefinition class=dom-method><code>createAttributeDefinition</code></dfn>, |
409 |
method</dt> |
410 |
<dd> |
411 |
<p>This method creates a <code>AttributeDefinition</code> node with the |
412 |
specified name, belonging to the document.</p> |
413 |
<p>The <dfn id=createAttributeDefinition-name class=dom-param><var>name</var></dfn> |
414 |
parameter is the name of the attribute defined by the attribute |
415 |
definition.</p> |
416 |
|
417 |
<p>When invoked, the method <em class=rfc2119>MUST</em> create and |
418 |
return an |
419 |
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> |
420 |
node with the following attributes:</p> |
421 |
<dl> |
422 |
<dt><code>allowedTokens</code></dt> |
423 |
<dd>An empty <code>DOMStringList</code> object.</dd> |
424 |
<dt><code>attributes</code>, |
425 |
<a href="#ownerElementTypeDefinition"><code>ownerElementTypeDefinition</code></a>, |
426 |
and <code>parentNode</code></dt> |
427 |
<dd><code>null</code>.</dd> |
428 |
<dt><code>childNodes</code></dt> |
429 |
<dd>An empty <code>NodeList</code> object.</dd> |
430 |
<dt><code>declaredType</code></dt> |
431 |
<dd><a href="#NO_TYPE_ATTR"><code>NO_TYPE_ATTR</code></a>.</dd> |
432 |
<dt><code>defaultType</code></dt> |
433 |
<dd><a href="#UNKNOWN_DEFAULT"><code>UNKNOWN_DEFAULT</code></a>.</dd> |
434 |
<dt><code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
435 |
<dd><code>false</code>.</dd> |
436 |
<dt><code>nodeName</code></dt> |
437 |
<dd><a href="#createAttributeDefinition-name"><var>name</var></a>.</dd> |
438 |
<dt><code>ownerDocument</code></dt> |
439 |
<dd>The <code>Document</code> node over which the method is invoked.</dd> |
440 |
<dt class=ed>@@ Ensure all attributes are defined</dt> |
441 |
</dl> |
442 |
|
443 |
<div class=ed> |
444 |
<p>@@ Should we keep these statements?: |
445 |
However, if the <cfg::cfg|xml-id> configuration |
446 |
parameter is set to <code>true</code> and the <var>name</var> |
447 |
is <code>xml:id</code>, then the [CODE(DOMa)@en[[[declaredType]]]] |
448 |
attribute is set to <code>ID_ATTR</code>. |
449 |
[CODE(DOMa)@en[[[defaultType]]]]?</p> |
450 |
</div> |
451 |
</dd> |
452 |
<dt><dfn id=createGeneralEntity class=dom-method><code>createGeneralEntity</code></dfn>, |
453 |
method</dt> |
454 |
<dd> |
455 |
<p>This method creates a <a href="#Entity"><code>Entity</code></a> node |
456 |
with the specified name, which represents a general entity, belonging to |
457 |
the document.</p> |
458 |
<p>The <dfn id=createGeneralEntity-name class=dom-param><var>name</var></dfn> |
459 |
parameter is the name of the general entity.</p> |
460 |
|
461 |
<p>When invoked, the method <em class=rfc2119>MUST</em> create and return |
462 |
an <a href="#Entity"><code>Entity</code></a> node with the following |
463 |
attributes:</p> |
464 |
<dl> |
465 |
<dt><code>attributes</code>, <code>notationName</code>, |
466 |
<a href="#ownerDocumentTypeDefinition"><code>ownerDocumentTypeDefinition</code></a>, |
467 |
and <code>parentNode</code></dt> |
468 |
<dd><code>null</code>.</dd> |
469 |
<dt><code>childNodes</code></dt> |
470 |
<dd>An empty <code>NodeList</code> object.</dd> |
471 |
<dt><code>manakaiDeclarationBaseURI</code>, |
472 |
<code>manakaiEntityBaseURI</code>, and |
473 |
<code>manakaiEntityURI</code> <span class=ed>@@ ref</span></dt> |
474 |
<dd>No explicit value is set.</dd> |
475 |
<dt><code>manakaiHasReplacementTree</code> and |
476 |
<code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
477 |
<dd><code>false</code>.</dd> |
478 |
<dt><code>nodeName</code></dt> |
479 |
<dd><a href="#createGeneralEntity-name"><var>name</var></a>.</dd> |
480 |
<dd> |
481 |
<div class="note memo"> |
482 |
<p>It is not an error for |
483 |
<a href="#createGeneralEntity-name"><var>name</var></a> matching |
484 |
to the name of one of predefined general parsed entities in |
485 |
<abbr>XML</abbr> or <abbr>HTML</abbr>. For example, |
486 |
<a href="#createGeneralEntity-name"><var>name</var></a> might be |
487 |
<code>amp</code>, resulting in an |
488 |
<a href="#Entity"><code>Entity</code></a> node |
489 |
with its <code>nodeName</code> attribute set to <code>amp</code>.</p> |
490 |
</div> |
491 |
</dd> |
492 |
<dt><code>ownerDocument</code></dt> |
493 |
<dd>The <code>Document</code> node over which the method is invoked.</dd> |
494 |
<dt><code>publicId</code>, and <code>systemId</code></dt> |
495 |
<dd><code>null</code>.</dd> |
496 |
<dd class=ed>@@ publicId and systemId should be empty string?</dd> |
497 |
<dt class=ed>@@ Ensure all attributes are defined</dd> |
498 |
</dl> |
499 |
</dd> |
500 |
<dt><dfn id=createNotation class=dom-method><code>createNotation</code></dfn>, |
501 |
method</dt> |
502 |
<dd> |
503 |
<p>This method creates a <code>Notation</code> node with the |
504 |
specified name, belonging to the document.</p> |
505 |
<p>The <dfn id=createNotation-name class=dom-param><var>name</var></dfn> |
506 |
parameter is the name of the notation.</p> |
507 |
|
508 |
<p>When invoked, the method <em class=rfc2119>MUST</em> create and return |
509 |
a <code>Notation</code> node with the following attributes:</p> |
510 |
<dl> |
511 |
<dt><code>attributes</code>, |
512 |
<a href="#ownerDocumentTypeDefinition"><code>ownerDocumentTypeDefinition</code></a>, |
513 |
and <code>parentNode</code></dt> |
514 |
<dd><code>null</code>.</dd> |
515 |
<dt><code>childNodes</code></dt> |
516 |
<dd>An empty <code>NodeList</code> object.</dd> |
517 |
<dt><code>manakaiDeclarationBaseURI</code></dt> |
518 |
<dd>No explicit value is set.</dd> |
519 |
<dt><code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
520 |
<dd><code>false</code>.</dd> |
521 |
<dt><code>nodeName</code></dt> |
522 |
<dd><a href="#createNotation-name"><var>name</var></a>.</dd> |
523 |
<dt><code>ownerDocument</code></dt> |
524 |
<dd>The <code>Document</code> node over which the method is invoked.</dd> |
525 |
<dt><code>publicId</code> and <code>systemId</code></dt> |
526 |
<dd><code>null</code>.</dd> |
527 |
<dd class=ed>@@ publicId and systemId should be empty string?</dd> |
528 |
<dt class=ed>@@ Ensure all attributes are defined</dt> |
529 |
</dl> |
530 |
</dd> |
531 |
</dl> |
532 |
|
533 |
<p>These methods <em class=rfc2119>MUST</em> raise an |
534 |
<code>INVALID_CHARACTER_ERR</code> exception <span class=ed>@@ ref</span> |
535 |
if <var>name</var> is <em>not</em> a legal <code>Name</code> according to |
536 |
the <abbr>XML</abbr> version in use, as specified in the |
537 |
<code>xmlVersion</code> attribute of the <code>Document</code> node.</p> |
538 |
|
539 |
<div class="note memo"> |
540 |
<p>Non$B!>(B<abbr>XML</abbr> case is intentionally left unspecified for now, |
541 |
since <abbr>DOM3</abbr> specification <span class=ed>@@ ref</span> does not |
542 |
define it for <code>Document</code> methods.</p> |
543 |
|
544 |
<p><var>name</var> does not have to be a namespace qualified name.</p> |
545 |
</div> |
546 |
|
547 |
</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> |
639 |
|
640 |
<div class=section id=section-documenttypedefinition> |
641 |
<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> { |
654 |
readonly attribute NamedNodeMap <a href="#elementTypes">elementTypes</a>; |
655 |
readonly attribute NamedNodeMap <a href="#generalEntities">generalEntities</a>; |
656 |
readonly attribute NamedNodeMap <a href="#notations">notations</a>; |
657 |
|
658 |
<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> |
675 |
|
676 |
<pre class=ed> |
677 |
[1] In an implementation that supports the |
678 |
[CODE(URI)@en[[[http://suika.fam.cx/www/2006/feature/XDoctype]]]] |
679 |
feature, a [CODE(DOMi)@en[[[DocumentType]]]] node |
680 |
must implement the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] |
681 |
interface. See [[DOM XML Document Type Definition]>>3] for |
682 |
details. |
683 |
</pre> |
684 |
|
685 |
<dl> |
686 |
<dt><dfn id=elementTypes class=dom-attr><code>elementTypes</code></dfn> of |
687 |
type <code>NamedNodeMap</code>, read$B!>(Bonly</dt> |
688 |
<dd><p>A live <code>NamedNodeMap</code> object that contains all the element |
689 |
type definitions belonging to the <code>DocumentType</code> node.</p> |
690 |
|
691 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return the |
692 |
<code>NamedNodeMap</code> object that contains all the |
693 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> |
694 |
nodes belonging to the <code>DocumentType</code> node. The |
695 |
<code>NamedNodeMap</code> object <em class=rfc2119>MUST</em> be read$B!>(Bonly |
696 |
if and only if the node is read$B!>(Bonly. The <code>NamedNodeMap</code> |
697 |
object <em class=rfc2119>MUST</em> be live and the same object |
698 |
<em class=rfc2119>MUST</em> be returned for any invocation.</p> |
699 |
|
700 |
<p>If the <code>DocumentType</code> node is created during the process |
701 |
to create a <abbr>DOM</abbr> from an <abbr>XML</abbr> document, the following |
702 |
requirements are applied: The <code>NamedNodeMap</code> object in the |
703 |
<a href="#elementTypes"><code>elementType</code></a> attribute |
704 |
<em class=rfc2119>MUST</em> be so transformed that the object contains |
705 |
the <code>ElementTypeDefinition</code> nodes for the element types |
706 |
whose name is presented as the <code>Name</code> of the element type or |
707 |
attribute definition list declarations processed by the <abbr>XML</abbr> |
708 |
processor. If there is more than one element type declarations for an |
709 |
element type, then the declarations other than the first one |
710 |
<em class=rfc2119>MUST</em> be ignored for the purpose of constructing the |
711 |
<code>NamedNodeMap</code> object.</p></dd> |
712 |
<dt><dfn id=generalEntities class=dom-attr><code>generalEntities</code></dfn> |
713 |
of type <code>NamedNodeMap</code>, read$B!>(Bonly</dt> |
714 |
<dd><p>A live <code>NamedNodeMap</code> object that contains all the general |
715 |
entities belonging to the <code>DocumentType</code> node.</p> |
716 |
|
717 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return the |
718 |
same value as the <code>entities</code> attribute (defined in the |
719 |
<code>DocumentType</code> interface) of the same node.</p> |
720 |
|
721 |
<div class="note memo"> |
722 |
<p>This attribute is part of the interface for historical reason.</p> |
723 |
</div></dd> |
724 |
<!-- |
725 |
All entities declared in the document type definition |
726 |
contained in or referenced from the document entity |
727 |
might not be exposed through this collection, depending |
728 |
on the information provided by the XML processor for |
729 |
the DOM implementation. In particular, it might not |
730 |
contain any entity if entity references are expanded |
731 |
at the parse time. An implementation [['''MUST NOT''']] |
732 |
expose an [CODE(DOMi)@en[[[Entity]]]] node whose [CODE(DOMa)@en[[[nodeName]]]] |
733 |
is equal to the name of one of five predefined general entities in |
734 |
XML through the collection as the result of parsing of an XML |
735 |
document that has no error. Duplicate entity declarations are also discarded. |
736 |
|
737 |
The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
738 |
object that contains all the [CODE(DOMi)@en[[[Entity]]]] nodes |
739 |
representing general entities belong to the node. The returned |
740 |
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if |
741 |
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live |
742 |
and therefore any change of read-only flag on the node is immediately |
743 |
reflected by that of the object. |
744 |
--> |
745 |
<dt><dfn id=notations class=dom-attr><code>notations</code></dfn> of type |
746 |
<code>notations</code>, read$B!>(Bonly</code> |
747 |
<dd><p>A live <code>NamedNodeMap</code> object that contains all the |
748 |
notations belonging to the <code>DocumentType</code> node.</p> |
749 |
|
750 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return the |
751 |
same value as the <code>notations</code> attribute (defined in the |
752 |
<code>DocumentType</code> interface) of the same node.</p> |
753 |
|
754 |
<div class="note memo"> |
755 |
<p>This attribute is part of the interface for historical reason.</p> |
756 |
<p>Implementations are not required to implement the |
757 |
<code>notations</code> attribute twice (for <code>DocumentType</code> |
758 |
and <code>DocumentTypeDefinition</code> interfaces); they share exactly |
759 |
same definition.</p> |
760 |
</div></dd> |
761 |
<!-- |
762 |
If the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node is |
763 |
created from an XML document, duplicate notation declarations, if any, in DTD |
764 |
[['''MUST NOT''']] result in a node in the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
765 |
object and only the first declaration [['''MUST''']] be |
766 |
made available as a [CODE(DOMi)@en[[[Notation]]]] node. |
767 |
|
768 |
;; This definition is based on one for the |
769 |
[CODE(DOMa)@en[[[notations]]]] attribute of the |
770 |
[CODE(DOMi)@en[[[DocumentType]]]] interface in DOM XML module. |
771 |
Since duplication is violation to the Validity Constraint, |
772 |
XML parsers might vary on how notations are notified to |
773 |
the application. In particular, [CODE(InfoProp)@en[[[notations]]]] |
774 |
property of the document information item in XML Information Set |
775 |
is so defined that in case ''any'' notation is declared for |
776 |
multiple times then the property has no value. |
777 |
|
778 |
The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
779 |
object that contains all the [CODE(DOMi)@en[[[Notation]]]] nodes |
780 |
representing notations belong to the node. The returned |
781 |
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if |
782 |
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live |
783 |
and therefore any change of read-only flag on the node is immediately |
784 |
reflected by that of the object. |
785 |
--> |
786 |
|
787 |
<dt class=ed>@@ other members... |
788 |
</dl> |
789 |
|
790 |
<div class=ed> |
791 |
<p>A future version of this interface might define the |
792 |
<code>parameterEntities</code> and getter/setter for parameter entities. |
793 |
</div> |
794 |
|
795 |
</div> |
796 |
|
797 |
<div class=section id=section-elementtypedefinition> |
798 |
<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> { |
824 |
readonly attribute <a href="#ownerDocumentTypeDefinition">ownerDocumentTypeDefinition</a>; |
825 |
|
826 |
<span class=ed>@@ more</span> |
827 |
}</code></pre> |
828 |
|
829 |
<pre class=ed> |
830 |
[DFN@en[[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute]] |
831 |
of the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
832 |
interface is defined in [[manakai//DOM Extensions]>>50].</pre> |
833 |
</div> |
834 |
|
835 |
<div class=section id=section-attributedefinition> |
836 |
<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> { |
857 |
<span class=comment>// <a href="#DeclaredValueType">DeclaredValueType</a></span> |
858 |
const unsigned short <a href="#NO_TYPE_ATTR">NO_TYPE_ATTR</a> = 0; |
859 |
const unsigned short <a href="#CDATA_ATTR">CDATA_ATTR</a> = 1; |
860 |
const unsigned short <a href="#ID_ATTR">ID_ATTR</a> = 2; |
861 |
const unsigned short <a href="#IDREF_ATTR">IDREF_ATTR</a> = 3; |
862 |
const unsigned short <a href="#IDREFS_ATTR">IDREFS_ATTR</a> = 4; |
863 |
const unsigned short <a href="#ENTITY_ATTR">ENTITY_ATTR</a> = 5; |
864 |
const unsigned short <a href="#ENTITIES_ATTR">ENTITIES_ATTR</a> = 6; |
865 |
const unsigned short <a href="#NMTOKEN_ATTR">NMTOKEN_ATTR</a> = 7; |
866 |
const unsigned short <a href="#NMTOKENS_ATTR">NMTOKENS_ATTR</a> = 8; |
867 |
const unsigned short <a href="#NOTATION_ATTR">NOTATION_ATTR</a> = 9; |
868 |
const unsigned short <a href="#ENUMERATION_ATTR">ENUMERATION_ATTR</a> = 10; |
869 |
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>; |
879 |
|
880 |
readonly attribute unsigned short <a href="#declaredType">declaredType</a>; |
881 |
readonly attribute unsigned short <a href="#defaultType">defaultType</a>; |
882 |
|
883 |
<span class=ed>...</span> |
884 |
}</code></pre> |
885 |
|
886 |
<dl> |
887 |
<dt><dfn id=ownerElementTypeDefinition class=dom-attr><code>ownerElementTypeDefinition</code></dfn> |
888 |
of type |
889 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a>, |
890 |
read$B!>(Bonly</dt> |
891 |
<dd><p>The |
892 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> to |
893 |
which the <a href="#AttributeDefinition"><code>AttributeDefinition</code></a> |
894 |
node belongs.</p> |
895 |
|
896 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return an |
897 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> node. |
898 |
It <em class=rfc2119>MUST</em> be such a node that whose |
899 |
<a href="#attributeDefinitons"><code>attributeDefinitions</code></a> |
900 |
attribute contains the <code>NamedNodeMap</code> object that contains |
901 |
the <a href="#AttributeDefinition"><code>AttributeDefinition</code></a> |
902 |
node. If there is no such an |
903 |
<a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a> node, |
904 |
then <code>null</code> <em class=rfc2119>MUST</em> be returned.</p> |
905 |
<dt><dfn id=declaredType class=dom-attr><code>declaredType</code></dfn> of type |
906 |
<code>unsigned short</code></dt> |
907 |
<dd><p>The declared type <span class=ed>@@ ref</span> of the attribute. |
908 |
It is expected that this attribute contains a value from the definition group |
909 |
<a href="#DeclaredValueType"><code>DeclaredValueType</code></a>.</p> |
910 |
|
911 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return the |
912 |
value associated to this attribute.</p> |
913 |
|
914 |
<p>On setting, the attribute <em class=rfc2119>MUST</em> raise a |
915 |
<code>NO_MODIFICATION_ALLOWED_ERR</code> <span class=ed>@@ ref</span> |
916 |
exception if the |
917 |
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node |
918 |
is read$B!>(Bonly <span class=ed>@@ ref</span>. Otherwise, it |
919 |
<em class=rfc2119>MUST</em> set the specified value as the value |
920 |
associated to this attribute.</p> |
921 |
|
922 |
<p>If the <code>AttributeDefinition</code> node is created during the process |
923 |
to create a <abbr>DOM</abbr> from an <abbr>XML</abbr> document, an |
924 |
appropriate value from the |
925 |
<a href="#DeclaredValueType"><code>DeclaredValueType</code></a> constant |
926 |
group <em class=rfc2119>MUST</em> be set to the attribute.</p> |
927 |
|
928 |
<!-- DeclaredValueType --> |
929 |
<p>The definition group |
930 |
<dfn id=DeclaredValueType><code>DeclaredValueType</code></dfn> contains |
931 |
integers indicating the declared type of attributes. The definition |
932 |
group contains the following constants:</p> |
933 |
|
934 |
<table> |
935 |
<thead> |
936 |
<tr><th scope=col>Name<th scope=col>Value<th scope=col>Description</tr> |
937 |
</thead> |
938 |
<tbody> |
939 |
<tr> |
940 |
<th scope=row><dfn id=NO_TYPE_ATTR class=dom-const><code>NO_TYPE_ATTR</code> |
941 |
<td><code>0</code><td>No value <span class=ed>[INFOSET]</span>.</tr> |
942 |
<tr> |
943 |
<th scope=row><dfn id=CDATA_ATTR class=dom-const><code>CDATA_ATTR</code> |
944 |
<td><code>1</code><td><code>CDATA</code> <span class=ed>[XML]</span>.</tr> |
945 |
<tr> |
946 |
<th scope=row><dfn id=ID_ATTR class=dom-const><code>ID_ATTR</code> |
947 |
<td><code>2</code><td><code>ID</code> <span class=ed>[XML]</span>.</tr> |
948 |
<tr> |
949 |
<th scope=row><dfn id=IDREF_ATTR class=dom-const><code>IDREF_ATTR</code> |
950 |
<td><code>3</code><td><code>IDREF</code> <span class=ed>[XML]</span>.</tr> |
951 |
<tr> |
952 |
<th scope=row><dfn id=IDREFS_ATTR class=dom-const><code>IDREFS_ATTR</code> |
953 |
<td><code>4</code><td><code>IDREFS</code> <span class=ed>[XML]</span>.</tr> |
954 |
<tr> |
955 |
<th scope=row><dfn id=ENTITY_ATTR class=dom-const><code>ENTITY_ATTR</code> |
956 |
<td><code>5</code><td><code>ENTITY</code> <span class=ed>[XML]</span>.</tr> |
957 |
<tr> |
958 |
<th scope=row><dfn id=ENTITIES_ATTR class=dom-const><code>ENTITIES_ATTR</code> |
959 |
<td><code>6</code><td><code>ENTITIES</code> <span class=ed>[XML]</span>.</tr> |
960 |
<tr> |
961 |
<th scope=row><dfn id=NMTOKEN_ATTR class=dom-const><code>NMTOKEN_ATTR</code> |
962 |
<td><code>7</code><td><code>NMTOKEN</code> <span class=ed>[XML]</span>.</tr> |
963 |
<tr> |
964 |
<th scope=row><dfn id=NMTOKENS_ATTR class=dom-const><code>NMTOKENS_ATTR</code> |
965 |
<td><code>8</code><td><code>NMTOKENS</code> <span class=ed>[XML]</span>.</tr> |
966 |
<tr> |
967 |
<th scope=row><dfn id=NOTATION_ATTR class=dom-const><code>NOTATION_ATTR</code> |
968 |
<td><code>9</code><td><code>NOTATION</code> <span class=ed>[XML]</span>.</tr> |
969 |
<tr> |
970 |
<th scope=row><dfn id=ENUMERATION_ATTR class=dom-const><code>ENUMERATION_ATTR</code> |
971 |
<td><code>10</code><td>Enumeration <span class=ed>[XML]</span>.</tr> |
972 |
<tr> |
973 |
<th scope=row><dfn id=UNKNOWN_ATTR class=dom-const><code>UNKNOWN_ATTR</code> |
974 |
<td><code>11</code><td>Unknown, because no declaration for the attribute |
975 |
has been read but the [all declaration processed] property |
976 |
<span class=ed>[INFOSET]</span> would be false.</tr> |
977 |
</tbody> |
978 |
</table> |
979 |
|
980 |
<p>If no attribute type information is available, or if the source |
981 |
of the information does not distinguish <q>no value</q> and <q>unknown</q> |
982 |
<span class=ed>[INFOSET]</span>, then the value |
983 |
<a href="#NO_TYPE_ATTR"><code>NO_TYPE_ATTR</code></a> |
984 |
<em class=rfc2119>MUST</em> be used.</p> |
985 |
|
986 |
<div class="note memo"> |
987 |
<p>An <a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node |
988 |
created by the |
989 |
<a href="#createAttributeDefinition"><code>createAttributeDefinition</code></a> |
990 |
method has its <a href="#declaredType"><code>declaredType</code></a> attribute |
991 |
set to <a href="#NO_TYPE_ATTR"><code>NO_TYPE_ATTR</code></a>.</p> |
992 |
</div> |
993 |
|
994 |
<p>If the source of the information does not distinguish <q>no value</q> |
995 |
and/or <q>unknown</q> <span class=ed>[INFOSET]</span> and |
996 |
<code>CDATA</code> <span class=ed>[XML]</span>, then the value |
997 |
<a href="#CDATA_ATTR"><code>CDATA_ATTR</code></a> <em class=rfc2119>MUST</em> |
998 |
be used.</p> |
999 |
|
1000 |
<p>In Perl binding <span class=ed>[PERLBINDING]</span>, the |
1001 |
<code>Attr</code> nodes <em class=rfc2119>MUST</em> implement the |
1002 |
<a href="#DeclaredValueType"><code>DeclaredValueType</code></a> |
1003 |
definition group.</p> |
1004 |
|
1005 |
</dd> |
1006 |
<dt><dfn id=defaultType class=dom-attr><code>defaultType</code></dfn> of |
1007 |
type <code>unsigned short</code></dt> |
1008 |
<dd><p>The type of the default for the attribute. It is expected that this |
1009 |
attribute contains a value from the definition group |
1010 |
<a href="#DefaultValueType"><code>DefaultValueType</code></a>.</p> |
1011 |
|
1012 |
<p>On getting, the attribute <em class=rfc2119>MUST</em> return |
1013 |
the value associated to this attribute.</p> |
1014 |
|
1015 |
<p>On setting, the attribute <em class=rfc2119>MUST</em> raise a |
1016 |
<code>NO_MODIFICATION_ALLOWED_ERR</code> <span class=ed>@@ ref</span> |
1017 |
exception if the |
1018 |
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node |
1019 |
is read$B!>(Bonly <span class=ed>@@ ref</span>. Otherwise, it |
1020 |
<em class=rfc2119>MUST</em> set the specified value as the value |
1021 |
associated to this attribute.</p> |
1022 |
|
1023 |
<p>If the |
1024 |
<a href="#AttributeDefinition"><code>AttributeDefinition</code></a> node is |
1025 |
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 |
1028 |
group <em class=rfc2119>MUST</em> be set to the attribute.</p> |
1029 |
|
1030 |
<!-- DefaultValueType --> |
1031 |
<p>The definition group |
1032 |
<dfn id=DefaultValueType><code>DefaultValueType</code></dfn> |
1033 |
contains integers indicating the type of the default for the attribute. |
1034 |
The definition group contains the following constans:</p> |
1035 |
|
1036 |
<table> |
1037 |
<thead> |
1038 |
<tr><th scope=col>Name<th scope=col>Value<th scope=col>Description</tr> |
1039 |
</thead> |
1040 |
<tbody> |
1041 |
<tr> |
1042 |
<th scope=row><dfn id=UNKNOWN_DEFAULT class=dom-const><code>UNKNOWN_DEFAULT</code></dfn> |
1043 |
<td><code>0</code><td>Unknown.</tr> |
1044 |
<tr> |
1045 |
<th scope=row><dfn id=FIXED_DEFAULT class=dom-const><code>FIXED_DEFAULT</code></dfn> |
1046 |
<td><code>1</code><td>Provided explicitly and fixed |
1047 |
<span class=ed>@@ ref</span> to that value.</tr> |
1048 |
<tr> |
1049 |
<th scope=row><dfn id=REQUIRED_DEFAULT class=dom-const><code>REQUIRED_DEFAULT</code></dfn> |
1050 |
<td><code>2</code><td>No default value and the attribute have to be |
1051 |
explicitly specified.</tr> |
1052 |
<tr> |
1053 |
<th scope=row><dfn id=IMPLIED_DEFAULT class=dom-const><code>IMPLIED_DEFAULT</code></dfn> |
1054 |
<td><code>3</code><td>Implied <span class=ed>@@ ref</span>.</tr> |
1055 |
<tr> |
1056 |
<th scope=row><dfn id=EXPLICIT_DEFAULT class=dom-const><code>EXPLICIT_DEFAULT</code></dfn> |
1057 |
<td><code>4</code><td>Provided explicitly.</tr> |
1058 |
</tbody> |
1059 |
</table> |
1060 |
|
1061 |
<p>If the source of the default type does not distinguish |
1062 |
implied and unknown default types, then the value |
1063 |
<a href="#IMPLIED_DEFAULT"><code>IMPLIED_DEFAULT</code></a> |
1064 |
<em class=rfc2119>MUST</em> be used.</p> |
1065 |
|
1066 |
<div class="note memo"> |
1067 |
<p>An <a href="#AttributeDefinition"><code>AttributeDefinition</code></a> |
1068 |
node created by the |
1069 |
<a href="#createAttributeDefinition"><code>createAttributeDefinition</code></a> |
1070 |
method has its <a href="#defaultType"><code>defaultType</code></a> |
1071 |
attribute set to |
1072 |
<a href="#UNKNOWN_DEFAULT"><code>UNKNOWN_DEFAULT</code></a>.</p> |
1073 |
</div></dd> |
1074 |
</dl> |
1075 |
|
1076 |
</div> |
1077 |
|
1078 |
</div> |
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
<div id="references" class="section reference"> |
1085 |
<h2>References</h2> |
1086 |
|
1087 |
<div id="normative-references" class="section normative reference"> |
1088 |
<h3>Normative References</h3> |
1089 |
|
1090 |
<dl> |
1091 |
<dt id=ref-DOM3CORE>DOM3CORE</dt> |
1092 |
<dd class=ed>@@ W3C DOM Level 3 Core</dd> |
1093 |
<dt id=ref-DOMDTDEF>DOMDTDEF</dt> |
1094 |
<dd class=ed>@@ manakai's extension to DOM for document type definitions</dd> |
1095 |
<dt id="ref-KEYWORDS">KEYWORDS</dt> |
1096 |
<dd><cite><a href="urn:ietf:rfc:2119">Key words for use in |
1097 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
1098 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
1099 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
1100 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
1101 |
<time datetime=1997-03>March 1997</time>. |
1102 |
<em>This</em> version of the specification is referenced.</dd> |
1103 |
<dt id=ref-INFOSET>INFOSET</dt> |
1104 |
<dd class=ed>@@</dd> |
1105 |
<dt id=ref-XML10">XML10</dt> |
1106 |
<dd><cite><a href="http://www.w3.org/TR/2006/REC-xml-20060816">Extensible |
1107 |
Markup Language (<abbr>XML</abbr>) 1.0 (Fourth Edition)</a></cite>, |
1108 |
<abbr>W3C</abbr> Recommendation, <time datetime=2006-08-16>16 August |
1109 |
2006</time>, edited in place <time datetime=2006-09-29>29 September |
1110 |
2006</time>. Tje latest version of the specification is available at |
1111 |
<code class=uri><<a href="http://www.w3.org/TR/xml">http://www.w3.org/TR/xml</a>></code>. |
1112 |
<em>This</em> version of the specification is referenced.</dd> |
1113 |
<dt id=ref-XML11>XML11</dt> |
1114 |
<dd class=ed>@@</dd> |
1115 |
</dl> |
1116 |
</div> |
1117 |
|
1118 |
<div id="informative-references" class="section informative reference"> |
1119 |
<h3>Non$B!>(Bnormative References</h3> |
1120 |
|
1121 |
<dl class=ed> |
1122 |
<dt id=ref-CSS>CSS</dt> |
1123 |
<dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading |
1124 |
Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1) |
1125 |
Specification</a></cite>, |
1126 |
<abbr title="World Wide Web Consortium">W3C</abbr> Candidate |
1127 |
Recommendation, <time datetime=2007-07-19>19 July 2007</time>. |
1128 |
Work in progress. The latest version of the specification is |
1129 |
available at |
1130 |
<code class=URI><<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd> |
1131 |
<dt id=ref-CSSOM>CSSOM</dt> |
1132 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&content-type=text/html;%20charset=utf-8">Cascading |
1133 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
1134 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
1135 |
<time datetime=2007-06-18>18 June 2007</time>. Work in progress. |
1136 |
The latest Editor's Draft of the specification is available at |
1137 |
<code class=URI><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
1138 |
<dt id=ref-HTML5>HTML5</dt> |
1139 |
<dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>, |
1140 |
<abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr> |
1141 |
Working Draft. Work in progress.</dd> |
1142 |
<dt id=ref-SAPI>SAPI</dt> |
1143 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8">Selectors <abbr>API</abbr></a></cite>, |
1144 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
1145 |
<time datetime=2007-08-29>29 August 2007</time>. Work in progress. |
1146 |
The latest Editor's Draft of the specification is available at |
1147 |
<code class=URI><<a href="http://dev.w3.org/2006/webapi/selectors-api/Overview.html">http://dev.w3.org/2006/webapi/selectors-api/Overview.html</a>></code>. |
1148 |
The latest published version of the specification is available at |
1149 |
<code class=URI><<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd> |
1150 |
<dt id=XBL2>XBL2</dt> |
1151 |
<dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr> |
1152 |
2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>. |
1153 |
Work in progress. The latest |
1154 |
<abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished |
1155 |
version of the specification is available at |
1156 |
<code class=URI><<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd> |
1157 |
<dt id=ref-XML5>XML5</dt> |
1158 |
<dd class=ed>@@</dd> |
1159 |
</dl> |
1160 |
</div> |
1161 |
|
1162 |
</div> |
1163 |
|
1164 |
</body> |
1165 |
</html> |