/[suikacvs]/markup/xml/xmlcc/xmlcc-work.en.html
Suika

Contents of /markup/xml/xmlcc/xmlcc-work.en.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.14 - (show annotations) (download) (as text)
Wed Nov 14 12:30:06 2007 UTC (16 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.13: +42 -41 lines
File MIME type: text/html
Move error class section up

1 <!DOCTYPE html>
2 <html lang="en" class="formal-specification status-work-in-progress">
3 <head>
4 <title>manakai's XML Conformance Checking</title>
5 <link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec">
6 <link rel="license" href="http://suika.fam.cx/c/gnu/fdl">
7 <style>
8 a[id]::before {
9 content: "[" attr(id) "]";
10 color: gray;
11 font-size: 70%;
12 font-family: Courier New, monospace;
13 vertical-align: 60%;
14 }
15 </style>
16 </head>
17 <body class="has-abstract">
18
19 <div class="header">
20 <h1>manakai's <abbr>XML</abbr> Conformance Checking</h1>
21 <h2>Working Draft <time datetime=2007-11-14>14 November 2007</time></h2>
22
23 <dl class="versions-uri">
24 <dt>This Version</dt>
25 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work"
26 >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>&gt;</code></dd>
27 <dt>Latest Version</dt>
28 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc"
29 >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc</a>&gt;</code></dd>
30 <dt>Latest Working Draft</dt>
31 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work"
32 >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>&gt;</code></dd>
33 <!-- <dt>Previous Version</dt> -->
34 <dt>Version History</dt>
35 <dd><code class=URI>&lt;<a href="http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html">http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html</a>&gt;</code></dd>
36 </dl>
37 <dl class="authors" id="author">
38 <dt>Author</dt>
39 <dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author"
40 lang=ja>Wakaba</a>
41 <code class="mail">&lt;<a href="mailto:w@suika.fam.cx" rel="author"
42 >w@suika.fam.cx</a>&gt;</code></dd>
43 </dl>
44
45 <p class="copyright" lang="en">&#xA9; <time>2007</time> <a
46 href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>.
47 Permission is granted to copy, distribute and/or modify this document
48 under the terms of the <a rel="license"
49 href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>,
50 Version 1.2
51 or any later version published by the <a
52 href="http://www.fsf.org/">Free Software Foundation</a>;
53 with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover
54 Texts. A copy of the license is
55 available at <code class="URI">&lt;<a
56 href="http://www.gnu.org/copyleft/fdl.html"
57 rel="license">http://www.gnu.org/copyleft/fdl.html</a>&gt;</code>.</p>
58 </div>
59
60 <div id="abstract" class="section">
61 <h2>Abstract</h2>
62
63 <div class="ed issue">...</div>
64
65 </div>
66
67 <div id="status" class="section">
68 <h2>Status of This Document</h2>
69
70 <p class=section-info><em>This section describes the status of this document
71 at the time of its publication. Other documents
72 might supersede this document.</em></p>
73
74 <p>This document is a working draft, produced as part of the
75 <a href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>
76 subproject of the
77 <a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a>
78 project. It might be updated, replaced, or obsoleted by
79 other documents at any time. It is inappropriate to
80 cite this document as other than <q>work in progress</q>.</p>
81
82 <p>Comments on this document are welcome and
83 may be sent to the <a href="#author">author</a>.</p>
84
85 <p>Translations of thie document might be available.
86 The English version of the document is the only
87 normative version.</p>
88 </div>
89
90 <div id="introduction" class="section">
91 <h2>Introduction</h2>
92
93 <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
94
95 <div class="issue ed">...</div>
96
97
98 </div>
99
100 <div class="section" id="terminology">
101 <h2>Terminology</h2>
102
103 <p>The key words <q><em class="rfc2119">MUST</em></q>,
104 <q><em class="rfc2119">MUST NOT</em></q>,
105 <q><em class="rfc2119">SHOULD</em></q>,
106 <q><em class="rfc2119">SHOULD NOT</em></q>, and
107 <q><em class=rfc2119>MAY</em></q> in this
108 document are to be interpreted as described in
109 <a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr>
110 2119</a>
111 <cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p>
112
113 <!-- Strictly speaking the paragraph below is not part of terminology. -->
114 <p>All examples and notes in this specification are non$B!>(Bnormative,
115 as are all sections explicitly marked non$B!>(Bnormative. Everything
116 else in this specification is normative.</p>
117
118 <p><span class=ed>Algorithm is normative but non-normative</span>.
119 In addition, the order in which <a href="#errors">errors</a> are
120 raised is undefined.</p>
121 </div>
122
123
124 <div class=section id=error-categories>
125 <h2>Error Classification</h2>
126
127 <p class=ed>If a <code>Document</code> node has no
128 xml-well-formedness-error, entity-error, and unknown-error,
129 then it is well-formed. If a well-formed <code>Document</code>
130 node has no xml-validity-error, it is valid.</p>
131
132 <div class="note memo">
133 <p>A well$B!>(Bformed <code>Document</code> can be safely serialized
134 into a well$B!>(Bformed XML document. A valid <code>Document</code>
135 can be easily serialized into a valid XML document.</p>
136 </div>
137
138 <p>Errors are classified into these
139 <dfn id=error-category title="error category">error categories</dfn>:</p>
140
141 <dl id=errors>
142 <dt><dfn id=entity-error><code>entity-error</code></dfn></dt>
143 <dd>
144 <p class=ed>@@</p>
145 <div class="note memo">
146 <p>This <span class=ed>algorithm</span> does not support
147 <abbr>DOM</abbr> tree with one or more <code>EntityReference</code>
148 nodes. It is expected that any entity references are expanded
149 at the parse time and any unexpandable entity references
150 make parse time errors raised so that never result in
151 <abbr>DOM</abbr> tree with <code>EntityReference</code> nodes.</p>
152 </div>
153 </dd>
154 <dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt>
155 <dd class=ed>@@</dd>
156 <dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt>
157 <dd>
158 <p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a>
159 will be raised when a construct, which might not be restored to the same
160 construct when it is serialized and then re-parsed by a conforming
161 processor, is encountered.</p>
162 <div class="example memo">
163 <p>For a <code>Comment</code> node a
164 <a href="#round-trip-warning"><code>round-trip-warning</code></a> will
165 be raised, since <abbr>XML</abbr> processors are not required to
166 report texts of comments for applications.</p>
167 </div>
168 </dd>
169 <dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt>
170 <dd class=ed>@@</dd>
171 <dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt>
172 <dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0
173 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
174 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> /
175 <abbr>XML</abbr> 1.1
176 <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
177 <a href="@@/#dt-error">error</a>)
178 that is not classified to any other <a href="#error-category">error
179 category</a>.</dd>
180 <dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt>
181 <dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0
182 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
183 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal
184 error</a> / <abbr>XML</abbr> 1.1
185 <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
186 <a href="@@/#dt-fatal">fatal error</a>)
187 that is not classified to any other <a href="#error-category">error
188 category</a>. <span class=ed>@@ What errors fall into this category?</span></dd>
189 <dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt>
190 <dd>
191 <p>An
192 <a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a>
193 will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement
194 in <abbr>XML</abbr> specification is not met.</p>
195 </dd>
196 <dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt>
197 <dd>A violation of validity constraint in XML document.</dd>
198 <dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt>
199 <dd><p>If an <code>xml-well-formedness-error</code> is raised,
200 it would not be possible to generate an XML serialization that
201 would match to the appropriate production rule and that would not
202 violate to any well$B!>(Bformedness constraint in XML
203 specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>,
204 <a href="#ref-XML11">XML11</a>]</cite>.</p></dd>
205 </dl>
206
207 <div class=ed><p>@@ TODO: #dt-atuseroption at user option
208 (MAY or MUST), #dt-compat for compatibility,
209 #dt-interop for interoperability</p></div>
210
211 </div>
212
213 <div class=section id=parsing-xml>
214 <h2>Parsing <abbr>XML</abbr> Document</h2>
215
216 <ul>
217 <li>If the <abbr>XML</abbr> document does not begin with an
218 <abbr>XML</abbr> declaration, then raise an
219 <a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li>
220 <li>If the replacement text of an entity declaration is
221 <code>&lt;</code>, then raise an
222 <a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!--
223 "strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11].
224 --></li>
225 <li>If attribute definition whose <code>Name</code> is
226 <code>xml:space</code> has <span class=ed>declared type different from
227 (default|preserve), (default), or (preserve)</span>, then raise an
228 <a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>.
229 <span class=ed>@@ duplication with
230 <a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!--
231 <!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li>
232 <!--
233
234 #vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting
235 #wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset
236 #ExtSubset Well-formedness constraint: External Subset
237 #PE-between-Decls Well-formedness constraint: PE Between Declarations
238
239 @@ Need detailed review, but maybe should be in parsing phase
240
241 #vc-check-rmd Validity constraint: Standalone Document Declaration
242
243 -->
244 </ul>
245 </div>
246
247 <div class="section" id=checking-dom>
248 <h2>Checking <abbr>DOM</abbr></h2>
249
250 <p>The following algorithms and definitions are applied to
251 <abbr>XML</abbr> documents; especially, they are not applied
252 to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p>
253
254 <div class=section id=definitions>
255 <h3>Definitions</h3>
256
257 <p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is
258 the <abbr>XML</abbr> version of the document to which the node belongs.
259 For a <code>Documemt</code> node, the <abbr>XML</abbr> version
260 of the document is the value of the <code>xmlVersion</code>
261 attribute of the node. For a <code>DocumentType</code> node whose
262 <code>ownerDocument</code> attribute is set to <code>null</code>,
263 the <abbr>XML</abbr> version of the document is <code>1.0</code><!--
264 since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->.
265 For any other node, the <abbr>XML</abbr> version of the document
266 is that of the <code>Document</code> node contained in the
267 <code>ownerDocument</code> attribute of the node.</p>
268
269 </div>
270
271
272 <div class=section id=checking-components>
273 <h3>Checking Components</h3>
274
275 <p>The algorithm
276 <dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to
277 validate an <abbr>XML</abbr> character data
278 (<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p>
279 <ol>
280 <li>If <var>s</var> contains a character that is <em>not</em> in
281 the character class <a href="#class-Char10"><code>Char10</code></a>,
282 then raise an
283 <a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li>
284 <li>If <var>s</var> contains a character that is in the character
285 class <a href="#class-CompatChar10"><code>CompatChar10</code></a>,
286 then raise an
287 <a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li>
288 <li>If <var>s</var> contains a character that is in the character
289 class <a href="#class-ControlChar10"><code>ControlChar10</code></a>,
290 then raise an
291 <a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li>
292 <li class=ed>@@ XML 1.1 support</li>
293 <li>If <var>s</var> contains a <code class=char>U+000D</code>
294 <code class=charname>CARRIAGE RETURN</code> character, then
295 raise a
296 <a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>.
297 <span class=ed>@@ We should not raise duplicate errors for U+000D
298 in attribute values. In addition, we should support a mode where
299 U+000D will be serialized as &#x000D; (so that no round-trip-error
300 will be raised).</span></li>
301 </ol>
302
303 <p>The algorithm
304 <dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a
305 <code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn> is defined
306 as following:</p>
307 <ol>
308 <li>If <var>s</var> begins with the string <code>xml</code> (in any
309 case combination), then raise an
310 <a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>.
311 <span class=ed>@@ except for attribute names <code>xml:lang</code>,
312 <code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>,
313 <code>xmlns</code>, <code>xmlns:<var>*</var></code>,
314 pi name <code>xml-stylesheet</code>.</span></li>
315 <!-- COLON in Name is a lowercase "should not" in a Note of [XML10],
316 [XML11]. -->
317 <li class=ed>@@</li>
318 </ol>
319
320 <p>The algorithm
321 <dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to
322 validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn>
323 is defined as following:</p>
324 <ol>
325 <li class=ed>@@</li>
326 </ol>
327
328 <p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate
329 a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the
330 algorithm below <em class=rfc2119>MUST</em> be used:</p>
331 <ol>
332 <li>If <var>pid</var> contains any character
333 that is outside of the range of <code>#x20 | #xD | #xA |
334 [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->,
335 then it is an
336 <a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li>
337 <li>If <var>pid</var> contains one of <code class=char>U+0009</code>
338 <code class=charname>CHARACTER TABULATION</code>,
339 <code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>,
340 and <code class=char>U+000D</code> <code class=charname>LINE FEED</code>
341 characters, if the first character of <var>pid</var> is
342 <code class=char>U+0020</code> <code class=charname>SPACE</code> character,
343 if the last character of <var>pid</var> is <code class=char>U+0020</code>
344 <code class=charname>SPACE</code> character, or if there is a
345 <code class=char>U+0020</code> <code class=charname>SPACE</code> character
346 immediately followed by another <code class=char>U+0020</code>
347 <code class=charname>SPACE</code> character in <var>pid</var>, then it is a
348 <a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li>
349 <li class=ed>@@ Should we check formal-public-identifierness?</li>
350 </ol>
351
352 </div>
353
354 <div class=section id=checking-node>
355 <h3>Checking <code>Node</code></h3>
356
357 <p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to
358 check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as
359 following:</p>
360 <dl class=switch>
361 <dt>If <var>n</var> is an <code>Attr</code> node</dt>
362 <dd>
363 <ol>
364 <li><a href="#algorithm-to-validate-a-ncname">Validate the
365 <code>localName</code> attribute value as an <code>NCName</code></a>.</li>
366 <li>If the <code>prefix</code> attribute value is different from
367 <code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate
368 the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li>
369 <li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the
370 <code>childNodes</code> list of <var>n</var>,
371 <ol>
372 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
373 <code>Text</code> or <code>EntityReference</code> node, then it is an
374 <a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li>
375 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
376 <code>EntityReference</code> node, then it is an
377 <a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li>
378 <li>Otherwise,
379 <a href="#algorithm-to-check-a-node" title="check a node">check
380 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
381 </ol></li>
382 <li>If <code>nodeName</code> attribute of <var>n</var> is
383 <code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span>
384 and <code>value</code> attribute of <var>n</var> is neither
385 <code>default</code> nor <code>preserve</code>, then it is an
386 <a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!--
387 Note that <!ATTLIST e xml:space (default|preserve) "a">...
388 <e xml:space="default"/> is conforming and valid. --></li>
389 <li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its
390 successor] or an empty string, then xml-misc-warning
391 (a "fact"-level error; not an XML error).</li>
392 <li class=ed>@@ <code>specified</code>,
393 <code>manakaiAttributeType</code></li>
394 <!-- xml:space MUST be declared to be valid. -->
395 </ol>
396 </dd>
397 <dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt>
398 <dd>
399 <ol>
400 <li class=ed></li>
401 <li>If <code>nodeName</code> attribute of <var>n</var> is
402 <code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span>
403 and <span class=ed>its declared type is different from (default|preserve),
404 (default), or (preserve)</span>, then raise an
405 <a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li>
406 <li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the
407 <code>childNodes</code> list of <var>n</var>,
408 <ol>
409 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
410 <code>Text</code> or <code>EntityReference</code> node, then it is an
411 <a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li>
412 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
413 <code>EntityReference</code> node, then it is an
414 <a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li>
415 <li>Otherwise,
416 <a href="#algorithm-to-check-a-node" title="check a node">check
417 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
418 </ol></li>
419 </ol>
420 </dd>
421 <dt>If <var>n</var> is a <code>CDATASection</code> node</dt>
422 <dd>
423 <ol>
424 <li><a href="#algorithm-to-validate-an-xml-character-data">Validate the
425 <code>data</code> attribute value as an <abbr>XML</abbr> character
426 data</a>.</li>
427 <li>If the <code>data</code> attribute value contains
428 a string <code>]]></code>, then raise an
429 <a href="#xml-well-formedness-error" id=wfe-cs-mse><code>xml-well-formedness-error</code></a>.<!-- "for compatibility" --></li>
430 <li>If the <code>childNodes</code> list of <var>n</var> contains
431 any nodes, they are in
432 <a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li>
433 </ol>
434 </dd>
435 <dt>If <var>n</var> is a <code>Comment</code> node</dt>
436 <dd>
437 <ol>
438 <li>Raise an
439 <a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li>
440 <li><a href="#algorithm-to-validate-an-xml-character-data">Validate the
441 <code>data</code> attribute value as an <abbr>XML</abbr> character
442 data</a>.</li>
443 <li>If the <code>data</code> attribute value contains
444 a string <code>--</code>, or if it ends with a character
445 <code>-</code>, then raise an
446 <a href="#xml-well-formedness-error" id=wfe-comment-com><code>xml-well-formedness-error</code></a>.<!--
447 "for compatibility" --></li>
448 <li>If the <code>childNodes</code> list of <var>n</var> contains
449 any nodes, they are in
450 <a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li>
451 </ol>
452 </dd>
453 <dt>If <var>n</var> is a <code>Document</code> node</dt>
454 <dd>
455 <ol>
456 <li>If <a href="#xml-version"><abbr>XML</abbr> version</a> of <var>n</var>
457 is different from <code>1.0</code> or <code>1.1</code>,
458 then it is an <code class=ed>unknown-error?</code>.</li>
459 <li>If the <code>xmlEncoding</code> attribute value does <em>not</em>
460 match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code>
461 <span class=ed>@@ formal def</span>, then it is an
462 <a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li>
463 <li>The <code>childNodes</code> list of <var>n</var> have to
464 consist of zero or more <code>Comment</code> and/or
465 <code>ProcessingInstruction</code> nodes, followed by
466 an optional <code>DocumentType</code> node, followed
467 by zero or more <code>Comment</code> and/or
468 <code>ProcessingInstruction</code> nodes, followed by
469 an <code>Element</code> node, followed
470 by zero or more <code>Comment</code> and/or
471 <code>ProcessingInstruction</code> nodes. Any violation to this is an
472 <a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li>
473 <li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn>
474 in the <code>childNodes</code> list of <var>n</var>,
475 <ol>
476 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
477 <code>EntityReference</code> node, then
478 <a href="#algorithm-to-check-a-node" title="check a node">check
479 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
480 </ol></li>
481 <li class=ed>@@ <code>allDeclarationsProcessed</code></li>
482 </ol>
483 </dd>
484 <dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt>
485 <dd>
486 <ol>
487 <li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn>
488 in the <code>childNodes</code> list of <var>n</var>,
489 <ol>
490 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
491 <code>Element</code>, <code>Text</code>, <code>CDATASection</code>,
492 <code>Comment</code>, <code>ProcessingInstruction</code>, or
493 <code>EntityReference</code> node, then it is an
494 <a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li>
495 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
496 <code>EntityReference</code> node, then it is an
497 <a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li>
498 <li>Otherwise,
499 <a href="#algorithm-to-check-a-node" title="check a node">check
500 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
501 </ol></li>
502 </ol>
503 </dd>
504 <dt>If <var>n</var> is a <code>DocumentType</code> node</dt>
505 <dd>
506 <ol>
507 <li><a href="#algorithm-to-validate-a-ncname">Validate the
508 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
509 <li>Follow the following substeps:
510 <ol>
511 <li>If <code>ownerDocument</code> attribute of <var>n</var> is
512 <code>null</code>, then abort these substeps.</li>
513 <li>If <code>documentElement</code> attribute of the node
514 set to <code>ownerDocument</code> attribute of <var>n</var> is
515 <code>null</code>, then abort these substeps.</li>
516 <li>If <code>nodeName</code> attribute of the node set to
517 <code>documentElement</code> attribute of the node set to
518 <code>ownerDocument</code> attribute of <var>n</var> is
519 different from <code>nodeName</code> of <var>n</var>,
520 then raise an
521 <a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li>
522 </ol>
523 </li>
524 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
525 the <code>publicId</code> attribute value as a public identifier</a>.</li>
526 <li>If the <code>systemId</code> attribute value contains
527 both <code>"</code> and <code>'</code> characters, it is a
528 <a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li>
529 <!-- publicId = non-null and systemId = null -->
530 <li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn>
531 in the <code>childNodes</code> list of <var>n</var>,
532 <ol>
533 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
534 <code>ProcessingInstruction</code> node, then it is an
535 <a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>.
536 <span class=ed>@@ ref to manakai's extensions</span></li>
537 <li>Otherwise, <!-- if n_c is not an EntityReference node, -->
538 <a href="#algorithm-to-check-a-node" title="check a node">check
539 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
540 </ol></li>
541 <li class=ed>@@ <code>entities</code>, <code>notations</code>,
542 <code>elementTypes</code>, externally declared?</li>
543 </ol>
544 </dd>
545 <dt>If <var>n</var> is an <code>Element</code> node</dt>
546 <dd>
547 <ol>
548 <li><a href="#algorithm-to-validate-a-ncname">Validate the
549 <code>localName</code> attribute value as an <code>NCName</code></a>.</li>
550 <li>If the <code>prefix</code> attribute value is different from
551 <code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate
552 the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li>
553 <li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn>
554 in the <code>childNodes</code> list of <var>n</var>,
555 <ol>
556 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
557 <code>Element</code>,
558 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
559 <code>ProcessingInstruction</code>, or
560 <code>EntityReference</code> node, then it is an
561 <a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li>
562 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
563 <code>EntityReference</code> node, then it is an
564 <a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li>
565 <li>Otherwise,
566 <a href="#algorithm-to-check-a-node" title="check a node">check
567 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
568 </ol></li>
569 </ol>
570 </dd>
571 <dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt>
572 <dd>
573 <ol>
574 <li class=ed></li>
575 <li>If the <code>childNodes</code> list of <var>n</var> contains
576 any nodes, they are in
577 <a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li>
578 </ol>
579 </dd>
580 <dt>If <var>n</var> is an <code>Entity</code> node</dt>
581 <dd>
582 <ol>
583 <li>An <a href="#entity-error" id=ee-entity-node><code>entity-error</code></a> <span class=ed>@@ if !notationName</span>.</li>
584 <li><a href="#algorithm-to-validate-a-ncname">Validate the
585 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
586 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
587 the <code>publicId</code> attribute value as a public identifier</a>.</li>
588 <li>If the <code>systemId</code> attribute value contains
589 both <code>"</code> and <code>'</code> characters, it is a
590 <a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li>
591 <!-- publicId = non-null and systemId = null -->
592 <li class=ed>@@ <code>notationName</code></li>
593 <li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn>
594 in the <code>childNodes</code> list of <var>n</var>,
595 <ol>
596 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
597 <code>Element</code>,
598 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
599 <code>ProcessingInstruction</code>, or <code>EntityReference</code>
600 node, then it is an
601 <a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li>
602 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
603 <code>EntityReference</code> node, then it is an
604 <a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li>
605 <li>Otherwise,
606 <a href="#algorithm-to-check-a-node" title="check a node">check
607 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
608 </ol></li>
609 </ol>
610 </dd>
611 <dt>If <var>n</var> is an <code>EntityReference</code> node</dt>
612 <dd>
613 <ol>
614 <li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li>
615 <li><a href="#algorithm-to-validate-a-ncname">Validate the
616 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
617 <li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn>
618 in the <code>childNodes</code> list of <var>n</var>,
619 <ol>
620 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
621 <code>Element</code>,
622 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
623 <code>ProcessingInstruction</code>, or <code>EntityReference</code>
624 node, then it is an
625 <a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li>
626 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an
627 <code>EntityReference</code> node, then it is an
628 <a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li>
629 <li>Otherwise,
630 <a href="#algorithm-to-check-a-node" title="check a node">check
631 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
632 </ol></li>
633 </ol>
634 </dd>
635 <dt>If <var>n</var> is a <code>Notation</code> node</dt>
636 <dd>
637 <ol>
638 <li><a href="#algorithm-to-validate-a-ncname">Validate the
639 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
640 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
641 the <code>publicId</code> attribute value as a public identifier</a>.</li>
642 <li>If the <code>systemId</code> attribute value contains
643 both <code>"</code> and <code>'</code> characters, it is a
644 <a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li>
645 <li>If the <code>childNodes</code> list of <var>n</var> contains
646 any nodes, they are in
647 <a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li>
648 </ol>
649 </dd>
650 <dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt>
651 <dd>
652 <ol>
653 <li>If the <code>target</code> attribute value matches to the string
654 <code>xml</code> in any case combination, then raise a
655 <a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li>
656 <li>Otherwise, <a href="#algorithm-to-validate-a-ncname">validate the
657 <code>target</code> attribute value as an <code>NCName</code></a>.</li>
658 <li>Then,
659 <a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML character data">validate
660 the <code>data</code> attribute value as an <abbr>XML</abbr> character
661 data</a>.</li>
662 <li>If the <code>data</code> attribute value contains a string
663 <code>?></code>, then raise a
664 <a href="#xml-well-formedness-error" id=wfe-pi-pic><code>xml-well-formedness-error</code></a>.</li>
665 <li>If the <code>data</code> attribute value starts with either
666 <code class=char>U+0009</code> <code class=charname>CHARACTER
667 TABULATION</code>, <code class=char>U+000A</code> <code class=charname>LINE
668 FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE
669 RETURN</code>, or <code class=char>U+0020</code>
670 <code class=charname>SPACE</code> character, then raise a
671 <a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li>
672 <li>If the <code>childNodes</code> list of <var>n</var> contains
673 any nodes, then raise an
674 <a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li>
675 </ol>
676 </dd>
677 <dt>If <var>n</var> is a <code>Text</code> node</dt>
678 <dd>
679 <ol>
680 <li><a href="#algorithm-to-validate-an-xml-character-data">Validate the
681 <code>data</code> attribute value as an <abbr>XML</abbr> character
682 data</a>.</li>
683 <li>If the <code>childNodes</code> list of <var>n</var> contains
684 any nodes, they are in
685 <a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li>
686 </ol>
687 </dd>
688 <dt>Otherwise</dt>
689 <dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd>
690 </dl>
691
692 </div>
693
694 </div>
695
696 <div id=classes class=section>
697 <h2>Character Classes</h2>
698
699 <p>This section defines a couple of character classes.
700 These classes are referred to by algorithms specified above.</p>
701
702 <p>Character class <dfn id=class-Char10><code>Char10</code></dfn>
703 contains the following characters:</p>
704 <ul>
705 <li><code class=char>U+0009</code> <code class=charname>CHARACTER
706 TABULATION</code></li>
707 <li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li>
708 <li><code class=char>U+000D</code> <code class=charname>CARRIAGE
709 RETURN</code></li>
710 <li><code class=char>U+0020</code> <code class=charname>SPACE</code>
711 .. <code class=char>U+D7FF</code></li>
712 <li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code>
713 <code class=charname>REPLACEMENT CHARACTER</code></li>
714 <li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li>
715 </ul>
716 <div class="note memo">
717 <p>This character class contains all characters allowed in the production rule
718 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a>
719 of <abbr>XML</abbr> 1.0
720 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p>
721 </div>
722
723 <p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn>
724 contains the following characters:</p>
725 <ul>
726 <li class=ed>@@ <q>Document authors are encouraged to avoid "compatibility characters", as defined in section 6.8 of [Unicode @@ Unicode 2.0 @@] (see also D21 in section 3.6 of [Unicode3]).</q></li>
727 </ul>
728
729 <p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn>
730 contains the following characters:</p>
731 <ul>
732 <li><code class=char>U+007F</code> <code class=charname>DELETE</code> ..
733 <code class=char>U+0084</code> <code class=charname>INDEX</code></li>
734 <li><code class=char>U+0086</code> <code class=charname>START OF SELECTED
735 AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION
736 PROGRAM COMMAND</code></li>
737 <li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li>
738 <li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li>
739 <li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li>
740 <li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li>
741 <li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li>
742 <li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li>
743 <li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li>
744 <li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li>
745 <li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li>
746 <li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li>
747 <li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li>
748 <li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li>
749 <li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li>
750 <li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li>
751 <li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li>
752 <li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li>
753 <li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li>
754 </ul>
755 <div class="note memo">
756 <p>This character class contains the characters listed in the Note in
757 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a>
758 of <abbr>XML</abbr> 1.0
759 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>,
760 as amended by
761 <a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p>
762 </div>
763
764 </div>
765
766 <div id="references" class="section reference">
767 <h2>References</h2>
768
769 <div id="normative-references" class="section normative reference">
770 <h3>Normative References</h3>
771
772 <dl>
773 <dt id=ref-DOM3CORE>DOM3CORE</dt>
774 <dd class=ed>@@ W3C DOM Level 3 Core</dd>
775 <dt id=ref-DOMDTDEF>DOMDTDEF</dt>
776 <dd class=ed>@@ manakai's extension to DOM for document type definitions</dd>
777 <dt id="ref-KEYWORDS">KEYWORDS</dt>
778 <dd><cite><a href="urn:ietf:rfc:2119">Key words for use in
779 <abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>,
780 <abbr title="Internet Engineering Task Force">IETF</abbr>
781 <a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr>
782 14</a>, <abbr title="Request for Comments">RFC</abbr> 2119,
783 <time datetime=1997-03>March 1997</time>.
784 <em>This</em> version of the specification is referenced.</dd>
785 <dt id=ref-INFOSET>INFOSET</dt>
786 <dd class=ed>@@</dd>
787 <dt id=ref-XML10">XML10</dt>
788 <dd><cite><a href="http://www.w3.org/TR/2006/REC-xml-20060816">Extensible
789 Markup Language (<abbr>XML</abbr>) 1.0 (Fourth Edition)</a></cite>,
790 <abbr>W3C</abbr> Recommendation, <time datetime=2006-08-16>16 August
791 2006</time>, edited in place <time datetime=2006-09-29>29 September
792 2006</time>. Tje latest version of the specification is available at
793 <code class=uri>&lt;<a href="http://www.w3.org/TR/xml">http://www.w3.org/TR/xml</a>&gt;</code>.
794 <em>This</em> version of the specification is referenced.</dd>
795 <dt id=ref-XML11>XML11</dt>
796 <dd class=ed>@@</dd>
797 </dl>
798 </div>
799
800 <div id="informative-references" class="section informative reference">
801 <h3>Non$B!>(Bnormative References</h3>
802
803 <dl class=ed>
804 <dt id=ref-CSS>CSS</dt>
805 <dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading
806 Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1)
807 Specification</a></cite>,
808 <abbr title="World Wide Web Consortium">W3C</abbr> Candidate
809 Recommendation, <time datetime=2007-07-19>19 July 2007</time>.
810 Work in progress. The latest version of the specification is
811 available at
812 <code class=URI>&lt;<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd>
813 <dt id=ref-CSSOM>CSSOM</dt>
814 <dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&amp;content-type=text/html;%20charset=utf-8">Cascading
815 Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>,
816 <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
817 <time datetime=2007-06-18>18 June 2007</time>. Work in progress.
818 The latest Editor's Draft of the specification is available at
819 <code class=URI>&lt;<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd>
820 <dt id=ref-HTML5>HTML5</dt>
821 <dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>,
822 <abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr>
823 Working Draft. Work in progress.</dd>
824 <dt id=ref-SAPI>SAPI</dt>
825 <dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&amp;content-type=text/html;%20charset=utf-8">Selectors <abbr>API</abbr></a></cite>,
826 <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
827 <time datetime=2007-08-29>29 August 2007</time>. Work in progress.
828 The latest Editor's Draft of the specification is available at
829 <code class=URI>&lt;<a href="http://dev.w3.org/2006/webapi/selectors-api/Overview.html">http://dev.w3.org/2006/webapi/selectors-api/Overview.html</a>></code>.
830 The latest published version of the specification is available at
831 <code class=URI>&lt;<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd>
832 <dt id=XBL2>XBL2</dt>
833 <dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr>
834 2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>.
835 Work in progress. The latest
836 <abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished
837 version of the specification is available at
838 <code class=URI>&lt;<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd>
839 <dt id=ref-XML5>XML5</dt>
840 <dd class=ed>@@</dd>
841 </dl>
842 </div>
843
844 </div>
845
846 </body>
847 </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24