3 |
<head> |
<head> |
4 |
<title>DOM Document Type Definition Module</title> |
<title>DOM Document Type Definition Module</title> |
5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
<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"> |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
8 |
</head> |
</head> |
9 |
<body class="has-abstract"> |
<body class="has-abstract"> |
84 |
<p>This is a work-in-progress specification for DOM Document Type |
<p>This is a work-in-progress specification for DOM Document Type |
85 |
Definition module, as implemented by manakai and |
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> |
<a href="http://suika.fam.cx/gate/2005/sw/DOM%20XML%20Document%20Type%20Definition">partially documented in the SuikaWiki</a>.</p> |
|
|
|
|
<p>...</p> |
|
87 |
</div> |
</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> |
</div> |
101 |
|
|
102 |
<div class="section" id="terminology"> |
<div class="section" id="terminology"> |
120 |
<p><span class=ed>Algorithm is normative but non-normative</span>. |
<p><span class=ed>Algorithm is normative but non-normative</span>. |
121 |
In addition, the order in which <a href="#errors">errors</a> are |
In addition, the order in which <a href="#errors">errors</a> are |
122 |
raised is undefined.</p> |
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 |
|
</div> |
129 |
|
|
130 |
|
<div class=section id=dom-dtdef> |
131 |
|
<h2><abbr>DOM</abbr> Document Type Definition Module</h2> |
132 |
|
|
133 |
|
<p>The <abbr>DOM</abbr> Document Type Definition module, version 3.0, |
134 |
|
consists of three interfaces:</p> |
135 |
|
<ul> |
136 |
|
<li><a href="#DocumentXDoctype"><code>DocumentXDoctype</code></a></li> |
137 |
|
<li><a href="#DocumentTypeDefinition"><code>DocumentTypeDefinition</code></a></li> |
138 |
|
<li><a href="#ElementTypeDefinition"><code>ElementTypeDefinition</code></a></li> |
139 |
|
<li><a href="#AttributeDefinition"><code>AttributeDefinition</code></a></li> |
140 |
|
</ul> |
141 |
|
|
142 |
|
<p>In addition, it adds methods, attributes, and/or constants to interfaces |
143 |
|
<a href="#Node"><code>Node</code></a>, |
144 |
|
<a href="#Entity"><code>Entity</code></a>, |
145 |
|
<a href="#EntityReference"><code>EntityReference</code></a>, and |
146 |
|
<a href="#Notation"><code>Notation</code></a>. |
147 |
|
It modifies semantics of some of methods and attributes in |
148 |
|
<a href="#Node"><code>Node</code></a> and |
149 |
|
<a href="#ProcessingInstruction"><code>ProcessingInstruction</code></a> |
150 |
|
interfaces, for the support of new interfaces.</p> |
151 |
|
|
152 |
|
<div class=section id=features> |
153 |
|
<h3>Feature Name</h3> |
154 |
|
|
155 |
|
<p>In a <abbr>DOM</abbr> implementation that supports the version 3.0 of |
156 |
|
the <abbr>DOM</abbr> Document Type Definition module, the |
157 |
|
<code>hasFeature</code> method of a <code>DOMImplementation</code> object |
158 |
|
<em class=rfc2119>MUST</em> return <code>true</code> when the parameters are |
159 |
|
set to <code>http://suika.fam.cx/www/2006/feature/XDoctype</code> and |
160 |
|
<code>3.0</code> respectively.</p> |
161 |
|
|
162 |
|
<p>In such an implementation, the <code>getFeature</code> method of a |
163 |
|
<code>Document</code> object <em class=rfc2119>MUST</em> return the (at least |
164 |
|
conceptually) same object implementing the |
165 |
|
<a href="#DocumentXDoctype"><code>DocumentXDoctype</code></a> interface when |
166 |
|
the parameters are set to |
167 |
|
<code>http://suika.fam.cx/www/2006/feature/XDoctype</code> and |
168 |
|
<code>3.0</code> respectively. Likewise, any method that takes one or more |
169 |
|
feature names with or without version number, including the methods |
170 |
|
<code>hasFeature</code> and <code>getFeature</code>, |
171 |
|
<em class=rfc2119>MUST</em> behave in a manner consistent with the |
172 |
|
aforementioned cases.</p> |
173 |
|
</div> |
174 |
|
|
175 |
|
<div class=section id=section-documentxdoctype> |
176 |
|
<h2>The <code>DocumentXDoctype</code> Interface</h2> |
177 |
|
|
178 |
|
<pre class=idl><code>interface <dfn id=DocumentXDoctype><code>DocumentXDoctype</code></dfn> { |
179 |
|
DocumentType <a href="#createDocumentTypeDefinition">createDocumentTypeDefinition</a> |
180 |
|
(in DOMString <a href="#createDocumentTypeDefinition-name"><var>name</var></a>) |
181 |
|
raises (DOMException); |
182 |
|
ElementTypeDefinition <a href="#createElementTypeDefinition">createElementTypeDefinition</a> |
183 |
|
(in DOMString <a href="#createElementTypeDefinition-name"><var>name</var></a>) |
184 |
|
raises (DOMException); |
185 |
|
AttributeDefinition <a href="#createAttributeDefinition">createAttributeDefinition</a> |
186 |
|
(in DOMString <a href="#createAttributeDefinition-name"><var>name</var></a>) |
187 |
|
raises (DOMException); |
188 |
|
Entity <a href="#createGeneralEntity">createGeneralEntityDefinition</a> |
189 |
|
(in DOMString <a href="#createGeneralEntity-name"><var>name</var></a>) |
190 |
|
raises (DOMException); |
191 |
|
Notation <a href="#createNotation">createNotation</a> |
192 |
|
(in DOMString <a href="#createNotation-name"><var>name</var></a>) |
193 |
|
raises (DOMException); |
194 |
|
}</code></pre> |
195 |
|
|
196 |
|
<div class=ed>@@ cast definition</div> |
197 |
|
|
198 |
|
<dl> |
199 |
|
<dt><dfn id=createDocumentTypeDefinition class=dom-method><code>createDocumentTypeDefinition</code></dfn>, |
200 |
|
method</dt> |
201 |
|
<dd> |
202 |
|
<p>This method creates a <code>DocumentType</code> node with the specified |
203 |
|
name, belonging to the document.</p> |
204 |
|
<p>The <dfn id=createDocumentTypeDefinition-name class=dom-param><var>name</var></dfn> |
205 |
|
parameter is the name of the document type.</p> |
206 |
|
|
207 |
|
<p>When invoked, the method <em class=rfc2119>MUST</em> create and |
208 |
|
return a <code>DocumentType</code> node with the following attributes:</p> |
209 |
|
<dl> |
210 |
|
<dt><code>attributes</code>, <code>parentNode</code></dt> |
211 |
|
<dd><code>null</code>.</dd> |
212 |
|
<dt><code>elementTypes</code>, <code>generalEntities</code>, and |
213 |
|
<code>notations</code></dt> |
214 |
|
<dd>Empty <code>NamedNodeMap</code> objects.</dd> |
215 |
|
<dt><code>entities</code></dt> |
216 |
|
<dd>The same value as the <code>generalEntities</code> attribute.</dd> |
217 |
|
<dt><code>childNodes</code></dt> |
218 |
|
<dd>An empty <code>NodeList</code> object.</dd> |
219 |
|
<dt><code>internalSubset</code>, <code>publicId</code>, and |
220 |
|
<code>systemId</code></dt> |
221 |
|
<dd>Empty strings.</dd> |
222 |
|
<dt><code>manakaiReadOnly</code> <span class=ed>[manakai]</span></dt> |
223 |
|
<dd><code>false</code>.</dd> |
224 |
|
<dt><code>nodeName</code></dt> |
225 |
|
<dd><a href="#createDocumentTypeDefinition-name"><var>name</var></a>.</dd> |
226 |
|
<dt><code>ownerDocument</code></dt> |
227 |
|
<dd>The <code>Document</code> over which the method is invoked.</dd> |
228 |
|
</dl> |
229 |
|
<p>In addition, the method <em class=rfc2119>MUST</em> be marked as |
230 |
|
containing five general entity declarations: <code>amp</code>, |
231 |
|
<code>lt</code>, <code>gt</code>, <code>quot</code>, and |
232 |
|
<code>apos</code>.</p> |
233 |
|
</dd> |
234 |
|
<dt><dfn id=createElementTypeDefinition class=dom-method><code>createElementTypeDefinition</code></dfn>, |
235 |
|
method</dt> |
236 |
|
<dd> |
237 |
|
<p>This method creates a <code>ElementTypeDefinition</code> node with the |
238 |
|
specified name, belonging to the document.</p> |
239 |
|
<p>The <dfn id=createElementTypeDefinition-name class=dom-param><var>name</var></dfn> |
240 |
|
parameter is the name of the element type defined by the element |
241 |
|
type definition.</p> |
242 |
|
</dd> |
243 |
|
<dt><dfn id=createAttributeDefinition class=dom-method><code>createAttributeDefinition</code></dfn>, |
244 |
|
method</dt> |
245 |
|
<dd> |
246 |
|
<p>This method creates a <code>AttributeDefinition</code> node with the |
247 |
|
specified name, belonging to the document.</p> |
248 |
|
<p>The <dfn id=createAttributeDefinition-name class=dom-param><var>name</var></dfn> |
249 |
|
parameter is the name of the attribute defined by the attribute |
250 |
|
definition.</p> |
251 |
|
</dd> |
252 |
|
<dt><dfn id=createGeneralEntity class=dom-method><code>createGeneralEntity</code></dfn>, |
253 |
|
method</dt> |
254 |
|
<dd> |
255 |
|
<p>This method creates a <code>Entity</code> node with the |
256 |
|
specified name, which represents a general entity, belonging to the |
257 |
|
document.</p> |
258 |
|
<p>The <dfn id=createGeneralEntity-name class=dom-param><var>name</var></dfn> |
259 |
|
parameter is the name of the general entity.</p> |
260 |
|
</dd> |
261 |
|
<dt><dfn id=createNotation class=dom-method><code>createNotation</code></dfn>, |
262 |
|
method</dt> |
263 |
|
<dd> |
264 |
|
<p>This method creates a <code>Notation</code> node with the |
265 |
|
specified name, belonging to the document.</p> |
266 |
|
<p>The <dfn id=createNotation-name class=dom-param><var>name</var></dfn> |
267 |
|
parameter is the name of the notation.</p> |
268 |
|
</dd> |
269 |
|
</dl> |
270 |
|
|
271 |
|
<pre class=ed> |
272 |
|
|
273 |
|
[8] |
274 |
|
The [CODE(DOMm)@en[[[createElementTypeDefinition]]]] |
275 |
|
method [['''MUST''']] create an |
276 |
|
[CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
277 |
|
object with the following attribute values: |
278 |
|
- [CODE(DOMa)@en[[[attributeDefinitions]]]]: |
279 |
|
An empty [CODE(DOMi)@en[[[NamedNodeMap]]]]. |
280 |
|
- [CODE(DOMa)@en[[[attributes]]]], |
281 |
|
[CODE(DOMa)@en[[[parentNode]]]]: [CODE(DOM)@en[[[null]]]]. |
282 |
|
- [CODE(DOMa)@en[[[childNodes]]]]: An empty |
283 |
|
[CODE(DOMi)@en[[[NodeList]]]]. |
284 |
|
- [CODE(DOMa)@en[[[manakaiReadOnly]]]]: |
285 |
|
[CODE(IDL)@en[[[false]]]]. |
286 |
|
- [CODE(DOMa)@en[[[nodeName]]]]: [CODE(DOMp)@en[[[name]]]]. |
287 |
|
- [CODE(DOMa)@en[[[ownerDocument]]]]: The |
288 |
|
[CODE(DOMi)@en[[[Document]]]] node on which the method |
289 |
|
is invoked. |
290 |
|
- [CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]]: |
291 |
|
[CODE(IDL)@en[[[null]]]]. |
292 |
|
|
293 |
|
@@ Ensure all attributes are defined |
294 |
|
|
295 |
|
[9] The [CODE(DOMm)@en[[[createAttributeDefinition]]]] |
296 |
|
method [['''MUST''']] create an |
297 |
|
[CODE(DOMi)@en[[[AttributeDefinition]]]] |
298 |
|
object with the following attribute values: |
299 |
|
- [CODE(DOMa)@en[[[allowedTokens]]]]: |
300 |
|
An empty [CODE(DOMi)@en[[[DOMStringList]]]]. |
301 |
|
- [CODE(DOMa)@en[[[attributes]]]], |
302 |
|
[CODE(DOMa)@en[[[parentNode]]]]: [CODE(DOM)@en[[[null]]]]. |
303 |
|
- [CODE(DOMa)@en[[[childNodes]]]]: An empty |
304 |
|
[CODE(DOMi)@en[[[NodeList]]]]. |
305 |
|
- [CODE(DOMa)@en[[[declaredType]]]]: |
306 |
|
[CODE(DOMc)@en[[[NO_TYPE_ATTR]]]]. |
307 |
|
- [CODE(DOMa)@en[[[defaultType]]]]: |
308 |
|
[CODE(DOMc)@en[[[UNKNOWN_DEFAULT]]]]. |
309 |
|
- [CODE(DOMa)@en[[[manakaiReadOnly]]]]: |
310 |
|
[CODE(IDL)@en[[[false]]]]. |
311 |
|
- [CODE(DOMa)@en[[[nodeName]]]]: [CODE(DOMp)@en[[[name]]]]. |
312 |
|
- [CODE(DOMa)@en[[[ownerDocument]]]]: The |
313 |
|
[CODE(DOMi)@en[[[Document]]]] node on which the method |
314 |
|
is invoked. |
315 |
|
- [CODE(DOMa)@en[[[ownerElementTypeDefinition]]]]: |
316 |
|
[CODE(IDL)@en[[[null]]]]. |
317 |
|
|
318 |
|
@@ Ensure all attributes are defined |
319 |
|
|
320 |
|
@@ Should we keep these statements?: |
321 |
|
However, if the <cfg::cfg|xml-id> configuration |
322 |
|
parameter is set to <DOM::true> and the <P::name> |
323 |
|
is <XA::xml:id>, then the [CODE(DOMa)@en[[[declaredType]]]] |
324 |
|
attribute is set to |
325 |
|
<C::AttributeDefinition.ID_ATTR>. |
326 |
|
[CODE(DOMa)@en[[[defaultType]]]]? |
327 |
|
|
328 |
|
[11] The [CODE(DOMm)@en[[[createGeneralEntity]]]] |
329 |
|
method [['''MUST''']] create an [CODE(DOMi)@en[[[Entity]]]] |
330 |
|
node with the following attribute values: |
331 |
|
- [CODE(DOMa)@en[[[attributes]]]], |
332 |
|
[CODE(DOMa)@en[[[parentNode]]]]: [CODE(DOM)@en[[[null]]]]. |
333 |
|
- [CODE(DOMa)@en[[[childNodes]]]]: An empty |
334 |
|
[CODE(DOMi)@en[[[NodeList]]]]. |
335 |
|
- [CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]]: |
336 |
|
No explicit value is set. |
337 |
|
- [CODE(DOMa)@en[[[manakaiEntityBaseURI]]]]: |
338 |
|
No explicit value is set. |
339 |
|
- [CODE(DOMa)@en[[[manakaiEntityURI]]]]: |
340 |
|
No explicit value is set. |
341 |
|
- [CODE(DOMa)@en[[[manakaiHasReplacementTree]]]]: |
342 |
|
[CODE(IDL)@en[[[false]]]]. |
343 |
|
- [CODE(DOMa)@en[[[manakaiReadOnly]]]]: |
344 |
|
[CODE(IDL)@en[[[false]]]]. |
345 |
|
- [CODE(DOMa)@en[[[nodeName]]]]: [CODE(DOMp)@en[[[name]]]]. |
346 |
|
- [CODE(DOMa)@en[[[notationName]]]]: [CODE(DOM)@en[[[null]]]]. |
347 |
|
- [CODE(DOMa)@en[[[ownerDocument]]]]: The |
348 |
|
[CODE(DOMi)@en[[[Document]]]] node on which the method |
349 |
|
is invoked. |
350 |
|
- [CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]]: |
351 |
|
[CODE(IDL)@en[[[null]]]]. |
352 |
|
- [CODE(DOMa)@en[[[publicId]]]]: [CODE(DOM)@en[[[null]]]]. |
353 |
|
- [CODE(DOMa)@en[[[systemId]]]]: [CODE(DOM)@en[[[null]]]]. |
354 |
|
|
355 |
|
@@ Ensure all attributes are defined |
356 |
|
|
357 |
|
@@ publicId and systemId should be empty string? |
358 |
|
|
359 |
|
[13] The [CODE(DOMm)@en[[[createNotation]]]] |
360 |
|
method [['''MUST''']] create a [CODE(DOMi)@en[[[Notation]]]] |
361 |
|
node with the following attribute values: |
362 |
|
- [CODE(DOMa)@en[[[attributes]]]], |
363 |
|
[CODE(DOMa)@en[[[parentNode]]]]: [CODE(DOM)@en[[[null]]]]. |
364 |
|
- [CODE(DOMa)@en[[[childNodes]]]]: An empty |
365 |
|
[CODE(DOMi)@en[[[NodeList]]]]. |
366 |
|
- [CODE(DOMa)@en[[[manakaiDeclarationBaseURI]]]]: |
367 |
|
No explicit value is set. |
368 |
|
- [CODE(DOMa)@en[[[manakaiReadOnly]]]]: |
369 |
|
[CODE(IDL)@en[[[false]]]]. |
370 |
|
- [CODE(DOMa)@en[[[nodeName]]]]: [CODE(DOMp)@en[[[name]]]]. |
371 |
|
- [CODE(DOMa)@en[[[ownerDocument]]]]: The |
372 |
|
[CODE(DOMi)@en[[[Document]]]] node on which the method |
373 |
|
is invoked. |
374 |
|
- [CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]]: |
375 |
|
[CODE(IDL)@en[[[null]]]]. |
376 |
|
- [CODE(DOMa)@en[[[publicId]]]]: [CODE(DOM)@en[[[null]]]]. |
377 |
|
- [CODE(DOMa)@en[[[systemId]]]]: [CODE(DOM)@en[[[null]]]]. |
378 |
|
|
379 |
|
@@ Ensure all attributes are defined |
380 |
|
|
381 |
|
[7] |
382 |
|
These method [['''MUST''']] raise an |
383 |
|
[CODE(DOMi)@en[[[INVALID_CHARACTER_ERR]]]] |
384 |
|
[CODE(DOMi)@en[[[DOMException]]]] |
385 |
|
if the [CODE(DOMp)@en[[[name]]]] is not a legal |
386 |
|
name according to the XML version in use as |
387 |
|
specified in the [CODE(DOMa)@en[[[xmlVersion]]]] |
388 |
|
attribute of the [CODE(DOMi)@en[[[Document]]]] node. |
389 |
|
|
390 |
|
;; Non-XML case is intentionally left unspecified for now |
391 |
|
since DOM3 does not define it. |
392 |
|
|
393 |
|
;; [CODE(DOMp)@en[[[name]]]] does not have to |
394 |
|
be a namespace qualified name. |
395 |
|
|
396 |
|
;; Note also that it is not an error for the |
397 |
|
[CODE(DOMp)@en[[[name]]]] parameter value |
398 |
|
to match to the name of one of predefined general |
399 |
|
parsed entities in XML or HTML. |
400 |
|
|
401 |
|
;; If the [CODE(DOMa)@en[[[strictErrorChecking]]]] attribute |
402 |
|
is set to [CODE(IDL)@en[[[false]]]], then the implementation |
403 |
|
is not required to raise this exception. |
404 |
|
|
405 |
|
Otherwise, these method [['''MUST''']] return |
406 |
|
the newly created node. |
407 |
|
</pre> |
408 |
|
|
409 |
</div> |
</div> |
410 |
|
|
411 |
|
<div class=section id=section-documenttypedefinition> |
412 |
|
<h2>The <code>DocumentTypeDefinition</code> Interface</h2> |
413 |
|
|
414 |
|
<pre class=idl><code>interface <dfn id=DocumentTypeDefinition><code>DocumentTypeDefinition</code></dfn> { |
415 |
|
|
416 |
|
}</code></pre> |
417 |
|
|
418 |
|
<pre class=ed> |
419 |
|
[1] In an implementation that supports the |
420 |
|
[CODE(URI)@en[[[http://suika.fam.cx/www/2006/feature/XDoctype]]]] |
421 |
|
feature, a [CODE(DOMi)@en[[[DocumentType]]]] node |
422 |
|
must implement the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] |
423 |
|
interface. See [[DOM XML Document Type Definition]>>3] for |
424 |
|
details. |
425 |
|
|
426 |
|
|
427 |
|
** Children |
428 |
|
|
429 |
|
[2] The [DFN@en[[CODE(DOMa)@en[[[elementTypes]]]] attribute]] |
430 |
|
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface |
431 |
|
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that |
432 |
|
contains all element types belongs to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] |
433 |
|
node. The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]]. |
434 |
|
The attribute is read-only. |
435 |
|
|
436 |
|
What are contained in this collection depends on how |
437 |
|
the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node was created. If the |
438 |
|
node was created as the result of parsing of an XML document, |
439 |
|
it [['''MUST''']] contain all element types whose element type and / or |
440 |
|
attribute definition list declaration are encountered by and provided for the DOM |
441 |
|
implementation from the XML processor. Note that the XML processor might not |
442 |
|
provide a part of or entire such information depending on the configuration. |
443 |
|
If more than one declarations for an element type or an attribute is available |
444 |
|
at the time of the definition node construction, then declarations other than |
445 |
|
the first ones [['''MUST''']] be discarded. |
446 |
|
|
447 |
|
The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
448 |
|
object that contains all the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] nodes |
449 |
|
belong to the node. The returned [CODE(DOMi)@en[[[NamedNodeMap]]]] object |
450 |
|
[['''MUST''']] be read-only if and only if the node is read-only. |
451 |
|
Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live |
452 |
|
and therefore any change of read-only flag on the node is immediately |
453 |
|
reflected by that of the object. |
454 |
|
|
455 |
|
[3] The [DFN@en[[CODE(DOMa)@en[[[generalEntities]]]] attribute]] |
456 |
|
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface |
457 |
|
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that contains all the |
458 |
|
general entities belong to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node. |
459 |
|
The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]]. |
460 |
|
The attribute is read-only. |
461 |
|
|
462 |
|
All entities declared in the document type definition |
463 |
|
contained in or referenced from the document entity |
464 |
|
might not be exposed through this collection, depending |
465 |
|
on the information provided by the XML processor for |
466 |
|
the DOM implementation. In particular, it might not |
467 |
|
contain any entity if entity references are expanded |
468 |
|
at the parse time. An implementation [['''MUST NOT''']] |
469 |
|
expose an [CODE(DOMi)@en[[[Entity]]]] node whose [CODE(DOMa)@en[[[nodeName]]]] |
470 |
|
is equal to the name of one of five predefined general entities in |
471 |
|
XML through the collection as the result of parsing of an XML |
472 |
|
document that has no error. Duplicate entity declarations are also discarded. |
473 |
|
|
474 |
|
The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
475 |
|
object that contains all the [CODE(DOMi)@en[[[Entity]]]] nodes |
476 |
|
representing general entities belong to the node. The returned |
477 |
|
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if |
478 |
|
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live |
479 |
|
and therefore any change of read-only flag on the node is immediately |
480 |
|
reflected by that of the object. |
481 |
|
|
482 |
|
The attribute [['''MUST''']] return the same value as the |
483 |
|
[CODE(DOMa)@en[[[entites]]]] attribute of the |
484 |
|
[CODE(DOMi)@en[[[DocumentType]]]] interface on the same node. |
485 |
|
|
486 |
|
[4] The [DFN@en[[CODE(DOMa)@en[[[notations]]]] attribute]] |
487 |
|
of the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interface |
488 |
|
is a live [CODE(DOMi)@en[[[NamedNodeMap]]]] object that contains |
489 |
|
all the notations belong to the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] |
490 |
|
node. The type of the attribute is [CODE(DOMi)@en[[[NamedNodeMap]]]]. |
491 |
|
The attribute is read-only. |
492 |
|
|
493 |
|
If the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] node is |
494 |
|
created from an XML document, duplicate notation declarations, if any, in DTD |
495 |
|
[['''MUST NOT''']] result in a node in the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
496 |
|
object and only the first declaration [['''MUST''']] be |
497 |
|
made available as a [CODE(DOMi)@en[[[Notation]]]] node. |
498 |
|
|
499 |
|
;; This definition is based on one for the |
500 |
|
[CODE(DOMa)@en[[[notations]]]] attribute of the |
501 |
|
[CODE(DOMi)@en[[[DocumentType]]]] interface in DOM XML module. |
502 |
|
Since duplication is violation to the Validity Constraint, |
503 |
|
XML parsers might vary on how notations are notified to |
504 |
|
the application. In particular, [CODE(InfoProp)@en[[[notations]]]] |
505 |
|
property of the document information item in XML Information Set |
506 |
|
is so defined that in case ''any'' notation is declared for |
507 |
|
multiple times then the property has no value. |
508 |
|
|
509 |
|
The attribute [['''MUST''']] return the [CODE(DOMi)@en[[[NamedNodeMap]]]] |
510 |
|
object that contains all the [CODE(DOMi)@en[[[Notation]]]] nodes |
511 |
|
representing notations belong to the node. The returned |
512 |
|
[CODE(DOMi)@en[[[NamedNodeMap]]]] object [['''MUST''']] be read-only if and only if |
513 |
|
the node is read-only. Note that the [CODE(DOMi)@en[[[NamedNodeMap]]]] object is live |
514 |
|
and therefore any change of read-only flag on the node is immediately |
515 |
|
reflected by that of the object. |
516 |
|
|
517 |
|
A DOM implementation is not required to implement the |
518 |
|
[CODE(DOMa)@en[[[notations]]]] attribute twice |
519 |
|
for the [CODE(DOMi)@en[[[DocumentType]]]] and |
520 |
|
the [CODE(DOMi)@en[[[DocumentTypeDefinition]]]] interfaces; |
521 |
|
the latter is defined to contain the same value as the former. |
522 |
|
|
523 |
|
|
524 |
|
** Open Issues (informative) |
525 |
|
|
526 |
|
[5] A future version of the interface might define the |
527 |
|
[CODE(DOMa)@en[[[parameterEntities]]]] attribute and |
528 |
|
getter/setter for parameter entities. |
529 |
|
</pre> |
530 |
|
</div> |
531 |
|
|
532 |
|
<div class=section id=section-elementtypedefinition> |
533 |
|
<h2>The <code>ElementTypeDefinition</code> Interface</h2> |
534 |
|
|
535 |
|
<pre class=idl><code>interface <dfn id=ElementTypeDefinition><code>ElementTypeDefinition</code></dfn> { |
536 |
|
|
537 |
|
}</code></pre> |
538 |
|
|
539 |
|
<pre class=ed>** Modifications to [CODE(DOMi)@en[[[Node]]]] members |
540 |
|
|
541 |
|
[3] The getter of the [CODE(DOMa)@en[[[attributes]]]] attribute |
542 |
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
543 |
|
[['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
544 |
|
|
545 |
|
[4] The getter of the [CODE(DOMa)@en[[[baseURI]]]] attribute |
546 |
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
547 |
|
[['''MUST''']] return the [CODE(DOMa)@en[[[baseURI]]]] |
548 |
|
of the [CDOE(DOMa)@en[[[ownerDocument]]]] of the |
549 |
|
[CODE(DOMi)@en[[[ElementTypeDefinition]]]] object. |
550 |
|
Note that it might be [CODE(IDL)@en[[[null]]]]. |
551 |
|
|
552 |
|
[1] The getter of the [CODE(DOMa)@en[[[nodeName]]]] attribute |
553 |
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] object |
554 |
|
[['''MUST''']] return the name of the element type. |
555 |
|
|
556 |
|
[2] The getters of the [CODE(DOMa)@en[[[nodeValue]]]] |
557 |
|
and [CODE(DOMa)@en[[[textContent]]]] attributes |
558 |
|
of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
559 |
|
object [['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
560 |
|
|
561 |
|
;; Thus, the setter of these attributes do nothing. |
562 |
|
|
563 |
|
The setter of the [CODE(DOMa)@en[[[textContent]]]] |
564 |
|
attribute of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
565 |
|
object [['''MUST NOT''']] throw a |
566 |
|
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]. |
567 |
|
|
568 |
|
** The [CODE(DOMi)@en[ElementTypeDefinition]] Interface |
569 |
|
|
570 |
|
[5] The |
571 |
|
[DFN@en[[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute]] |
572 |
|
of the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] |
573 |
|
interface is defined in [[manakai//DOM Extensions]>>50].</pre> |
574 |
|
</div> |
575 |
|
|
576 |
|
<div class=section id=section-attributedefinition> |
577 |
|
<h2>The <code>AttributeDefinition</code> Interface</h2> |
578 |
|
|
579 |
|
<pre class=idl><code>interface <dfn id=AttributeDefinition><code>AttributeDefinition</code></dfn> { |
580 |
|
|
581 |
|
}</code></pre> |
582 |
|
|
583 |
|
<pre class=ed>** Modifications to [CODE(DOMi)@en[[[Node]]]] members |
584 |
|
|
585 |
|
[3] The getter of the [CODE(DOMa)@en[[[attributes]]]] attribute |
586 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
587 |
|
[['''MUST''']] return [CODE(IDL)@en[[[null]]]]. |
588 |
|
|
589 |
|
[9] The getter of the [CODE(DOMa)@en[[[baseURI]]]] attribute |
590 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
591 |
|
[['''MUST''']] return the [CODE(DOMa)@en[[[baseURI]]]] |
592 |
|
of the [CDOE(DOMa)@en[[[ownerDocument]]]] of the |
593 |
|
[CODE(DOMi)@en[[[AttributeDefinition]]]] object. |
594 |
|
Note that it might be [CODE(IDL)@en[[[null]]]]. |
595 |
|
|
596 |
|
[1] The getter of the [CODE(DOMa)@en[[[nodeName]]]] attribute |
597 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
598 |
|
[['''MUST''']] return the name of the attribute. |
599 |
|
|
600 |
|
[2] The getter of the [CODE(DOMa)@en[[[nodeValue]]]] attribute |
601 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
602 |
|
[['''MUST''']] return the normalized default value |
603 |
|
of the attribute. |
604 |
|
|
605 |
|
@@ |
606 |
|
|
607 |
|
[4] The getter of the [CODE(DOMa)@en[[[textContent]]]] |
608 |
|
attribute of an [CODE(DOMi)@en[[[AttributeDefinition]]]] |
609 |
|
object [['''MUST''']] behave as if it were an |
610 |
|
[CODE(DOMi)@en[[[Attr]]]] object. |
611 |
|
|
612 |
|
The setter of the [CODE(DOMa)@en[[[textContent]]]] attribute |
613 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
614 |
|
[['''MUST''']] behave as if the following algorithm |
615 |
|
is performed: |
616 |
|
= If the [CODE(DOMi)@en[[[AttributeDefinition]]]] |
617 |
|
object is read-only, then throw an |
618 |
|
[CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]]. |
619 |
|
= Remove any child node the node has. |
620 |
|
= If the new value is not empty and not [CODE(IDL)@en[[[null]]]], |
621 |
|
then create a [CODE(DOMi)@en[[[Text]]]] node |
622 |
|
whose [CODE(DOMa)@en[[[data]]]] is the new value |
623 |
|
and append it to the [CODE(DOMi)@en[[[AttributeDefinition]]]]. |
624 |
|
|
625 |
|
** Definition groups |
626 |
|
|
627 |
|
[6] The |
628 |
|
[DFN@en[definition group [CODE(DOM)@en[[[DeclaredValueType]]]]]] |
629 |
|
contains integers indicating the type of |
630 |
|
attribute value: |
631 |
|
,[CODE(DOMc)@en[[[NO_TYPE_ATTR]]]],[CODE(IDL)[[[0]]]],The attribute value type corresponding to [[no value]] in XML Information Set. |
632 |
|
,[CODE(DOMc)@en[[[CDATA_ATTR]]]],[CODE(IDL)[[[1]]]],The attribute value type is [CODE(XML)@en[[[CDATA]]]]. |
633 |
|
,[CODE(DOMc)@en[[[ID_ATTR]]]],[CODE(IDL)[[[2]]]],The attribute value type is [CODE(XML)@en[[[ID]]]]. |
634 |
|
,[CODE(DOMc)@en[[[IDREF_ATTR]]]],[CODE(IDL)[[[3]]]],The attribute value type is [CODE(XML)@en[[[IDREF]]]]. |
635 |
|
,[CODE(DOMc)@en[[[IDREFS_ATTR]]]],[CODE(IDL)[[[4]]]],The attribute value type is [CODE(XML)@en[[[IDREFS]]]]. |
636 |
|
,[CODE(DOMc)@en[[[ENTITY_ATTR]]]],[CODE(IDL)[[[5]]]],The attribute value type is [CODE(XML)@en[[[ENTITY]]]]. |
637 |
|
,[CODE(DOMc)@en[[[ENTITIES_ATTR]]]],[CODE(IDL)[[[6]]]],The attribute value type is [CODE(XML)@en[[[ENTITIES]]]]. |
638 |
|
,[CODE(DOMc)@en[[[NMTOKEN_ATTR]]]],[CODE(IDL)[[[7]]]],The attribute value type is [CODE(XML)@en[[[NMTOKEN]]]]. |
639 |
|
,[CODE(DOMc)@en[[[NMTOKENS_ATTR]]]],[CODE(IDL)[[[8]]]],The attribute value type is [CODE(XML)@en[[[NMTOKENS]]]]. |
640 |
|
,[CODE(DOMc)@en[[[NOTATION_ATTR]]]],[CODE(IDL)[[[9]]]],The attribute value type is [CODE(XML)@en[[[NOTATION]]]]. |
641 |
|
,[CODE(DOMc)@en[[[ENUMERATION_ATTR]]]],[CODE(IDL)[[[10]]]],The attribute value is enumeration type. |
642 |
|
,[CODE(DOMc)@en[[[UNKNOWN_ATTR]]]],[CODE(IDL)[[[11]]]],"The attribute value type is unknown, because no declaration for the attribute has been read but not [CODE(InfoProp)@en[[[all declarations processed]]]] property would be false." |
643 |
|
|
644 |
|
The type of these constants are |
645 |
|
[CODE(IDL)@en[[[unsigned]] [[short]]]]. |
646 |
|
|
647 |
|
If no attribute type information is provided, |
648 |
|
or if the source of that information does not |
649 |
|
distinguish [[no value]] and [[unknown]] as in |
650 |
|
XML Information Set, then the |
651 |
|
[CODE(DOMc)@en[[[NO_TYPE_ATTR]]]] value |
652 |
|
[['''MUST''']] be used. |
653 |
|
|
654 |
|
;; A newly created [CODE(DOMi)@en[[[AttributeDefinition]]]] |
655 |
|
object by [CODE(DOMm)@en[[[createAttributeDefinition]]]] |
656 |
|
method has [CODE(DOMa)@en[[[declaredType]]]] attribute |
657 |
|
set to [CODE(DOMc)@en[[[NO_TYPE_ATTR]]]]. |
658 |
|
|
659 |
|
If the source of the attribute type information |
660 |
|
does not distinguish [[no value]] and / or [[unknown]] |
661 |
|
and [CODE(XML)@en[[[CDATA]]]], then the |
662 |
|
[CODE(DOMc)@en[[[CDATA_ATTR]]]] value [['''MUST''']] |
663 |
|
be used. |
664 |
|
|
665 |
|
[11] |
666 |
|
In Perl binding, the objects implementing the |
667 |
|
[CODE(DOMi)@en[[[Attr]]]] interface [['''MUST''']] |
668 |
|
also implement the [CODE(DOM)@en[[[DeclaredValueType]]]] |
669 |
|
constant group. |
670 |
|
|
671 |
|
[7] The |
672 |
|
[DFN@en[definition group [CODE(DOM)@en[[[DefaultValueType]]]]]] |
673 |
|
contains integers indicating the type of |
674 |
|
default attribute value: |
675 |
|
,[CODE(DOMc)@en[[[UNKNOWN_DEFAULT]]]],[CODE(IDL)[[[0]]]],The default value is unknown. |
676 |
|
,[CODE(DOMc)@en[[[FIXED_DEFAULT]]]],[CODE(IDL)[[[1]]]],The default value is provided and the attribute is [CODE(XML)@en[#[[FIXED]]]] to that value. |
677 |
|
,[CODE(DOMc)@en[[[REQUIRED_DEFAULT]]]],[CODE(IDL)[[[2]]]],An attribute specification is [CODE(XML)@en[#[[REQUIRED]]]] for the attribute. |
678 |
|
,[CODE(DOMc)@en[[[IMPLIED_DEFAULT]]]],[CODE(IDL)[[[3]]]],The default value is [CODE(XML)@en[#[[IMPLIED]]]]. |
679 |
|
,[CODE(DOMc)@en[[[EXPLICIT_DEFAULT]]]],[CODE(IDL)[[[4]]]],The default value is provided but the attribute is not fixed to it. |
680 |
|
|
681 |
|
The type of these constants are |
682 |
|
[CODE(IDL)@en[[[unsigned]] [[short]]]]. |
683 |
|
|
684 |
|
If the source of the attribute default value type |
685 |
|
does not distinguish the [CODE(XML)@en[#[[IMPLIED]]]] |
686 |
|
default and unknown default, then the |
687 |
|
[CODE(DOMc)@en[[[IMPLIED_DEFAULT]]]] value |
688 |
|
[['''MUST''']] be used. |
689 |
|
|
690 |
|
;; A newly created [CODE(DOMi)@en[[[AttributeDefinition]]]] |
691 |
|
object by [CODE(DOMm)@en[[[createAttributeDefinition]]]] |
692 |
|
method has [CODE(DOMa)@en[[[declaredType]]]] attribute |
693 |
|
set to [CODE(DOMc)@en[[[NO_TYPE_ATTR]]]]. |
694 |
|
|
695 |
|
** Tree-relationship Attributes |
696 |
|
|
697 |
|
[10] |
698 |
|
The |
699 |
|
[DFN@en[[CODE(DOMa)@en[[[ownerElementTypeDefinition]]]] attribute]] |
700 |
|
of the [CODE(DOMi)@en[[[AttributeDefinition]]]] interface |
701 |
|
is read-only and of type |
702 |
|
[CODE(DOMi)@en[[[ElementTypeDefinition]]]]. |
703 |
|
It is the [CODE(DOMi)@en[[[ElementTypeDefinition]]]] node |
704 |
|
which the [CODE(DOMi)@en[[[AttributeDefinition]]]] node |
705 |
|
belong to. |
706 |
|
|
707 |
|
If the [CODE(DOMi)@en[[[AttributeDefinition]]]] node |
708 |
|
is included in the [CODE(DOMa)@en[[[attributeDefinitions]]]] |
709 |
|
list of an [CODE(DOMi)@en[[[ElementTypeDefinition]]]] node, |
710 |
|
then the attribute [['''MUST''']] return the |
711 |
|
[CODE(DOMi)@en[[[ElementTypeDefinition]]]] node. |
712 |
|
Otherwise, it [['''MUST''']] return [CODE(DOM)@en[[[null]]]]. |
713 |
|
|
714 |
|
;; This attribute is analogue to the |
715 |
|
[CODE(DOMa)@en[[[ownerDocumentTypeDefinition]]]] attribute |
716 |
|
for [CODE(DOMi)@en[[[ElementTypeDefinition]]]], |
717 |
|
[CODE(DOMi)@en[[[Entity]]]], and [CODE(DOMi)@en[[[Notation]]]] |
718 |
|
nodes, or the [CODE(DOMa)@en[[[ownerElement]]]] |
719 |
|
attribute for [CODE(DOMi)@en[[[Attr]]]] nodes. |
720 |
|
|
721 |
|
** Attributes |
722 |
|
|
723 |
|
[5] |
724 |
|
The [DFN@en[[CODE(DOMa)@en[[[declaredType]]]] attribute]] |
725 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
726 |
|
represents the type of the attribute value. |
727 |
|
|
728 |
|
This attribute is read-write. |
729 |
|
The type of the attribute is |
730 |
|
[CODE(IDL)@en[[[unsigned]] [[short]]]]. It is expected |
731 |
|
that this attribute has a value from the definition group |
732 |
|
[CODE(DOM)@en[[[DeclaredValueType]]]]. |
733 |
|
|
734 |
|
The getter [['''MUST''']] return a value associated |
735 |
|
to this attribute. |
736 |
|
|
737 |
|
The setter [['''MUST''']] |
738 |
|
throw a [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]] |
739 |
|
[CODE(DOMi)@en[[[DOMException]]]] if the |
740 |
|
[CODE(DOMi)@en[[[AttributeDefinition]]]] object is read-only. |
741 |
|
Otherwise, the setter [['''MUST''']] set the specified |
742 |
|
value as the value associated to this attribute. |
743 |
|
|
744 |
|
If a parser create an [CODE(DOMi)@en[[[AttributeDefinition]]]] |
745 |
|
object, then it [['''MUST''']] set a value |
746 |
|
from the [CODE(DOM)@en[[[DeclaredValueType]]]] |
747 |
|
definition group. |
748 |
|
|
749 |
|
[8] |
750 |
|
The [DFN@en[[CODE(DOMa)@en[[[defaultType]]]] attribute]] |
751 |
|
of an [CODE(DOMi)@en[[[AttributeDefinition]]]] object |
752 |
|
represents the type of the attribute default value. |
753 |
|
|
754 |
|
This attribute is read-write. |
755 |
|
The type of the attribute is |
756 |
|
[CODE(IDL)@en[[[unsigned]] [[short]]]]. It is expected |
757 |
|
that this attribute has a value from the definition group |
758 |
|
[CODE(DOM)@en[[[DefaultValueType]]]]. |
759 |
|
|
760 |
|
The getter [['''MUST''']] return a value associated |
761 |
|
to this attribute. |
762 |
|
|
763 |
|
The setter [['''MUST''']] |
764 |
|
throw a [CODE(DOMc)@en[[[NO_MODIFICATION_ALLOWED_ERR]]]] |
765 |
|
[CODE(DOMi)@en[[[DOMException]]]] if the |
766 |
|
[CODE(DOMi)@en[[[AttributeDefinition]]]] object is read-only. |
767 |
|
Otherwise, the setter [['''MUST''']] set the specified |
768 |
|
value as the value associated to this attribute. |
769 |
|
|
770 |
|
If a parser create an [CODE(DOMi)@en[[[AttributeDefinition]]]] |
771 |
|
object, then it [['''MUST''']] set a value |
772 |
|
from the [CODE(DOM)@en[[[DefaultValueType]]]] |
773 |
|
definition group.</pre> |
774 |
|
</div> |
775 |
|
|
776 |
|
</div> |
777 |
|
|
778 |
|
|
779 |
|
|
780 |
|
|
781 |
|
|
782 |
<div id="references" class="section reference"> |
<div id="references" class="section reference"> |