/[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.29 - (show annotations) (download) (as text)
Fri Oct 17 05:57:26 2008 UTC (16 years, 1 month ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
Changes since 1.28: +115 -42 lines
File MIME type: text/html
Error occurred while calculating annotation data.
Clarify the scope of the specification; Clarify that the specification defines the parser requirements and the conformance checker requirements; Clarify what specifications define the parser requirements not in this specification; Remove a requirement to read unused general entities; Parser no longer has to raise a well-formedness error for a production rule violation if it will be raised by a conformance checker; Minor editorial fixes

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=2008-10-17>17 October 2008</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>$B!>(B<time>2008</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>The scope of this specification is explicitly limited to the <a
83 href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>
84 implementation. It is <em>not</em> the purpose of this specification
85 to define a general guideline to parse or to check XML documents.
86 This specification does <em>not</em> try to define a new version of
87 XML at all.
88
89 <p>This version of the specification supports the fourth edition of
90 XML 1.0 and the second edition of XML 1.1. The fifth edition of XML
91 1.0 might be supported in a later version. XML namespaces
92 specifications is expected to be supported in a later version of this
93 specification.
94
95 <p>Comments on this document are welcome and
96 may be sent to the <a href="#author">author</a>.</p>
97
98 <p>Translations of thie document might be available.
99 The English version of the document is the only
100 normative version.</p>
101 </div>
102
103 <div id="introduction" class="section">
104 <h2>Introduction</h2>
105
106 <p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p>
107
108 <p>This specification defines how the parsing and the conformance
109 checking of XML documents should be implemented in the <a
110 href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>
111 XML parser and conformance checker.
112
113 <p>It is <em>not</em> the purpose of this specification to define,
114 e.g., how to parse XML documents in general; its scope is explicitly
115 limited to the <a
116 href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a>
117 implementation.
118
119 <div class="issue ed">...
120
121 <p>Much of invalid (well-formed or not) XML document parsing and XML document
122 / XML DOM conformance is left undefined so that this document provides a
123 guideline for conformance checkers.
124 </div>
125
126
127 </div>
128
129 <div class="section" id="terminology">
130 <h2>Terminology</h2>
131
132 <p>The key words <q><em class="rfc2119">MUST</em></q>,
133 <q><em class="rfc2119">MUST NOT</em></q>,
134 <q><em class="rfc2119">SHOULD</em></q>,
135 <q><em class="rfc2119">SHOULD NOT</em></q>, and
136 <q><em class=rfc2119>MAY</em></q> in this
137 document are to be interpreted as described in
138 <a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr>
139 2119</a>
140 <cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p>
141
142 <!-- Strictly speaking the paragraph below is not part of terminology. -->
143 <p>All examples and notes in this specification are non$B!>(Bnormative,
144 as are all sections explicitly marked non$B!>(Bnormative. Everything
145 else in this specification is normative.</p>
146
147 <p><span class=ed>Algorithm is normative but non-normative</span>.
148 In addition, the order in which <a href="#errors">errors</a> are
149 raised is undefined.</p>
150
151 <p>This document sometimes cites parts of <abbr>XML</abbr> 1.0 specification
152 by hyperlinks. When the document being processed is an <abbr>XML</abbr> 1.1
153 document, however, corresponding parts of the <abbr>XML</abbr> 1.1
154 specification should be consulted instead.</p>
155 </div>
156
157 <div class=section id=processing-model>
158 <h2>Processing Model</h2>
159
160 <p>Conceptually, validation of an XML document is split into two
161 stages for the purpose of this specification: the <dfn
162 id=xml-document-parsing>XML document parsing</dfn> stage and the <dfn
163 id=dom-xml-conformance-checking>DOM XML conformance checking</dfn>
164 stage.
165
166 <p>The input to the XML document parsing stage is a byte sequence
167 representing the parsed XML document (and any additional metadata),
168 and the output are a DOM tree representing the XML document and zero
169 or more <a href="#error">errors</a>. The processor that implements
170 this stage is called <dfn id=parser>parser</dfn>. Requirements for a
171 parser are defined in the section of <a href="#parsing-xml">Parsing an
172 XML Document</a>.
173
174 <p>The input to the DOM XML conformance chcking stage is a DOM tree,
175 and the output are zero or more <a href="#error">errors</a>. The
176 processor that implements this stage is called <dfn
177 id=conformance-checker>conformance checker</dfn>. Requirements for a
178 conformance checker are defined in the section of <a
179 href="#checking-dom">Checking an XML DOM Tree</a>.
180
181
182 <div class=section id=error-categories>
183 <h3>Error Classification</h3>
184
185 <p class=ed>An <dfn id=error>error</dfn> is ...
186
187 <p class=ed>If a <code>Document</code> node has no
188 xml-well-formedness-error, entity-error, and unknown-error,
189 then it is well-formed. If a well-formed <code>Document</code>
190 node has no xml-validity-error, it is valid.</p>
191
192 <div class="note memo">
193 <p>A well$B!>(Bformed <code>Document</code> can be safely serialized
194 into a well$B!>(Bformed XML document. A valid <code>Document</code>
195 can be easily serialized into a valid XML document.</p>
196 </div>
197
198 <p class=ed>To be a conforming <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-validating">validating XML processor</a>,
199 ...</p>
200
201 <p>Errors are classified into these
202 <dfn id=error-category title="error category">error categories</dfn>:</p>
203
204 <dl id=errors>
205 <dt><dfn id=entity-error><code>entity-error</code></dfn></dt>
206 <dd>
207 <p class=ed>@@</p>
208 <div class="note memo">
209 <p>This <span class=ed>algorithm</span> does not support
210 <abbr>DOM</abbr> tree with one or more <code>EntityReference</code>
211 nodes. It is expected that any entity references are expanded
212 at the parse time and any unexpandable entity references
213 make parse time errors raised so that never result in
214 <abbr>DOM</abbr> tree with <code>EntityReference</code> nodes.</p>
215 </div>
216 </dd>
217 <dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt>
218 <dd class=ed>@@</dd>
219 <dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt>
220 <dd>
221 <p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a>
222 will be raised when a construct, which might not be restored to the same
223 construct when it is serialized and then re-parsed by a conforming
224 processor, is encountered.</p>
225 <div class="example memo">
226 <p>For a <code>Comment</code> node a
227 <a href="#round-trip-warning"><code>round-trip-warning</code></a> will
228 be raised, since <abbr>XML</abbr> processors are not required to
229 report texts of comments for applications.</p>
230 </div>
231 </dd>
232 <dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt>
233 <dd class=ed>@@</dd>
234 <dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt>
235 <dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0
236 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
237 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> /
238 <abbr>XML</abbr> 1.1
239 <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
240 <a href="@@/#dt-error">error</a>)
241 that is not classified to any other <a href="#error-category">error
242 category</a>.</dd>
243 <dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt>
244 <dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0
245 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
246 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal
247 error</a> / <abbr>XML</abbr> 1.1
248 <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
249 <a href="@@/#dt-fatal">fatal error</a>)
250 that is not classified to any other <a href="#error-category">error
251 category</a>. <span class=ed>@@ What errors fall into this category?</span></dd>
252 <dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt>
253 <dd>
254 <p>An
255 <a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a>
256 will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement
257 in <abbr>XML</abbr> specification is not met.</p>
258 </dd>
259 <dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt>
260 <dd>A violation of validity constraint in XML document.</dd>
261 <dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt>
262 <dd><p>If an <code>xml-well-formedness-error</code> is raised,
263 it would not be possible to generate an XML serialization that
264 would match to the appropriate production rule and that would not
265 violate to any well$B!>(Bformedness constraint in XML
266 specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>,
267 <a href="#ref-XML11">XML11</a>]</cite>.</p></dd>
268 <dt><dfn id=misc-info><code>misc-info</code></dfn>
269 <dd><p>A <code>misc-info</code> is raised when some status information
270 on parsing or checking process that are considered useful for debugging
271 and so on is available. It by no means implies the non-conformance of
272 the document.
273 </dl>
274
275 <div class=ed><p>@@ TODO: #dt-atuseroption at user option
276 (MAY or MUST), #dt-compat for compatibility,
277 #dt-interop for interoperability</p>
278
279 <p>TODO: XML 1.1, XML Namespace 1.0/1.1, xml:base, xml:id
280
281 <p>TODO: XML "error"/"fatal error" is not always non-conforming (only
282 when MUST or SHOULD).
283 </div>
284
285 </div>
286
287 </div>
288
289 <div class=section id=parsing-xml>
290 <h2>Parsing an <abbr>XML</abbr> Document</h2>
291
292 <p>When a byte stream that represents an XML document is given to a
293 parser, it <em class=rfc2119>MUST</em> create a DOM tree according to
294 relevant specifications <span class=ed>[XML10, XML11, XMLNAMES10,
295 XMLNAMES11, DOM3CORE, WEBDOMCORE, DOMDTDEF, MANAKAIDOMEXT]</span>.
296
297 <p>The parser <em class=rfc2119>MAY</em> continue the parsing of the
298 document even after a fatal error (as defined by the relavant
299 specifications) is encountered. How the parsing ought to be continued
300 is not defined by this specification.
301
302 <!--
303 <div class="note memo informative">
304 <p>It is expected that the XML5 specification <span class=ed>@@ ref</span>
305 will define how the parser has to convert any string into DOM tree
306 completely.
307 </div>
308 -->
309
310 <p class=ed>A future version of this specification might define the
311 entire parser in terms of input stream preprocessor, tokenizer, and
312 tree constructor.
313
314 <p>In addition, the following requirements are applied to the parser:
315
316 <dl class=switch>
317 <dt>For each external entity (including the document entity and the external
318 subset entity, if any)
319 <dd>If there is a byte sequence that are not legal in the encoding in use,
320 then the parser <em class=rfc2119>MUST</em> raise an
321 <a href="#xml-misc-error" id=xme-illegal-bytes><code>xml-misc-error</code></a>.
322 <!--
323 <q>It is a fatal error when an XML processor encounters an entity with an
324 encoding that it is unable to process. It is a fatal error if an XML
325 entity is determined (via default, encoding declaration, or higher-level
326 protocol) to be in a certain encoding but contains byte sequences that are
327 not legal in that encoding.</q>
328 -->
329
330 <dd>If it is the document entity or a general entity, then:
331 <ul>
332 <li>If the input byte sequence for the entity begins with the
333 <abbr title="BYTE ORDER MARK" class=charname>BOM</abbr>, then the parser
334 <em class=rfc2119>MUST</em> set the <span class=ed>BOM flag</span> of
335 the node corresponding to the entity (the <code>Document</code> node
336 for the document entity or an <code>Entity</code> node for a general
337 entity) to <code>true</code>.
338 <!--
339 <q>Entities encoded in UTF-16 MUST and entities encoded in UTF-8 MAY
340 begin with the Byte Order Mark</q>
341 -->
342 <span class=ed>@@ flag must be checked later</span>
343 <!-- <?xml encoding=""?> must be reflected to xmlEncoding; this should be
344 enforced by DOM Core spec. -->
345 </ul>
346 <dd>If it is a parameter entity or the external subset entity, then:
347 <ul>
348 <li>If the character encoding of the entity is <code>UTF-16</code> but
349 the input byte stream for the entity does not begin with the
350 <abbr title="BYTE ORDER MARK" class=charname>BOM</abbr>, then the parser
351 <em class=rfc2119>MUST</em> raise an
352 <a href="#xml-misc-error" id=xme-pe-bom><code>xml-misc-error</code></a>.
353 <li class=ed>@@ encoding="" preferred name?
354 <!--
355 "In an encoding declaration, the values "UTF-8", "UTF-16", "ISO-10646-UCS-2", and "ISO-10646-UCS-4" SHOULD be used for the various encodings and transformations of Unicode / ISO/IEC 10646, the values "ISO-8859-1", "ISO-8859-2", ... "ISO-8859-n" (where n is the part number) SHOULD be used for the parts of ISO 8859, and the values "ISO-2022-JP", "Shift_JIS", and "EUC-JP" SHOULD be used for the various encoded forms of JIS X-0208-1997. It is RECOMMENDED that character encodings registered (as charsets) with the Internet Assigned Numbers Authority [IANA-CHARSETS], other than those just listed, be referred to using their registered names; other encodings SHOULD use names starting with an "x-" prefix."
356
357 In addition, this should be checked later for Document and Entity nodes.
358 -->
359 </ul>
360
361 <dt>For the document
362 <dd>If the <abbr>XML</abbr> document does not begin with an
363 <abbr>XML</abbr> declaration, then the parser <em class=rfc2119>MUST</em>
364 raise an
365 <a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.
366 <dd>If the document does not contain the document type declaration, or
367 if it does but the document type definition does not contain entity
368 declaration for any of <code>amp</code>, <code>lt</code>, <code>gt</code>,
369 <code>apos</code>, or <code>quot</code>, then the parser
370 <em class=rfc2119>MUST</em> raise
371 <a href="#xml-misc-recommentation" id=xmr-predefined-decl><code>xml-misc-recommendation</code></a>(s).
372 <!--
373 <q>For interoperability, valid documents SHOULD declare the entities
374 amp, lt, gt, apos, quot, in the form specified in 4.6 Predefined
375 Entities.</q>
376 -->
377 <dt>For the document type declaration
378 <dd class=ed>@@ read external entity
379 <dd>The <code>entities</code> attribute of the <code>DocumentType</code>
380 node <em class=rfc2119>MUST</em> contain a <code>NamedNodeMap</code> object
381 whose first five items are as follows:
382 <ol start=0>
383 <li>An <code>Entity</code> node whose <code>nodeName</code> attribute
384 is <code>amp</code>. It contains a <code>Text</code> node whose
385 <code>data</code> attribute is set to <code>&amp;</code>.
386 <li>An <code>Entity</code> node whose <code>nodeName</code> attribute
387 is <code>lt</code>. It contains a <code>Text</code> node whose
388 <code>data</code> attribute is set to <code>&lt;</code>.
389 <li>An <code>Entity</code> node whose <code>nodeName</code> attribute
390 is <code>gt</code>. It contains a <code>Text</code> node whose
391 <code>data</code> attribute is set to <code>></code>.
392 <li>An <code>Entity</code> node whose <code>nodeName</code> attribute
393 is <code>quot</code>. It contains a <code>Text</code> node whose
394 <code>data</code> attribute is set to <code>"</code>.
395 <li>An <code>Entity</code> node whose <code>nodeName</code> attribute
396 is <code>apos</code>. It contains a <code>Text</code> node whose
397 <code>data</code> attribute is set to <code>'</code>.
398 </ol>
399 <dt>For each internal general entity declaration being processed by the parser
400 <dd>If the
401 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-EntityValue"><code>EntityValue</code></a>
402 part of the general entity declaration contains a bare <code>U+003C</code>
403 <code>LESS-THAN SIGN</code> (<code>&lt;</code>) character, then the parser
404 <em class=rfc2119>MUST</em> raise an
405 <a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!--
406 "strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11].
407 -->
408 <dt>For each element type declaration being processed by the parser
409 <dd>If there is another processed element type declaration whose
410 <code>Name</code> is equal to the <code>Name</code> of the element type
411 declaration, then the parser <em class=rfc2119>MUST</em> raise an
412 <a href="#xml-validity-error" id=vc-edunique><code>xml-validity-error</code></a>.
413 <dt>For each attribute definition list declaration being processed by the
414 parser
415 <dd>If there is another processed attribute defintion list declaration whose
416 <code>Name</code> is equal to the <code>Name</code> of the attribute
417 definition list declaration, then the parser <em class=rfc2119>MUST</em>
418 raise an
419 <a href="#xml-misc-warning" id=xme-attlist-unique><code>xml-misc-warning</code></a>.
420 <dd>For each attribute definition in the attribute definition list
421 declaration, if there is another processed attribute definition whose
422 <code>Name</code> is equal to the <code>Name</code> of the attribute
423 definition (whether or not in the same attribute definition list
424 declaration), then the parser <em class=rfc2119>MUST</em> raise an
425 <a href="#xml-misc-warning" id=xme-attrdef-unique><code>xml-misc-warning</code></a>.
426 <!--
427 <q>For interoperability, an XML processor <em class=rfc2119>MAY</em> at
428 user option issue a warning when more than one attribute-list declaration
429 is provided for a given element type, or more than one attribute definition
430 is provided for a given attribute, but this is not an error.</q>
431 -->
432 <!--
433 NOTE: <!ATTLIST a xml:space (default) #IMPLIED xml:space CDATA #IMPLIED>
434 will not be warned.
435 -->
436
437 <dt>For each entity declaration being processed by the parser
438 <dd>Handle as follows:
439 <ol>
440 <li><p>If the entity declaration declares a general entity, the following
441 is applied:
442 <dl>
443 <dt>If the <code>Name</code> is <code>lt</code> or <code>amp</code>
444 <dd><p>If the entity declaration does not declare an internal entity,
445 or if the replacement text of the entity is not the escaped form of
446 <code>&lt;</code> (if <code>lt</code>) or <code>&amp;</code> (if
447 <code>amp</code>), then the parser <em class=rfc2119>MUST</em> raise an
448 <a href="#xml-misc-error" id=xme-double-escape><code>xml-misc-error</code></a>.
449
450 <div class="note memo informative">
451 <p>In other word, the character in the <code>EntityValue</code>
452 has to be double-escaped.
453 </div>
454 <dt>If the <code>Name</code> is <code>gt</code>, <code>quot</code>, or
455 <code>apos</code>
456 <dd><p>If the entity declaration does not declare an internal entity,
457 or if the replacement text of the entity is not equal to or not the
458 escaped form of <code>></code> (if <code>gt</code>), <code>"</code> (if
459 <code>quot</code>), or <code>'</code> (if <code>apos</code>), then the
460 parser <em class=rfc2119>MUST</em> raise an
461 <a href="#xml-misc-error" id=xme-single-escape><code>xml-misc-error</code></a>.
462
463 <div class="note memo informative">
464 <p>In other word, the character in the <code>EntityValue</code>
465 has to be single- or double-escaped.
466 </div>
467 </dl>
468 <!--
469 <q>If the entities lt or amp are declared, they MUST be declared as internal entities whose replacement text is a character reference to the respective character (less-than sign or ampersand) being escaped; the double escaping is REQUIRED for these entities so that references to them produce a well-formed result. If the entities gt, apos, or quot are declared, they MUST be declared as internal entities whose replacement text is the single character being escaped (or a character reference to that character; the double escaping here is OPTIONAL but harmless).</q>
470 -->
471
472 <li><p>If the entity declaration has to be ignored since there has already
473 been declared an entity with the same <code>Name</code> as the declaration,
474 then the parser <em class=rfc2119>MUST</em> raise a
475 <a href="#misc-info" id=mi-ent-unique><code>misc-info</code></a>
476 and abort these steps.
477
478 <div class="informative note memo">
479 <p>Five predefined entities, i.e. <code>amp</code>, <code>lt</code>,
480 <code>gt</code>, <code>quot</code>, and <code>apos</code>, are always
481 declared implicitly and therefore any declaration for such an entity
482 always raises an
483 <a href="#misc-info" id=mi-ent-unique><code>misc-info</code></a>.
484 </div>
485
486 <li><p>If the entity declaration declares a parameter entity and the
487 <code>Name</code> of the entity begins with the string <code>xml</code>
488 (in any combination of upper- and lowercase letters), then the parser
489 <em class=rfc2119>MUST</em> raise an
490 <a href="#xml-misc-warning" id=xmw-reserved-pe-name><code>xml-misc-warning</code></a>.
491
492 <li><p>If the entity declaration contains the <code>EntityValue</code>,
493 then for each occurence of any references to unparsed entities in the
494 <code>EntityValue</code>, the parser <em class=rfc2119>MUST</em> raise an
495 <a href="#xml-misc-error" id=xme-unparsed-in-ev><code>xml-misc-error</code></a>.
496 <!--
497 <q>It is an error for a reference to an unparsed entity to appear in the
498 EntityValue in an entity declaration.</q>
499 -->
500 <li><p>If the entity declaration declares a general entity, then an
501 <code>Entity</code> node <em class=rfc2119>MUST</em> be created and
502 appended to the <code>NamedNodeMap</code> object in the
503 <code>entities</code> attribute of the <code>DocumentType</code> node.
504
505 <p class=ed>Read the external entity
506
507 <p>If the replacement text of the entity is read, then parse the
508 replacement text as if it were referenced from the content of an
509 element (with no namespace bindings). If no <span class=ed>@@ parse error</span>
510 is raised by the parsing process, then the nodes generated by the
511 parsing <em class=rfc2119>MUST</em> be appended to the <code>Entity</code>
512 node. The parse error <em class=rfc2119>MUST NOT</em> be propagated to
513 the entire parsing process. Other kinds of errors
514 <em class=rfc2119>MUST</em> be propagated. The first parse error
515 <em class=rfc2119>MUST</em> abort the internal parsing process.
516 <span class=ed>@@ better wording</span>
517
518 <p class=ed>@@ prop
519
520 <p>Then, the <code>Entity</code> node and its descendant
521 <em class=rfc2119>MUST</em> be marked as read-only.
522 </ol>
523
524 <dt>For each notation declaration being processed by the parser
525 <dd>If there is another processed notation declaration whose
526 <code>Name</code> is equal to the <code>Name</code> of the notation
527 declaration, then the parser <em class=rfc2119>MUST</em> raise an
528 <a href="#xml-validity-error" id=vc-uniquenotationname><code>xml-validity-error</code></a>.
529 <!-- <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#UniqueNotationName">Validity constraint: Unique Notation Name</a> -->
530
531 <dt>For each empty-element tag
532 <dd>If the <code>Name</code> of the tag is not declared by a processed
533 element type declaration as <code>EMPTY</code> content, then the parser
534 <em class=rfc2119>MUST</em> raise an
535 <a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>.
536 <dt>For each start-tag
537 <dd>If the <code>Name</code> of the tag is declared by a processed element
538 type declaration as <code>EMPTY</code> content, then the parser
539 <em class=rfc2119>MUST</em> raise an
540 <a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>.
541 <dt>For each attribute
542 <dd><p>The parser <em class=rfc2119>MUST</em> set the normalized value of
543 the attribute to the <code>value</code> attribute of the <code>Attr</code>
544 node created for the attribute.
545
546 <div class="note memo informative">
547 <p>That is, any entity reference has to be expanded. Unexpanded entity
548 references in attribute values are discarded.
549 </div>
550 <dt>For each <code>xml:space</code> attribute
551 <dd>The parser <em class=rfc2119>MUST</em> set the normalized value of
552 the <code>xml:space</code> attribute to the <code>value</code> attribute
553 of the <code>Attr</code> node created for the attribute even if the
554 normalized value is different from <code>default</code> or
555 <code>preserve</code>.
556 <!-- In XML 1.0/1.1 specification, the attribute specification MAY be
557 ignored. -->
558
559 <dt>For each parameter entity reference
560 <dd><p>Process as follows:
561 <ol>
562 <li>If the declaration for the entity is <em>not</em> processed,
563 then:
564 <dl class=switch>
565 <dt>If the document contains no external entity or if the document
566 contains the <code>standalone</code> pseudo-attribute set to
567 <code>yes</code><!-- or the document contains no DTD -->
568 <dd>The parser <em class=rfc2119>MUST</em> raise an
569 <a href="#xml-well-formedness-error" id=wf-entdeclared-pe><code>xml-well-formedness-error</code></a>.
570 <dt>Otherwise
571 <dd>The parser <em class=rfc2119>MUST</em> raise an
572 <a href="#xml-validity-error" id=vc-entdeclared-pe><code>xml-validity-error</code></a>.
573 </dl>
574 <li>If the declaration for the entity <em>is</em> processed but the
575 referenced entity cannot be retrieved, then the parser
576 <em class=rfc2119>MUST</em> raise an
577 <span class=ed>@@ ??-error</span>.
578 </ol>
579
580 <p>In any of two cases above, process as follows:
581 <ul>
582 <li>If the parameter entity reference is contained in a declaration, then
583 the declaration <em class=rfc2119>MUST</em> be ignored <em>except</em> that
584 any error before the parameter entity <em class=rfc2119>MUST</em> be
585 raised as usual.
586 <li>If the parameter entity reference is contained in the status portion of
587 a conditional section, then the conditional section
588 <em class=rfc2119>MUST</em> be processed as if it were an
589 <code>IGNORE</code>d section.
590 <li>The parser <em class=rfc2119>MUST NOT</em> process any entity or
591 attribute-list declaration after the parameter entity reference in the DTD
592 <em>except</em> when the <code>standalone</code> pseudo-attribute of the
593 XML declaration (if any) is set to <code>yes</code>.
594 <!-- This requirement is enforced for internal DTD subset case in
595 XML 1.0/1.1 specification (section 5.1) but not for any other cases. -->
596 <!-- According to this definition, element type declarations, notation
597 declarations, and PIs ARE processed. -->
598 <li>If the parameter entity reference is the first reference to an entity
599 that is not read, then the parser <em class=rfc2119>MUST</em> raise an
600 <a href="#entity-error" id=ee-unread-pe><code>entity-error</code></a>.
601 <li>The <code>allDeclarationsProcessed</code> <span class=ed>@@ ref</span>
602 attribute of the <code>Document</code> node <em class=rfc2119>MUST</em> be
603 set to <code>false</code>.
604 </ul>
605 <dt>For each general entity reference in an attribute value or in the content
606 of an element
607 <dd><p>Process as follows:
608 <ol>
609 <li>If the <code>Name</code> of the entity reference is either
610 <code>amp</code>, <code>lt</code>, <code>gt</code>, <code>quot</code>,
611 or <code>apos</code>, then abort these steps.
612 <li>If the declaration for the entity is <em>not</em> processed,
613 then:
614 <dl class=switch>
615 <dt>If the document contains no external entity or if the document
616 contains the <code>standalone</code> pseudo-attribute set to
617 <code>yes</code><!-- or the document contains no DTD -->
618 <dd>The parser <em class=rfc2119>MUST</em> raise an
619 <a href="#xml-well-formedness-error" id=wf-entdeclared-ge><code>xml-well-formedness-error</code></a>.
620 <dt>Otherwise
621 <dd>The parser <em class=rfc2119>MUST</em> raise an
622 <a href="#xml-validity-error" id=vc-entdeclared-ge><code>xml-validity-error</code></a>.
623 </dl>
624 <li>If the declaration for the entity <em>is</em> processed but the
625 referenced entity cannot be retrieved, then the parser
626 <em class=rfc2119>MUST</em> raise an
627 <span class=ed>@@ ??-error</span>.
628 </ol>
629
630 <p>In any of two cases above, process as follows:
631 <ul>
632 <li>If the general entity reference is the first reference to an entity
633 that is not read, then the parser <em class=rfc2119>MUST</em> raise an
634 <a href="#entity-error" id=ee-unread-ge><code>entity-error</code></a>.
635 <span class=ed>@@ entity declared WFC?</span>
636 <li class=ed>An unexpended entity reference node <em class=rfc2119>MUST</em> be inserted to the current node.
637 </ul>
638
639 <dt>For each comment <em>outside</em> of document type declaration
640 <dd>A <code>Comment</code> node <em class=rfc2119>MUST</em> be created
641 and inserted appropriately.
642 <!-- In XML 1.0/1.1 spec, this is optional. -->
643 </dl>
644
645 <p>The parser <em class=rfc2119>MUST</em> try to read any entity
646 referenced by general or parameter entity references<!--,--> and the
647 external subset entity, if any<!--, and any general entity declared-->
648 in the document type definition.
649
650 <p><strong>Well-formedness constraints</strong>. When the parser
651 detects a voilation to one of certain well-formedness constraints, it
652 <em class=rfc2119>MUST</em> raise an <a
653 href="#xml-well-formedness-error"><code>xml-well-formedness-error</code></a>.
654 The list of such well-formed constraints is as follows:
655
656 <ul>
657 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#wfc-PEinInternalSubset">Well-formedness constraint: PEs in Internal Subset</a>
658 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#GIMatch">Well-formedness constraint: Element Type Match</a>
659 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#uniqattspec">Well-formedness constraint: Unique Att Spec</a>
660 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NoExternalRefs">Well-formedness constraint: No External Entity References</a>
661 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#CleanAttrVals">Well-formedness constraint: No &lt; in Attribute Values</a>
662 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#wf-Legalchar">Well-formedness constraint: Legal Character</a>
663 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#textent">Well-formedness constraint: Parsed Entity</a>
664 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#norecursion">Well-formedness constraint: No Recursion</a>
665 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#indtd">Well-formedness constraint: In DTD</a>
666 </ul>
667
668 <p><strong>Validity constraints</strong>. When the parser detects a
669 violation to one of certain validity contraints, it <em
670 class=rfc2119>MUST</em> raise an <a
671 href="#xml-validity-error"><code>xml-validity-error</code></a>. The
672 list of such validity constraints is as follows:
673
674 <ul>
675 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#vc-PEinMarkupDecl">Validity constraint: Proper Declaration/PE Nesting</a>
676 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#vc-PEinGroup">Validity constraint: Proper Group/PE Nesting</a>
677 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#condsec-nesting">Validity constraint: Proper Conditional Section/PE Nesting</a>
678 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#vc-check-rmd">Validity constraint: Standalone Document Declaration</a>
679 </ul>
680
681 <p><strong>Other creteria</strong>. If the parser detects a violation
682 to one of certain additional constraints, it <em
683 class=rfc2119>MUST</em> raise an <a
684 href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a>.
685 The list of such constraints is as follows:
686
687 <ul>
688 <li><q>For interoperability, if a parameter-entity reference appears in a
689 <code>choice</code>, <code>seq</code>, or <code>Mixed</code> construct, its
690 replacement text <em class=rfc2119>SHOULD</em> contain at least one non-blank
691 character, and neither the first nor last non-blank character of the
692 replacement text <em class=rfc2119>SHOULD</em> be a connector (<code>|</code>
693 or <code>,</code>).</q>
694 <li><q>External parsed entities <em class=rfc2119>SHOULD</em> each begin with a
695 text declaration.</q>
696 </ul>
697
698 <p>The parser <em class=rfc2119>MUST</em> act as if it is a <a
699 href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-validating">validating
700 XML processor</a> for the purpose of informing of white space
701 characters appearing in <a
702 href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-elemcontent">element
703 content</a> (See <a
704 href="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-white-space">Section
705 2.10</a> of the XML specification).
706
707 <div class="note memo informative">
708 <p>In other word, the <code>isElementContentWhitespace</code> attribute
709 of <code>Text</code> nodes has to be set appropriately. Note that the
710 value of the attribute will be set to <code>false</code> for any
711 <code>Text</code> node in the content of an element whose declaration
712 is not processed.
713 </div>
714
715 <p>The parser <em class=rfc2119>MUST</em> raise at least one <a
716 href="#xml-well-formedness-error"
717 id=wfe-syntax><code>xml-well-formedness-error</code></a> if the entity
718 it parses does not match to the appropriate production rule in the XML
719 specification. As an exception to this requirement, it <em
720 class=rfc2119>MAY</em> choose not to raise such an error if the error
721 will be raised by the conformance checker when the conformance checker
722 <a href="#algorithm-to-check-a-node" title="check a node">checks</a>
723 the <code>Document</code> object produced by the parser.
724
725 <!--
726 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#ExtSubset">Well-formedness constraint: External Subset</a>
727 <li><a href="http://www.w3.org/TR/2006/REC-xml-20060816/#PE-between-Decls">Well-formedness constraint: PE Between Declarations</a>
728 -->
729
730 <!--
731 Inpossible to test:
732 "In the absence of external character encoding information (such as MIME
733 headers), parsed entities which are stored in an encoding other than UTF-8
734 or UTF-16 MUST begin with a text declaration"
735 -->
736 </div>
737
738 <div class="section" id=checking-dom>
739 <h2>Checking an <abbr>XML</abbr> <abbr>DOM</abbr> Tree</h2>
740
741 <p>The following algorithms and definitions are applied to
742 <abbr>XML</abbr> documents; especially, they are not applied
743 to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p>
744
745 <div class=section id=definitions>
746 <h3>Definitions</h3>
747
748 <p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is
749 the <abbr>XML</abbr> version of the document to which the node belongs.
750 For a <code>Documemt</code> node, the <abbr>XML</abbr> version
751 of the document is the value of the <code>xmlVersion</code>
752 attribute of the node. For a <code>DocumentType</code> node whose
753 <code>ownerDocument</code> attribute is set to <code>null</code>,
754 the <abbr>XML</abbr> version of the document is <code>1.0</code><!--
755 since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->.
756 For any other node, the <abbr>XML</abbr> version of the document
757 is that of the <code>Document</code> node contained in the
758 <code>ownerDocument</code> attribute of the node.</p>
759
760 </div>
761
762
763 <div class=section id=checking-components>
764 <h3>Conformance Checking Algorithms for Components</h3>
765
766 <p>To
767 <dfn id=algorithm-to-validate-an-xml-character-data title="validate an XML string">to
768 validate an <abbr>XML</abbr> string (<dfn id=var-s><var>s</var></dfn>)</dfn>,
769 the following algorithm <em class=rfc2119>MUST</em> be used:</p>
770 <ol>
771 <li>If <var>s</var> contains a character that is <em>not</em> in
772 the character class <a href="#class-Char10"><code>Char10</code></a>,
773 then raise an
774 <a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li>
775 <li>If <var>s</var> contains a character that is in the character
776 class <a href="#class-CompatChar10"><code>CompatChar10</code></a>,
777 then raise an
778 <a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li>
779 <li>If <var>s</var> contains a character that is in the character
780 class <a href="#class-ControlChar10"><code>ControlChar10</code></a>,
781 then raise an
782 <a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li>
783 <li class=ed>@@ XML 1.1 support</li>
784 <li>If <var>s</var> contains a <code class=char>U+000D</code>
785 <code class=charname>CARRIAGE RETURN</code> character, then
786 raise a
787 <a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>.
788 <span class=ed>@@ We should not raise duplicate errors for U+000D
789 in attribute values. In addition, we should support a mode where
790 U+000D will be serialized as &#x000D; (so that no round-trip-error
791 will be raised).</span></li>
792 </ol>
793
794 <p>To
795 <dfn id=algorithm-to-validate-a-name title="validate a Name">validate a
796 <code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn>, the following
797 algorithm <em class=rfc2119>MUST</em> be used:</p>
798 <ol>
799 <li>If <var>s</var> is an empty string, then raise an
800 <a href="#xml-well-formedness-error" id=wfe-name-empty><code>xml-well-formedness-error</code></a>.
801 Abort these steps.</li>
802 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate
803 <var>s</var> as an <abbr>XML</abbr> string</a>.</li>
804 <li>If the first character in <var>s</var> is a character that is
805 <em>not</em> in the character class
806 <a href="#class-NameStartChar10"><code>NameStartChar10</code></a>, then raise
807 an
808 <a href="#xml-well-formedness-error" id=wfe-name-startchar><code>xml-well-formedness-error</code></a>.</li>
809 <li>If a character other than the first character in <var>s</var> is a
810 character that is <em>not</em> in the character class
811 <a href="#class-NameChar10"><code>NameChar10</code></a>, then raise an
812 <a href="#xml-well-formedness-error" id=wfe-name-char><code>xml-well-formedness-error</code></a>.</li>
813 <li>If <var>s</var> begins with the string <code>xml</code> (in any
814 case combination), then raise an
815 <a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>.
816 <span class=ed>@@ except for attribute names <code>xml:lang</code>,
817 <code>xml:space</code><!--, <code>xml:base</code>, <code>xml:id</code>,
818 <code>xmlns</code>, <code>xmlns:<var>*</var></code>,
819 pi name <code>xml-stylesheet</code>-->.</span><!--
820 "names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification.":
821 xmlns, xml-stylesheet, xml:base and xml:id specifications violate to this sentense!
822 --></li>
823 <!-- COLON in Name is a lowercase "should not" in a Note of [XML10],
824 [XML11]. -->
825 <li class=ed>@@ XML 1.1 support</li>
826 </ol>
827
828 <p>To
829 <dfn id=algorithm-to-validate-an-ncname title="validate an NCName">validate
830 an <code>NCName</code> (<dfn id=var-ncname-s><var>s</var></dfn>)</dfn>, the
831 following algorithm <em class=rfc2119>MUST</em> be used:</p>
832 <ol>
833 <li><a href="#algorithm-to-validate-a-name" title="validate a Name">Validate
834 <var>s</var> as a <code>Name</code></a>.</li>
835 <li class=ed>@@</li>
836 </ol>
837
838 <p>To
839 <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate
840 a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the
841 following algorithm <em class=rfc2119>MUST</em> be used:</p>
842 <ol>
843 <li>If <var>pid</var> is <code>null</code>, abort these steps.</li>
844 <li>If <var>pid</var> contains a character that is <em>not</em> in the
845 character class <a href="#class-PubidChar"><code>PubidChar</code></a>, then
846 raise an
847 <a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li>
848 <li>If <var>pid</var> contains one of <code class=char>U+0009</code>
849 <code class=charname>CHARACTER TABULATION</code>,
850 <code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>,
851 and <code class=char>U+000D</code> <code class=charname>LINE FEED</code>
852 characters, if the first character of <var>pid</var> is
853 <code class=char>U+0020</code> <code class=charname>SPACE</code> character,
854 if the last character of <var>pid</var> is <code class=char>U+0020</code>
855 <code class=charname>SPACE</code> character, or if there is a
856 <code class=char>U+0020</code> <code class=charname>SPACE</code> character
857 immediately followed by another <code class=char>U+0020</code>
858 <code class=charname>SPACE</code> character in <var>pid</var>, then it is a
859 <a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.
860 <span class=ed>Is this really a roundtripness problem? XML spec
861 does only define the way to match public identifiers in fact, no
862 canonical form.</span></li>
863 </ol>
864
865 <p>To
866 <dfn id=algorithm-to-validate-a-system-identifier title="validate a system identifier">validate
867 a system identifier (<dfn id=var-sid><var>sid</var></dfn>)</dfn>, the
868 following algorithm <em class=rfc2119>MUST</em> be used:</p>
869 <ol>
870 <li>If <var>sid</var> is <code>null</code>, abort these steps.</li>
871 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate
872 <var>sid</var> as an <abbr>XML</abbr> string</a>.</li>
873 <li>If <var>sid</var> contains both <code class=char>U+0022</code>
874 <code class=charname>QUOTATION MARK</code> (<code class=char>"</code>) and
875 <code class=char>U+0027</code> <code class=charname>APOSTROPHE</code>
876 (<code class=char>'</code>) characters, raise an
877 <a href="#xml-well-formedness-error" id=wfe-sid-lit><code>xml-well-formedness-error</code></a>.</li>
878 <li>If <var>sid</var> contains at least one <code class=char>U+0023</code>
879 <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>)
880 character, then raise an
881 <a href="#xml-misc-error" id=xme-sid-fragment><code>xml-misc-error</code></a>.</li>
882 <li class=ed>@@ If <var>sid</var> cannot be converted to a URI
883 reference, then raise a fact-level error (xml-misc-warning?).<!--
884 XML 1.0 has no conformance language for system identifier being
885 a URI reference. --></li>
886 </ol>
887
888 </div>
889
890 <div class=section id=checking-node>
891 <h3>Checking <code>Node</code></h3>
892
893 <p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to
894 check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as
895 following:</p>
896 <dl class=switch>
897 <dt>If <var>n</var> is an <code>Attr</code> node</dt>
898 <dd>
899 <ol>
900 <li><a href="#algorithm-to-validate-an-ncname">Validate the
901 <code>localName</code> attribute value as an <code>NCName</code></a>.</li>
902 <li>If the <code>prefix</code> attribute value is different from
903 <code>null</code>, then <a href="#algorithm-to-validate-an-ncname">validate
904 the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li>
905 <li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the
906 <code>childNodes</code> list of <var>n</var>,
907 <ol>
908 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
909 <code>Text</code> or <code>EntityReference</code> node, then it is an
910 <a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li>
911 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
912 <code>EntityReference</code> node, then it is an
913 <a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li>
914 <li>Otherwise,
915 <a href="#algorithm-to-check-a-node" title="check a node">check
916 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
917 </ol></li>
918 <li>If <code>nodeName</code> attribute of <var>n</var> is
919 <code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span>
920 and <code>value</code> attribute of <var>n</var> is neither
921 <code>default</code> nor <code>preserve</code>, then it is an
922 <a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!--
923 Note that <!ATTLIST e xml:space (default|preserve) "a">...
924 <e xml:space="default"/> is conforming and valid. --></li>
925 <li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its
926 successor] or an empty string, then xml-misc-warning
927 (a "fact"-level error; not an XML error).</li>
928 <li class=ed>@@ <code>specified</code>,
929 <code>manakaiAttributeType</code> (#ValueType Validity constraint: Attribute Value Type)</li>
930 <!-- xml:space MUST be declared to be valid. -->
931 <li>Let <dfn id=var-v><var>v</var></dfn> be the value of the
932 attribute <code>value</code> of <var>n</var>.</li>
933 <li>Validate the <var>n</var> against the <span class=ed>declared
934 type</span> as following:
935 <dl class=switch>
936 <dt class=ed><code>ID_ATTR</code></dt>
937 <dd>
938 <ol>
939 <li><span class=ed>Validate <var>v</var> as an
940 <code>Name</code>.</span> If it fails, then raise an
941 <a href="#xml-validity-error" id=vc-id-name><code>xml-validity-error</code></a>.</li>
942 <li><span class=ed>If <code>ID</code> <var>v</var> is defined,</span>
943 then raise an
944 <a href="#xml-validity-error" id=vc-id-duplication><code>xml-validity-error</code></a>.</li>
945 </ol>
946 </dd>
947 <dt class=ed>IDREF_ATTR</dt>
948 <dd>
949 <ol>
950 <li><span class=ed>Validate <var>v</var> as an
951 <code>Name</code>.</span> If it fails, then raise an
952 <a href="#xml-validity-error" id=vc-idref-name><code>xml-validity-error</code></a>.</li>
953 <li><span class=ed>If <code>ID</code> <var>v</var> is NOT
954 defined,</span> then raise an
955 <a href="#xml-validity-error" id=vc-idref-match><code>xml-validity-error</code></a>.</li>
956 </ol>
957 </dd>
958 <dt class=ed>IDREFS_ATTR</dt>
959 <dd class=ed>@@</dd>
960 <dt class=ed>ENTITY_ATTR</dt>
961 <dd>
962 <ol>
963 <li><span class=ed>Validate <var>v</var> as an
964 <code>Name</code>.</span> If it fails, then raise an
965 <a href="#xml-validity-error" id=vc-entname-name><code>xml-validity-error</code></a>.</li>
966 <li><span class=ed>If <code>Entity</code> <var>v</var> is NOT
967 defined,</span> then raise an
968 <a href="#xml-validity-error" id=vc-entname-match><code>xml-validity-error</code></a>.</li>
969 </ol>
970 </dd>
971 <dt class=ed>ENTITIES_ATTR</dt>
972 <dd class=ed>@@</dd>
973 <dt class=ed>NMTOKEN_ATTR</dt>
974 <dd>
975 <ol>
976 <li><span class=ed>Validate <var>v</var> as an
977 <code>Nmtoken</code>.</span> If it fails, then raise an
978 <a href="#xml-validity-error" id=vc-nmtok-name><code>xml-validity-error</code></a>.</li>
979 </ol>
980 </dd>
981 <dt class=ed>NMTOKENS_ATTR</dt>
982 <dd class=ed>@@</dd>
983 <dt class=ed>NOTATION_ATTR</dt>
984 <dd class=ed><var>v</var> must be one of enumerated values.
985 If not, then raise an
986 <a href="#xml-validity-error" id=vc-notatn-match><code>xml-validity-error</code></a>.</dd>
987 <dt class=ed>ENUMERATED_ATTR</dt>
988 <dd class=ed><var>v</var> must be one of enumerated values.
989 If not, then raise an
990 <a href="#xml-validity-error" id=vc-enum><code>xml-validity-error</code></a>.</dd>
991 <dt class=ed>@@</dt>
992 </dl>
993 </li>
994 <li>If <span class=ed>type ID and default is NOT #IMPLIED or #REQUIRED</span>, then
995 raise an
996 <a href="#xml-validity-error" id=vc-id-default><code>xml-validity-error</code></a>.</li>
997 <li class=ed>@@ #FixedAttr Validity constraint: Fixed Attribute Default</li>
998 <li class=ed>@@ strict serialization error for U+000D, U+000A, and
999 U+0009 characters, leading/trailing U+0020, and U+0020{2,} string?</li>
1000 </ol>
1001 </dd>
1002 <dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt>
1003 <dd>
1004 <ol>
1005 <li class=ed></li>
1006 <li>If <code>nodeName</code> attribute of <var>n</var> is
1007 <code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span>
1008 and <span class=ed>its declared type is different from (default|preserve),
1009 (preserve|default), (default), or (preserve)</span>, then raise an
1010 <a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li>
1011 <li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the
1012 <code>childNodes</code> list of <var>n</var>,
1013 <ol>
1014 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
1015 <code>Text</code> or <code>EntityReference</code> node, then it is an
1016 <a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li>
1017 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
1018 <code>EntityReference</code> node, then it is an
1019 <a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li>
1020 <li>Otherwise,
1021 <a href="#algorithm-to-check-a-node" title="check a node">check
1022 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
1023 </ol></li>
1024 <li class=ed>If <code>NOTATION_ATTR</code>, enumerated values MUST
1025 be declared. If not, then raise an
1026 <a href="#xml-validity-error" id=vc-notatn-declared><code>xml-validity-error</code></a>.</li>
1027 <li class=ed>If <code>NOTATION_ATTR</code> or <code>ENUMERATED_ATTR</code>,
1028 values MUST all be distinct. If not, then raise an
1029 <a href="#xml-validity-error" id=vc-no-duplicate-tokens><code>xml-validity-error</code></a>.</li>
1030 <li class=ed>If <code>NOTATION_ATTR</code> on an <code>EMPTY</code>
1031 element, then raise an
1032 <a href="#xml-validity-error" id=vc-no-notation-empty><code>xml-validity-error</code></a>.</li>
1033 <li class=ed>@@ #defattrvalid Validity constraint: Attribute Default Value Syntactically Correct</li>
1034 </ol>
1035 </dd>
1036 <dt>If <var>n</var> is a <code>CDATASection</code> node</dt>
1037 <dd>
1038 <ol>
1039 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the
1040 <code>data</code> attribute value as an <abbr>XML</abbr> character
1041 data</a>.</li>
1042 <li>If the <code>data</code> attribute value contains
1043 a string <code>]]></code>, then raise an
1044 <a href="#xml-well-formedness-error" id=wfe-cs-mse><code>xml-well-formedness-error</code></a>.<!-- "for compatibility" --></li>
1045 <li>If the <code>childNodes</code> list of <var>n</var> contains
1046 any nodes, they are in
1047 <a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li>
1048 </ol>
1049 </dd>
1050 <dt>If <var>n</var> is a <code>Comment</code> node</dt>
1051 <dd>
1052 <ol>
1053 <li>Raise an
1054 <a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li>
1055 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the
1056 <code>data</code> attribute value as an <abbr>XML</abbr> character
1057 data</a>.</li>
1058 <li>If the <code>data</code> attribute value contains
1059 a string <code>--</code>, or if it ends with a character
1060 <code>-</code>, then raise an
1061 <a href="#xml-well-formedness-error" id=wfe-comment-com><code>xml-well-formedness-error</code></a>.<!--
1062 "for compatibility" --></li>
1063 <li>If the <code>childNodes</code> list of <var>n</var> contains
1064 any nodes, they are in
1065 <a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li>
1066 </ol>
1067 </dd>
1068 <dt>If <var>n</var> is a <code>Document</code> node</dt>
1069 <dd>
1070 <ol>
1071 <li>If <a href="#xml-version"><abbr>XML</abbr> version</a> of <var>n</var>
1072 is different from <code>1.0</code> or <code>1.1</code>,
1073 then it is an <code class=ed>unknown-error?</code>.</li>
1074 <li>If the <code>xmlEncoding</code> attribute value does <em>not</em>
1075 match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code>
1076 <span class=ed>@@ formal def</span>, then it is an
1077 <a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li>
1078 <li>The <code>childNodes</code> list of <var>n</var> have to
1079 consist of zero or more <code>Comment</code> and/or
1080 <code>ProcessingInstruction</code> nodes, followed by
1081 an optional <code>DocumentType</code> node, followed
1082 by zero or more <code>Comment</code> and/or
1083 <code>ProcessingInstruction</code> nodes, followed by
1084 an <code>Element</code> node, followed
1085 by zero or more <code>Comment</code> and/or
1086 <code>ProcessingInstruction</code> nodes. Any violation to this is an
1087 <a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li>
1088 <li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn>
1089 in the <code>childNodes</code> list of <var>n</var>,
1090 <ol>
1091 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1092 <code>EntityReference</code> node, then
1093 <a href="#algorithm-to-check-a-node" title="check a node">check
1094 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
1095 </ol></li>
1096 <li class=ed>@@ <code>allDeclarationsProcessed</code></li>
1097 </ol>
1098 </dd>
1099 <dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt>
1100 <dd>
1101 <ol>
1102 <li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn>
1103 in the <code>childNodes</code> list of <var>n</var>,
1104 <ol>
1105 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1106 <code>Element</code>, <code>Text</code>, <code>CDATASection</code>,
1107 <code>Comment</code>, <code>ProcessingInstruction</code>, or
1108 <code>EntityReference</code> node, then it is an
1109 <a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li>
1110 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
1111 <code>EntityReference</code> node, then it is an
1112 <a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li>
1113 <li>Otherwise,
1114 <a href="#algorithm-to-check-a-node" title="check a node">check
1115 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
1116 </ol></li>
1117 </ol>
1118 </dd>
1119 <dt>If <var>n</var> is a <code>DocumentType</code> node</dt>
1120 <dd>
1121 <ol>
1122 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1123 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
1124 <li>Follow the following substeps:
1125 <ol>
1126 <li>If <code>ownerDocument</code> attribute of <var>n</var> is
1127 <code>null</code>, then abort these substeps.</li>
1128 <li>If <code>documentElement</code> attribute of the node
1129 set to <code>ownerDocument</code> attribute of <var>n</var> is
1130 <code>null</code>, then abort these substeps.</li>
1131 <li>If <code>nodeName</code> attribute of the node set to
1132 <code>documentElement</code> attribute of the node set to
1133 <code>ownerDocument</code> attribute of <var>n</var> is
1134 different from <code>nodeName</code> of <var>n</var>,
1135 then raise an
1136 <a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li>
1137 </ol>
1138 </li>
1139 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
1140 the <code>publicId</code> attribute value as a public identifier</a>.</li>
1141 <li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate
1142 the <code>systemId</code> attribute value as a system identifier</a>.</li>
1143 <li>If the <code>publicId</code> attribute value of <var>n</var> is
1144 <em>not</em> <code>null</code> and the <code>systemId</code> attribute
1145 value of <var>n</var> is <code>null</code>, then raise an
1146 <a href="#xml-well-formedness-error" id=wfe-dt-sid><code>xml-well-formedness-error</code></a>.
1147 <span class=ed>@@ publicId == null? Or, publicId == ""</span></li>
1148 <li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn>
1149 in the <code>childNodes</code> list of <var>n</var>,
1150 <ol>
1151 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a
1152 <code>ProcessingInstruction</code> node, then it is an
1153 <a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>.
1154 <span class=ed>@@ ref to manakai's extensions</span></li>
1155 <li>Otherwise, <!-- if n_c is not an EntityReference node, -->
1156 <a href="#algorithm-to-check-a-node" title="check a node">check
1157 <var>n<sub><var>c</var></sub></var></a> recusrively.</li>
1158 </ol></li>
1159 <li>For each node in the <code>entities</code>, <code>notations</code>,
1160 and <code>elementTypes</code> lists of <var>n</var>,
1161 <a href="#algorithm-to-check-a-node" title="check a node">check the
1162 node</a> recursively.</li>
1163 <li class=ed>@@ externally declared?</li>
1164 <li>If the <code>NamedNodeMap</code> object in the <code>entities</code>
1165 attribute of <var>n</var> does not contain <code>Entity</code> nodes
1166 whose <code>nodeName</code> attribute are <code>amp</code>,
1167 <code>lt</code>, <code>gt</code>, <code>apos</code>, and <code>quot</code>
1168 then raise
1169 <a href="#xml-misc-recommentation" id=xmr-predefined><code>xml-misc-recommendation</code></a>(s).
1170 </ol>
1171 </dd>
1172 <dt>If <var>n</var> is an <code>Element</code> node</dt>
1173 <dd>
1174 <ol>
1175 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1176 <code>localName</code> attribute value as an <code>NCName</code></a>.</li>
1177 <li>If the <code>prefix</code> attribute value is different from
1178 <code>null</code>, then <a href="#algorithm-to-validate-an-ncname">validate
1179 the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li>
1180 <li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn>
1181 in the <code>childNodes</code> list of <var>n</var>,
1182 <ol>
1183 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1184 <code>Element</code>,
1185 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
1186 <code>ProcessingInstruction</code>, or
1187 <code>EntityReference</code> node, then it is an
1188 <a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li>
1189 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
1190 <code>EntityReference</code> node, then it is an
1191 <a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li>
1192 <li>Otherwise,
1193 <a href="#algorithm-to-check-a-node" title="check a node">check
1194 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
1195 </ol></li>
1196 <li class=ed>@@ #elementvalid Validity constraint: Element Valid</li>
1197 <li>Let <var>attrs</var> be the value of the <code>attribute</code>
1198 attribute of <var>n</var>. Check conformance of <var>attrs</var>
1199 as following:
1200 <ol>
1201 <li>If <var>attrs</var> contains an <code>Attr</code> node whose
1202 <code>nodeName</code> attribute value is equal to that of another
1203 <code>Attr</code> node in <var>attrs</var>, then raise an
1204 <a href="#xml-well-formedness-error" id=wfe-uniqattspec><code>xml-well-formedness-error</code></a>.<!--
1205 #uniqattspec Well-formedness constraint: Unique Att Spec --></li>
1206 <li class=ed>@@ #RequiredAttr Validity constraint: Required Attribute</li>
1207 </ol>
1208 </li>
1209 </ol>
1210 </dd>
1211 <dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt>
1212 <dd>
1213 <ol>
1214 <li class=ed></li>
1215 <li>If the <code>childNodes</code> list of <var>n</var> contains
1216 any nodes, they are in
1217 <a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li>
1218 <li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#elemdecls">At user option, an XML processor MAY issue a warning when a declaration mentions an element type for which no declaration is provided, but this is not an error.</q></li>
1219 <li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-element-content">For compatibility, it is an error if the content model allows an element to match more than one occurrence of an element type in the content model. </q></li>
1220 <li class=ed>@@ #vc-MixedChildrenUnique
1221 Validity constraint: No Duplicate Types</li>
1222 <li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#attdecls">At user option, an XML processor MAY issue a warning if attributes are declared for an element type not itself declared, but this is not an error.</q></li>
1223 <li>If there is more than one <code>AttributeDefinition</code> node
1224 with <span class=ed>attribute type <code>ID</code></span> in the
1225 <code>NamedNodeMap</code> list contained in the
1226 <code>attributeDefinitions</code> attribute of <var>n</var>, then raise an
1227 <a href="#xml-validity-error" id=vc-one-id-per-el><code>xml-validity-error</code></a>.</li>
1228 <li>If there is more than one <code>AttributeDefinition</code> node
1229 with <span class=ed>attribute type <code>NOTATION</code></span> in the
1230 <code>NamedNodeMap</code> list contained in the
1231 <code>attributeDefinitions</code> attribute of <var>n</var>, then raise an
1232 <a href="#xml-validity-error" id=vc-one-notation-per><code>xml-validity-error</code></a>.</li>
1233 <li class=ed>"For interoperability, the same Nmtoken SHOULD NOT occur more than once in the enumerated attribute types of a single element type."</li>
1234 </ol>
1235 </dd>
1236 <dt>If <var>n</var> is an <code>Entity</code> node whose
1237 <code>notationName</code> attribute value is <code>null</code> (i.e. a
1238 parsed entity)</dt>
1239 <dd>
1240 <ol>
1241 <li>Raise an
1242 <a href="#entity-error" id=ee-entity-node><code>entity-error</code></a>.</li>
1243 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1244 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
1245 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
1246 the <code>publicId</code> attribute value as a public identifier</a>.</li>
1247 <li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate
1248 the <code>systemId</code> attribute value as a system identifier</a>.</li>
1249 <li>If the <code>publicId</code> attribute value of <var>n</var> is
1250 <em>not</em> <code>null</code> and the <code>systemId</code> attribute
1251 value of <var>n</var> is <code>null</code>, then raise an
1252 <a href="#xml-well-formedness-error" id=wfe-entity-sid><code>xml-well-formedness-error</code></a>.</li>
1253 <li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn>
1254 in the <code>childNodes</code> list of <var>n</var>,
1255 <ol>
1256 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1257 <code>Element</code>,
1258 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
1259 <code>ProcessingInstruction</code>, or <code>EntityReference</code>
1260 node, then it is an
1261 <a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li>
1262 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an
1263 <code>EntityReference</code> node, then it is an
1264 <a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li>
1265 <li>Otherwise,
1266 <a href="#algorithm-to-check-a-node" title="check a node">check
1267 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
1268 </ol></li>
1269 </ol>
1270 </dd>
1271 <dt>If <var>n</var> is an <code>Entity</code> node whose
1272 <code>notationName</code> attribute value is <em>not</em> <code>null</code>
1273 (i.e. an unparsed entity)</dt>
1274 <dd>
1275 <ol>
1276 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1277 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
1278 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
1279 the <code>publicId</code> attribute value as a public identifier</a>.</li>
1280 <li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate
1281 the <code>systemId</code> attribute value as a system identifier</a>.</li>
1282 <li>If the <code>systemId</code> attribute value of <var>n</var> is
1283 <code>null</code>, then raise an
1284 <a href="#xml-well-formedness-error" id=wfe-uentity-sid><code>xml-well-formedness-error</code></a>.</li>
1285 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1286 <code>notationName</code> attribute value of <var>n</var> as an
1287 <code>NCName</code></a>.</li>
1288 <li class=ed>@@ #not-declared Validity constraint: Notation Declared</li>
1289 <li>If the <code>childNodes</code> list of <var>n</var> contains
1290 any nodes, they are in
1291 <a href="#xml-well-formedness-error" id=wfe-uentity-child><code>xml-well-formedness-error</code></a>.</li>
1292 </ol>
1293 </dd>
1294 <dt>If <var>n</var> is an <code>EntityReference</code> node</dt>
1295 <dd>
1296 <ol>
1297 <li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li>
1298 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1299 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
1300 <li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn>
1301 in the <code>childNodes</code> list of <var>n</var>,
1302 <ol>
1303 <li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1304 <code>Element</code>,
1305 <code>Text</code>, <code>CDATASection</code>, <code>Comment</code>,
1306 <code>ProcessingInstruction</code>, or <code>EntityReference</code>
1307 node, then it is an
1308 <a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li>
1309 <li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an
1310 <code>EntityReference</code> node, then it is an
1311 <a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li>
1312 <li>Otherwise,
1313 <a href="#algorithm-to-check-a-node" title="check a node">check
1314 <var>n<sub><var>c</var></sub></var></a> recursively.</li>
1315 </ol></li>
1316 </ol>
1317 </dd>
1318 <dt>If <var>n</var> is a <code>Notation</code> node</dt>
1319 <dd>
1320 <ol>
1321 <li><a href="#algorithm-to-validate-an-ncname">Validate the
1322 <code>nodeName</code> attribute value as an <code>NCName</code></a>.</li>
1323 <li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate
1324 the <code>publicId</code> attribute value as a public identifier</a>.</li>
1325 <li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate
1326 the <code>systemId</code> attribute value as a system identifier</a>.</li>
1327 <li>If the <code>childNodes</code> list of <var>n</var> contains
1328 any nodes, they are in
1329 <a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li>
1330 </ol>
1331 </dd>
1332 <dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt>
1333 <dd>
1334 <ol>
1335 <li>If the <code>target</code> attribute value matches to the string
1336 <code>xml</code> in any case combination, then raise a
1337 <a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li>
1338 <li>Otherwise, <a href="#algorithm-to-validate-an-ncname">validate the
1339 <code>target</code> attribute value as an <code>NCName</code></a>.</li>
1340 <li>Then,
1341 <a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">validate
1342 the <code>data</code> attribute value as an <abbr>XML</abbr> character
1343 data</a>.</li>
1344 <li>If the <code>data</code> attribute value contains a string
1345 <code>?></code>, then raise a
1346 <a href="#xml-well-formedness-error" id=wfe-pi-pic><code>xml-well-formedness-error</code></a>.</li>
1347 <li>If the <code>data</code> attribute value starts with either
1348 <code class=char>U+0009</code> <code class=charname>CHARACTER
1349 TABULATION</code>, <code class=char>U+000A</code> <code class=charname>LINE
1350 FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE
1351 RETURN</code>, or <code class=char>U+0020</code>
1352 <code class=charname>SPACE</code> character, then raise a
1353 <a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li>
1354 <li>If the <code>childNodes</code> list of <var>n</var> contains
1355 any nodes, then raise an
1356 <a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li>
1357 <li class=ed>@@ Warn if not declared
1358 </ol>
1359 </dd>
1360 <dt>If <var>n</var> is a <code>Text</code> node</dt>
1361 <dd>
1362 <ol>
1363 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the
1364 <code>data</code> attribute value as an <abbr>XML</abbr> character
1365 data</a>.</li>
1366 <li>If the <code>childNodes</code> list of <var>n</var> contains
1367 any nodes, they are in
1368 <a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li>
1369 </ol>
1370 </dd>
1371 <dt>Otherwise</dt>
1372 <dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd>
1373 </dl>
1374
1375 </div>
1376
1377 </div>
1378
1379 <div id=classes class=section>
1380 <h2>Character Classes</h2>
1381
1382 <p>This section defines a couple of character classes.
1383 These classes are referred to by algorithms specified above.</p>
1384
1385 <p>Character class <dfn id=class-Char10><code>Char10</code></dfn>
1386 contains the following characters:</p>
1387 <ul>
1388 <li><code class=char>U+0009</code> <code class=charname>CHARACTER
1389 TABULATION</code></li>
1390 <li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li>
1391 <li><code class=char>U+000D</code> <code class=charname>CARRIAGE
1392 RETURN</code></li>
1393 <li><code class=char>U+0020</code> <code class=charname>SPACE</code>
1394 .. <code class=char>U+D7FF</code></li>
1395 <li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code>
1396 <code class=charname>REPLACEMENT CHARACTER</code></li>
1397 <li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li>
1398 </ul>
1399 <div class="note memo">
1400 <p>This character class contains all characters allowed in the production rule
1401 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a>
1402 of <abbr>XML</abbr> 1.0
1403 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p>
1404 </div>
1405
1406 <p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn>
1407 contains the following characters:</p>
1408 <ul>
1409 <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>
1410 </ul>
1411
1412 <p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn>
1413 contains the following characters:</p>
1414 <ul>
1415 <li><code class=char>U+007F</code> <code class=charname>DELETE</code> ..
1416 <code class=char>U+0084</code> <code class=charname>INDEX</code></li>
1417 <li><code class=char>U+0086</code> <code class=charname>START OF SELECTED
1418 AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION
1419 PROGRAM COMMAND</code></li>
1420 <li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li>
1421 <li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li>
1422 <li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li>
1423 <li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li>
1424 <li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li>
1425 <li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li>
1426 <li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li>
1427 <li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li>
1428 <li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li>
1429 <li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li>
1430 <li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li>
1431 <li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li>
1432 <li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li>
1433 <li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li>
1434 <li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li>
1435 <li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li>
1436 <li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li>
1437 </ul>
1438 <div class="note memo">
1439 <p>This character class contains the characters listed in the Note in
1440 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a>
1441 of <abbr>XML</abbr> 1.0
1442 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>,
1443 as amended by
1444 <a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p>
1445 </div>
1446
1447 <p>The character class <dfn id=class-NameStartChar10><code>NameStartChar10</code></dfn>
1448 contains the following characters:</p>
1449 <ul class=ed>
1450 </ul>
1451 <div class="note memo">
1452 <p>This character class contains all characters allowed as the first character
1453 of a string matching to the production rule
1454 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name"><code>Name</code></a>
1455 of <abbr>XML</abbr> 1.0
1456 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p>
1457 </div>
1458
1459 <p>The character class <dfn id=class-NameChar10><code>NameChar10</code></dfn>
1460 contains the following characters:</p>
1461 <ul>
1462 <li>The characters in the character class
1463 <a href="#class-NameStartChar10">NameStartChar10</a>.</li>
1464 <li class=ed></li>
1465 </ul>
1466 <div class="note memo">
1467 <p>This character class contains all characters allowed as the second
1468 character of a string matching to the production rule
1469 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name"><code>Name</code></a>
1470 of <abbr>XML</abbr> 1.0
1471 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p>
1472 </div>
1473
1474 <p>The character class <dfn id=class-PubidChar><code>PubidChar</code></dfn>
1475 contains the following characters:</p>
1476 <ul>
1477 <li><code class=char>U+0009</code> <code class=charname>CHARACTER
1478 TABULATION</code></li>
1479 <li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li>
1480 <li><code class=char>U+000D</code> <code class=charname>CARRIAGE
1481 RETURN</code></li>
1482 <li><code class=char>U+0020</code> <code class=charname>SPACE</code></li>
1483 <li><code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code>
1484 (<code class=char>!</code>)</li>
1485 <li><code class=char>U+0023</code> <code class=charname>DOLLAR SIGN</code>
1486 (<code class=char>$</code>)</li>
1487 <li><code class=char>U+0024</code> <code class=charname>NUMBER SIGN</code>
1488 (<code class=char>#</code>)</li>
1489 <li><code class=char>U+0025</code> <code class=charname>PERCENT SIGN</code>
1490 (<code class=char>%</code>)</li>
1491 <li><code class=char>U+0027</code> <code class=charname>APOSTROPHE</code>
1492 (<code class=char>'</code>)</li>
1493 <li><code class=char>U+0028</code> <code class=charname>LEFT PARENTHESIS</code>
1494 (<code class=char>(</code>)</li>
1495 <li><code class=char>U+0029</code> <code class=charname>RIGHT
1496 PARENTHESIS</code> (<code class=char>)</code>)</li>
1497 <li><code class=char>U+002A</code> <code class=charname>ASTERISK</code>
1498 (<code class=char>*</code>)</li>
1499 <li><code class=char>U+002B</code> <code class=charname>PLUS SIGN</code>
1500 (<code class=char>+</code>)</li>
1501 <li><code class=char>U+002C</code> <code class=charname>COMMA</code>
1502 (<code class=char>,</code>)</li>
1503 <li><code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code>
1504 (<code class=char>-</code>)</li>
1505 <li><code class=char>U+002E</code> <code class=charname>FULL STOP</code>
1506 (<code class=char>.</code>)</li>
1507 <li><code class=char>U+002F</code> <code class=charname>SOLIDUS</code>
1508 (<code class=char>/</code>)</li>
1509 <li><code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code>
1510 (<code class=char>0</code>) .. <code class=char>U+0039</code>
1511 <code class=charname>DIGIT NINE</code> (<code class=char>9</code>)</li>
1512 <li><code class=char>U+003A</code> <code class=charname>COLON</code>
1513 (<code class=char>:</code>)</li>
1514 <li><code class=char>U+003B</code> <code class=charname>SEMICOLON</code>
1515 (<code class=char>;</code>)</li>
1516 <li><code class=char>U+003D</code> <code class=charname>EQUAL SIGN</code>
1517 (<code class=char>=</code>)</li>
1518 <li><code class=char>U+003F</code> <code class=charname>QUESTION MARK</code>
1519 (<code class=char>?</code>)</li>
1520 <li><code class=char>U+0040</code> <code class=charname>COMMERCIAL AT</code>
1521 (<code class=char>@</code>)</li>
1522 <li><code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER
1523 A</code> (<code class=char>A</code>) .. <code class=char>U+005A</code>
1524 <code class=charname>LATIN CAPITAL LETTER Z</code>
1525 (<code class=char>Z</code>)</li>
1526 <li><code class=char>U+005F</code> <code class=charname>LOW LINE</code>
1527 (<code class=char>_</code>)</li>
1528 <li><code class=char>U+0061</code> <code class=charname>LATIN CAPITAL LETTER
1529 A</code> (<code class=char>A</code>) .. <code class=char>U+007A</code>
1530 <code class=charname>LATIN CAPITAL LETTER Z</code>
1531 (<code class=char>Z</code>)</li>
1532 </ul>
1533 <div class="note memo">
1534 <p>This character class contains all characters allowed in the production rule
1535 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-PubidChar"><code>PubidChar</code></a>
1536 of <abbr>XML</abbr> 1.0
1537 <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p>
1538 </div>
1539
1540 </div>
1541
1542 <div id="references" class="section reference">
1543 <h2>References</h2>
1544
1545 <div id="normative-references" class="section normative reference">
1546 <h3>Normative References</h3>
1547
1548 <dl>
1549 <dt id=ref-DOM3CORE>DOM3CORE</dt>
1550 <dd class=ed>@@ W3C DOM Level 3 Core</dd>
1551 <dt id=ref-DOMDTDEF>DOMDTDEF</dt>
1552 <dd class=ed>@@ manakai's extension to DOM for document type definitions</dd>
1553 <dt id="ref-KEYWORDS">KEYWORDS</dt>
1554 <dd><cite><a href="urn:ietf:rfc:2119">Key words for use in
1555 <abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>,
1556 <abbr title="Internet Engineering Task Force">IETF</abbr>
1557 <a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr>
1558 14</a>, <abbr title="Request for Comments">RFC</abbr> 2119,
1559 <time datetime=1997-03>March 1997</time>.
1560 <em>This</em> version of the specification is referenced.</dd>
1561 <dt id=ref-INFOSET>INFOSET</dt>
1562 <dd class=ed>@@</dd>
1563 <dt id=ref-XML10">XML10</dt>
1564 <dd><cite><a href="http://www.w3.org/TR/2006/REC-xml-20060816">Extensible
1565 Markup Language (<abbr>XML</abbr>) 1.0 (Fourth Edition)</a></cite>,
1566 <abbr>W3C</abbr> Recommendation, <time datetime=2006-08-16>16 August
1567 2006</time>, edited in place <time datetime=2006-09-29>29 September
1568 2006</time>. Tje latest version of the specification is available at
1569 <code class=uri>&lt;<a href="http://www.w3.org/TR/xml">http://www.w3.org/TR/xml</a>&gt;</code>.
1570 <em>This</em> version of the specification is referenced.</dd>
1571 <dt id=ref-XML11>XML11</dt>
1572 <dd class=ed>@@</dd>
1573 </dl>
1574 </div>
1575
1576 <div id="informative-references" class="section informative reference">
1577 <h3>Non$B!>(Bnormative References</h3>
1578
1579 <dl class=ed>
1580 <dt id=ref-CSS>CSS</dt>
1581 <dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading
1582 Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1)
1583 Specification</a></cite>,
1584 <abbr title="World Wide Web Consortium">W3C</abbr> Candidate
1585 Recommendation, <time datetime=2007-07-19>19 July 2007</time>.
1586 Work in progress. The latest version of the specification is
1587 available at
1588 <code class=URI>&lt;<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd>
1589 <dt id=ref-CSSOM>CSSOM</dt>
1590 <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
1591 Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>,
1592 <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
1593 <time datetime=2007-06-18>18 June 2007</time>. Work in progress.
1594 The latest Editor's Draft of the specification is available at
1595 <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>
1596 <dt id=ref-HTML5>HTML5</dt>
1597 <dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>,
1598 <abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr>
1599 Working Draft. Work in progress.</dd>
1600 <dt id=ref-SAPI>SAPI</dt>
1601 <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>,
1602 <abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft,
1603 <time datetime=2007-08-29>29 August 2007</time>. Work in progress.
1604 The latest Editor's Draft of the specification is available at
1605 <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>.
1606 The latest published version of the specification is available at
1607 <code class=URI>&lt;<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd>
1608 <dt id=XBL2>XBL2</dt>
1609 <dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr>
1610 2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>.
1611 Work in progress. The latest
1612 <abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished
1613 version of the specification is available at
1614 <code class=URI>&lt;<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd>
1615 <dt id=ref-XML5>XML5</dt>
1616 <dd class=ed>@@</dd>
1617 </dl>
1618 </div>
1619
1620 </div>
1621
1622 </body>
1623 </html>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24