17 |
<body class="has-abstract"> |
<body class="has-abstract"> |
18 |
|
|
19 |
<div class="header"> |
<div class="header"> |
20 |
<h1>manakai's XML Conformance Checking</h1> |
<h1>manakai's <abbr>XML</abbr> Conformance Checking</h1> |
21 |
<h2>Working Draft <time datetime=2007-11-13>13 November 2007</time></h2> |
<h2>Working Draft <time datetime=2007-11-26>26 November 2007</time></h2> |
22 |
|
|
23 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
24 |
<dt>This Version</dt> |
<dt>This Version</dt> |
120 |
raised is undefined.</p> |
raised is undefined.</p> |
121 |
</div> |
</div> |
122 |
|
|
|
<div class="section" id=checking-dom> |
|
|
<h2>Checking <abbr>DOM</abbr></h2> |
|
|
|
|
|
<p>The following algorithms and definitions are applied to |
|
|
<abbr>XML</abbr> documents; especially, they are not applied |
|
|
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
|
123 |
|
|
124 |
<div class=section id=error-categories> |
<div class=section id=error-categories> |
125 |
<h3>Error Classification</h3> |
<h2>Error Classification</h2> |
126 |
|
|
127 |
<p class=ed>If a <code>Document</code> node has no |
<p class=ed>If a <code>Document</code> node has no |
128 |
xml-well-formedness-error, entity-error, and unknown-error, |
xml-well-formedness-error, entity-error, and unknown-error, |
153 |
</dd> |
</dd> |
154 |
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
155 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
156 |
|
<dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt> |
157 |
|
<dd> |
158 |
|
<p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a> |
159 |
|
will be raised when a construct, which might not be restored to the same |
160 |
|
construct when it is serialized and then re-parsed by a conforming |
161 |
|
processor, is encountered.</p> |
162 |
|
<div class="example memo"> |
163 |
|
<p>For a <code>Comment</code> node a |
164 |
|
<a href="#round-trip-warning"><code>round-trip-warning</code></a> will |
165 |
|
be raised, since <abbr>XML</abbr> processors are not required to |
166 |
|
report texts of comments for applications.</p> |
167 |
|
</div> |
168 |
|
</dd> |
169 |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
170 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
171 |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
186 |
<a href="@@/#dt-fatal">fatal error</a>) |
<a href="@@/#dt-fatal">fatal error</a>) |
187 |
that is not classified to any other <a href="#error-category">error |
that is not classified to any other <a href="#error-category">error |
188 |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
189 |
|
<dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt> |
190 |
|
<dd> |
191 |
|
<p>An |
192 |
|
<a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a> |
193 |
|
will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement |
194 |
|
in <abbr>XML</abbr> specification is not met.</p> |
195 |
|
</dd> |
196 |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
197 |
<dd>A violation of validity constraint in XML document.</dd> |
<dd>A violation of validity constraint in XML document.</dd> |
198 |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
210 |
|
|
211 |
</div> |
</div> |
212 |
|
|
213 |
|
<div class=section id=parsing-xml> |
214 |
|
<h2>Parsing <abbr>XML</abbr> Document</h2> |
215 |
|
|
216 |
|
<ul> |
217 |
|
<li>If the <abbr>XML</abbr> document does not begin with an |
218 |
|
<abbr>XML</abbr> declaration, then raise an |
219 |
|
<a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li> |
220 |
|
<li>If the replacement text of an entity declaration is |
221 |
|
<code><</code>, then raise an |
222 |
|
<a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- |
223 |
|
"strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. |
224 |
|
--></li> |
225 |
|
<li>If there is an element type declaration whose <code>Name</code> |
226 |
|
value is already declared, then raise an |
227 |
|
<a href="#xml-validity-error" id=vc-edunique><code>xml-validity-error</code></a>.</li> |
228 |
|
<li>If attribute definition whose <code>Name</code> is |
229 |
|
<code>xml:space</code> has <span class=ed>declared type different from |
230 |
|
(default|preserve), (default), or (preserve)</span>, then raise an |
231 |
|
<a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>. |
232 |
|
<span class=ed>@@ duplication with |
233 |
|
<a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!-- |
234 |
|
<!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li> |
235 |
|
<li>If an empty-element tag is used for an element which is <em>not</em> |
236 |
|
declared <code>EMPTY</code>, then raise an |
237 |
|
<a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>.</li> |
238 |
|
<li>If an empty-element tag is <em>not</em> used for an element which is |
239 |
|
declared <code>EMPTY</code>, then raise an |
240 |
|
<a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>.</li> |
241 |
|
<!-- |
242 |
|
|
243 |
|
#vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting |
244 |
|
#wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset |
245 |
|
#ExtSubset Well-formedness constraint: External Subset |
246 |
|
#PE-between-Decls Well-formedness constraint: PE Between Declarations |
247 |
|
#GIMatch Well-formedness constraint: Element Type Match |
248 |
|
#uniqattspec Well-formedness constraint: Unique Att Spec |
249 |
|
#NoExternalRefs Well-formedness constraint: No External Entity References |
250 |
|
#CleanAttrVals Well-formedness constraint: No < in Attribute Values |
251 |
|
#vc-PEinGroup Validity constraint: Proper Group/PE Nesting |
252 |
|
"For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text SHOULD contain at least one non-blank character, and neither the first nor last non-blank character of the replacement text SHOULD be a connector (| or ,)." |
253 |
|
"For interoperability, an XML processor MAY at user option issue a warning when more than one attribute-list declaration is provided for a given element type, or more than one attribute definition is provided for a given attribute, but this is not an error." |
254 |
|
|
255 |
|
@@ Need detailed review, but maybe should be in parsing phase |
256 |
|
|
257 |
|
#vc-check-rmd Validity constraint: Standalone Document Declaration |
258 |
|
|
259 |
|
--> |
260 |
|
</ul> |
261 |
|
</div> |
262 |
|
|
263 |
|
<div class="section" id=checking-dom> |
264 |
|
<h2>Checking <abbr>DOM</abbr></h2> |
265 |
|
|
266 |
|
<p>The following algorithms and definitions are applied to |
267 |
|
<abbr>XML</abbr> documents; especially, they are not applied |
268 |
|
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
269 |
|
|
270 |
<div class=section id=definitions> |
<div class=section id=definitions> |
271 |
<h3>Definitions</h3> |
<h3>Definitions</h3> |
272 |
|
|
293 |
validate an <abbr>XML</abbr> character data |
validate an <abbr>XML</abbr> character data |
294 |
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
295 |
<ol> |
<ol> |
296 |
<li class=ed>@@</li> |
<li>If <var>s</var> contains a character that is <em>not</em> in |
297 |
|
the character class <a href="#class-Char10"><code>Char10</code></a>, |
298 |
|
then raise an |
299 |
|
<a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li> |
300 |
|
<li>If <var>s</var> contains a character that is in the character |
301 |
|
class <a href="#class-CompatChar10"><code>CompatChar10</code></a>, |
302 |
|
then raise an |
303 |
|
<a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li> |
304 |
|
<li>If <var>s</var> contains a character that is in the character |
305 |
|
class <a href="#class-ControlChar10"><code>ControlChar10</code></a>, |
306 |
|
then raise an |
307 |
|
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
308 |
|
<li class=ed>@@ XML 1.1 support</li> |
309 |
|
<li>If <var>s</var> contains a <code class=char>U+000D</code> |
310 |
|
<code class=charname>CARRIAGE RETURN</code> character, then |
311 |
|
raise a |
312 |
|
<a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>. |
313 |
|
<span class=ed>@@ We should not raise duplicate errors for U+000D |
314 |
|
in attribute values. In addition, we should support a mode where |
315 |
|
U+000D will be serialized as 
 (so that no round-trip-error |
316 |
|
will be raised).</span></li> |
317 |
</ol> |
</ol> |
318 |
|
|
319 |
<p>The algorithm |
<p>The algorithm |
320 |
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
321 |
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
<code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn> is defined |
322 |
as following:</p> |
as following:</p> |
323 |
<ol> |
<ol> |
324 |
|
<li>If <var>s</var> begins with the string <code>xml</code> (in any |
325 |
|
case combination), then raise an |
326 |
|
<a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>. |
327 |
|
<span class=ed>@@ except for attribute names <code>xml:lang</code>, |
328 |
|
<code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>, |
329 |
|
<code>xmlns</code>, <code>xmlns:<var>*</var></code>, |
330 |
|
pi name <code>xml-stylesheet</code>.</span><!-- |
331 |
|
"names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification.": |
332 |
|
xml:base and xml:id specifications violate to this sentense! |
333 |
|
--></li> |
334 |
|
<!-- COLON in Name is a lowercase "should not" in a Note of [XML10], |
335 |
|
[XML11]. --> |
336 |
<li class=ed>@@</li> |
<li class=ed>@@</li> |
337 |
</ol> |
</ol> |
338 |
|
|
398 |
<a href="#algorithm-to-check-a-node" title="check a node">check |
<a href="#algorithm-to-check-a-node" title="check a node">check |
399 |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
400 |
</ol></li> |
</ol></li> |
401 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
402 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
403 |
|
and <code>value</code> attribute of <var>n</var> is neither |
404 |
|
<code>default</code> nor <code>preserve</code>, then it is an |
405 |
|
<a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!-- |
406 |
|
Note that <!ATTLIST e xml:space (default|preserve) "a">... |
407 |
|
<e xml:space="default"/> is conforming and valid. --></li> |
408 |
|
<li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its |
409 |
|
successor] or an empty string, then xml-misc-warning |
410 |
|
(a "fact"-level error; not an XML error).</li> |
411 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
412 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code> (#ValueType Validity constraint: Attribute Value Type)</li> |
413 |
|
<!-- xml:space MUST be declared to be valid. --> |
414 |
|
<li>Let <dfn id=var-v><var>v</var></dfn> be the value of the |
415 |
|
attribute <code>value</code> of <var>n</var>.</li> |
416 |
|
<li>Validate the <var>n</var> against the <span class=ed>declared |
417 |
|
type</span> as following: |
418 |
|
<dl class=switch> |
419 |
|
<dt class=ed><code>ID_ATTR</code></dt> |
420 |
|
<dd> |
421 |
|
<ol> |
422 |
|
<li><span class=ed>Validate <var>v</var> as an |
423 |
|
<code>Name</code>.</span> If it fails, then raise an |
424 |
|
<a href="#xml-validity-error" id=vc-id-name><code>xml-validity-error</code></a>.</li> |
425 |
|
<li><span class=ed>If <code>ID</code> <var>v</var> is defined,</span> |
426 |
|
then raise an |
427 |
|
<a href="#xml-validity-error" id=vc-id-duplication><code>xml-validity-error</code></a>.</li> |
428 |
|
</ol> |
429 |
|
</dd> |
430 |
|
<dt class=ed>IDREF_ATTR</dt> |
431 |
|
<dd> |
432 |
|
<ol> |
433 |
|
<li><span class=ed>Validate <var>v</var> as an |
434 |
|
<code>Name</code>.</span> If it fails, then raise an |
435 |
|
<a href="#xml-validity-error" id=vc-idref-name><code>xml-validity-error</code></a>.</li> |
436 |
|
<li><span class=ed>If <code>ID</code> <var>v</var> is NOT |
437 |
|
defined,</span> then raise an |
438 |
|
<a href="#xml-validity-error" id=vc-idref-match><code>xml-validity-error</code></a>.</li> |
439 |
|
</ol> |
440 |
|
</dd> |
441 |
|
<dt class=ed>IDREFS_ATTR</dt> |
442 |
|
<dd class=ed>@@</dd> |
443 |
|
<dt class=ed>ENTITY_ATTR</dt> |
444 |
|
<dd> |
445 |
|
<ol> |
446 |
|
<li><span class=ed>Validate <var>v</var> as an |
447 |
|
<code>Name</code>.</span> If it fails, then raise an |
448 |
|
<a href="#xml-validity-error" id=vc-entname-name><code>xml-validity-error</code></a>.</li> |
449 |
|
<li><span class=ed>If <code>Entity</code> <var>v</var> is NOT |
450 |
|
defined,</span> then raise an |
451 |
|
<a href="#xml-validity-error" id=vc-entname-match><code>xml-validity-error</code></a>.</li> |
452 |
|
</ol> |
453 |
|
</dd> |
454 |
|
<dt class=ed>ENTITIES_ATTR</dt> |
455 |
|
<dd class=ed>@@</dd> |
456 |
|
<dt class=ed>NMTOKEN_ATTR</dt> |
457 |
|
<dd> |
458 |
|
<ol> |
459 |
|
<li><span class=ed>Validate <var>v</var> as an |
460 |
|
<code>Nmtoken</code>.</span> If it fails, then raise an |
461 |
|
<a href="#xml-validity-error" id=vc-nmtok-name><code>xml-validity-error</code></a>.</li> |
462 |
|
</ol> |
463 |
|
</dd> |
464 |
|
<dt class=ed>NMTOKENS_ATTR</dt> |
465 |
|
<dd class=ed>@@</dd> |
466 |
|
<dt class=ed>NOTATION_ATTR</dt> |
467 |
|
<dd class=ed><var>v</var> must be one of enumerated values. |
468 |
|
If not, then raise an |
469 |
|
<a href="#xml-validity-error" id=vc-notatn-match><code>xml-validity-error</code></a>.</dd> |
470 |
|
<dt class=ed>ENUMERATED_ATTR</dt> |
471 |
|
<dd class=ed><var>v</var> must be one of enumerated values. |
472 |
|
If not, then raise an |
473 |
|
<a href="#xml-validity-error" id=vc-enum><code>xml-validity-error</code></a>.</dd> |
474 |
|
<dt class=ed>@@</dt> |
475 |
|
</dl> |
476 |
|
</li> |
477 |
|
<li>If <span class=ed>default is NOT #IMPLIED or #REQUIRED</span>, then |
478 |
|
raise an |
479 |
|
<a href="#xml-validity-error" id=vc-id-default><code>xml-validity-error</code></a>.</li> |
480 |
</ol> |
</ol> |
481 |
</dd> |
</dd> |
482 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
483 |
<dd> |
<dd> |
484 |
<ol> |
<ol> |
485 |
<li class=ed></li> |
<li class=ed></li> |
486 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
487 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
488 |
|
and <span class=ed>its declared type is different from (default|preserve), |
489 |
|
(default), or (preserve)</span>, then raise an |
490 |
|
<a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li> |
491 |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
492 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
493 |
<ol> |
<ol> |
501 |
<a href="#algorithm-to-check-a-node" title="check a node">check |
<a href="#algorithm-to-check-a-node" title="check a node">check |
502 |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
503 |
</ol></li> |
</ol></li> |
504 |
|
<li class=ed>If <code>NOTATION_ATTR</code>, enumerated values MUST |
505 |
|
be declared. If not, then raise an |
506 |
|
<a href="#xml-validity-error" id=vc-notatn-declared><code>xml-validity-error</code></a>.</li> |
507 |
|
<li class=ed>If <code>NOTATION_ATTR</code> or <code>ENUMERATED_ATTR</code>, |
508 |
|
values MUST all be distinct. If not, then raise an |
509 |
|
<a href="#xml-validity-error" id=vc-no-duplicate-tokens><code>xml-validity-error</code></a>.</li> |
510 |
|
<li class=ed>If <code>NOTATION_ATTR</code> on an <code>EMPTY</code> |
511 |
|
element, then raise an |
512 |
|
<a href="#xml-validity-error" id=vc-no-notation-empty><code>xml-validity-error</code></a>.</li> |
513 |
</ol> |
</ol> |
514 |
</dd> |
</dd> |
515 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
519 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
520 |
data</a>.</li> |
data</a>.</li> |
521 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
522 |
a string <code>]]></code>, then it is an |
a string <code>]]></code>, then raise an |
523 |
<a href="#xml-well-formedness-error" id=wfe-cs-mse><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-cs-mse><code>xml-well-formedness-error</code></a>.<!-- "for compatibility" --></li> |
524 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
525 |
any nodes, they are in |
any nodes, they are in |
526 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
529 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
530 |
<dd> |
<dd> |
531 |
<ol> |
<ol> |
532 |
|
<li>Raise an |
533 |
|
<a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li> |
534 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
535 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
536 |
data</a>.</li> |
data</a>.</li> |
537 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
538 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
539 |
<code>-</code>, then it is an |
<code>-</code>, then raise an |
540 |
<a href="#xml-well-formedness-error" id=wfe-comment-com><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-comment-com><code>xml-well-formedness-error</code></a>.<!-- |
541 |
|
"for compatibility" --></li> |
542 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
543 |
any nodes, they are in |
any nodes, they are in |
544 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
600 |
<ol> |
<ol> |
601 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
602 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
603 |
|
<li>Follow the following substeps: |
604 |
|
<ol> |
605 |
|
<li>If <code>ownerDocument</code> attribute of <var>n</var> is |
606 |
|
<code>null</code>, then abort these substeps.</li> |
607 |
|
<li>If <code>documentElement</code> attribute of the node |
608 |
|
set to <code>ownerDocument</code> attribute of <var>n</var> is |
609 |
|
<code>null</code>, then abort these substeps.</li> |
610 |
|
<li>If <code>nodeName</code> attribute of the node set to |
611 |
|
<code>documentElement</code> attribute of the node set to |
612 |
|
<code>ownerDocument</code> attribute of <var>n</var> is |
613 |
|
different from <code>nodeName</code> of <var>n</var>, |
614 |
|
then raise an |
615 |
|
<a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li> |
616 |
|
</ol> |
617 |
|
</li> |
618 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
619 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
620 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
660 |
<a href="#algorithm-to-check-a-node" title="check a node">check |
<a href="#algorithm-to-check-a-node" title="check a node">check |
661 |
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
662 |
</ol></li> |
</ol></li> |
663 |
|
<li class=ed>@@ #elementvalid Validity constraint: Element Valid</li> |
664 |
|
<li class=ed>@@ #uniqattspec Well-formedness constraint: Unique Att Spec</li> |
665 |
</ol> |
</ol> |
666 |
</dd> |
</dd> |
667 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
671 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
672 |
any nodes, they are in |
any nodes, they are in |
673 |
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
674 |
|
<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> |
675 |
|
<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> |
676 |
|
<li class=ed>@@ #vc-MixedChildrenUnique |
677 |
|
Validity constraint: No Duplicate Types</li> |
678 |
|
<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> |
679 |
|
<li>If there is more than one <code>AttributeDefinition</code> node |
680 |
|
with <span class=ed>attribute type <code>ID</code></span> in the |
681 |
|
<code>NamedNodeMap</code> list contained in the |
682 |
|
<code>attributeDefinitions</code> attribute of <var>n</var>, then raise an |
683 |
|
<a href="#xml-validity-error" id=vc-one-id-per-el><code>xml-validity-error</code></a>.</li> |
684 |
|
<li>If there is more than one <code>AttributeDefinition</code> node |
685 |
|
with <span class=ed>attribute type <code>NOTATION</code></span> in the |
686 |
|
<code>NamedNodeMap</code> list contained in the |
687 |
|
<code>attributeDefinitions</code> attribute of <var>n</var>, then raise an |
688 |
|
<a href="#xml-validity-error" id=vc-one-notation-per><code>xml-validity-error</code></a>.</li> |
689 |
|
<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> |
690 |
</ol> |
</ol> |
691 |
</dd> |
</dd> |
692 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
762 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
763 |
<dd> |
<dd> |
764 |
<ol> |
<ol> |
765 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li>If the <code>target</code> attribute value matches to the string |
766 |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
<code>xml</code> in any case combination, then raise a |
|
<li>If the <code>target</code> attribute value matches to |
|
|
<code>XML</code> case-insensitively, then it is a |
|
767 |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
768 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li>Otherwise, <a href="#algorithm-to-validate-a-ncname">validate the |
769 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
770 |
|
<li>Then, |
771 |
|
<a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML character data">validate |
772 |
|
the <code>data</code> attribute value as an <abbr>XML</abbr> character |
773 |
data</a>.</li> |
data</a>.</li> |
774 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains a string |
775 |
a string <code>?></code>, or starts with either |
<code>?></code>, then raise a |
776 |
<code class=char>U+0009</code>, <code class=char>U+000A</code>, |
<a href="#xml-well-formedness-error" id=wfe-pi-pic><code>xml-well-formedness-error</code></a>.</li> |
777 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
<li>If the <code>data</code> attribute value starts with either |
778 |
character, then it is a |
<code class=char>U+0009</code> <code class=charname>CHARACTER |
779 |
<a href="#round-trip-error" id=rte-pi-data><code>round-trip-error</code></a>.</li> |
TABULATION</code>, <code class=char>U+000A</code> <code class=charname>LINE |
780 |
|
FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE |
781 |
|
RETURN</code>, or <code class=char>U+0020</code> |
782 |
|
<code class=charname>SPACE</code> character, then raise a |
783 |
|
<a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li> |
784 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
785 |
any nodes, they are in |
any nodes, then raise an |
786 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
787 |
</ol> |
</ol> |
788 |
</dd> |
</dd> |
804 |
</div> |
</div> |
805 |
|
|
806 |
</div> |
</div> |
807 |
|
|
808 |
|
<div id=classes class=section> |
809 |
|
<h2>Character Classes</h2> |
810 |
|
|
811 |
|
<p>This section defines a couple of character classes. |
812 |
|
These classes are referred to by algorithms specified above.</p> |
813 |
|
|
814 |
|
<p>Character class <dfn id=class-Char10><code>Char10</code></dfn> |
815 |
|
contains the following characters:</p> |
816 |
|
<ul> |
817 |
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
818 |
|
TABULATION</code></li> |
819 |
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
820 |
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
821 |
|
RETURN</code></li> |
822 |
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code> |
823 |
|
.. <code class=char>U+D7FF</code></li> |
824 |
|
<li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code> |
825 |
|
<code class=charname>REPLACEMENT CHARACTER</code></li> |
826 |
|
<li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li> |
827 |
|
</ul> |
828 |
|
<div class="note memo"> |
829 |
|
<p>This character class contains all characters allowed in the production rule |
830 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a> |
831 |
|
of <abbr>XML</abbr> 1.0 |
832 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
833 |
|
</div> |
834 |
|
|
835 |
|
<p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn> |
836 |
|
contains the following characters:</p> |
837 |
|
<ul> |
838 |
|
<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> |
839 |
|
</ul> |
840 |
|
|
841 |
|
<p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn> |
842 |
|
contains the following characters:</p> |
843 |
|
<ul> |
844 |
|
<li><code class=char>U+007F</code> <code class=charname>DELETE</code> .. |
845 |
|
<code class=char>U+0084</code> <code class=charname>INDEX</code></li> |
846 |
|
<li><code class=char>U+0086</code> <code class=charname>START OF SELECTED |
847 |
|
AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION |
848 |
|
PROGRAM COMMAND</code></li> |
849 |
|
<li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li> |
850 |
|
<li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li> |
851 |
|
<li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li> |
852 |
|
<li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li> |
853 |
|
<li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li> |
854 |
|
<li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li> |
855 |
|
<li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li> |
856 |
|
<li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li> |
857 |
|
<li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li> |
858 |
|
<li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li> |
859 |
|
<li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li> |
860 |
|
<li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li> |
861 |
|
<li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li> |
862 |
|
<li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li> |
863 |
|
<li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li> |
864 |
|
<li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li> |
865 |
|
<li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li> |
866 |
|
</ul> |
867 |
|
<div class="note memo"> |
868 |
|
<p>This character class contains the characters listed in the Note in |
869 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a> |
870 |
|
of <abbr>XML</abbr> 1.0 |
871 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>, |
872 |
|
as amended by |
873 |
|
<a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p> |
874 |
|
</div> |
875 |
|
|
876 |
|
</div> |
877 |
|
|
878 |
<div id="references" class="section reference"> |
<div id="references" class="section reference"> |
879 |
<h2>References</h2> |
<h2>References</h2> |