/[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.13 - (show annotations) (download) (as text)
Wed Nov 14 12:28:40 2007 UTC (16 years, 5 months ago) by wakaba
Branch: MAIN
Changes since 1.12: +86 -14 lines
File MIME type: text/html
remainings of section 2

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24