18 |
|
|
19 |
<div class="header"> |
<div class="header"> |
20 |
<h1>manakai's XML Conformance Checking</h1> |
<h1>manakai's XML Conformance Checking</h1> |
21 |
<h2>Working Draft <time datetime=2007-11-12>12 November 2007</time></h2> |
<h2>Working Draft <time datetime=2007-11-13>13 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 |
|
|
123 |
<div class="section"> |
<div class="section" id=checking-dom> |
124 |
<h2 class=ed>Algorithms</h2> |
<h2>Checking <abbr>DOM</abbr></h2> |
125 |
|
|
126 |
<p>The following algorithms and definitions are applied to |
<p>The following algorithms and definitions are applied to |
127 |
<abbr>XML</abbr> documents; especially, they are not applied |
<abbr>XML</abbr> documents; especially, they are not applied |
128 |
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
129 |
|
|
130 |
|
<div class=section id=error-categories> |
131 |
|
<h3>Error Classification</h3> |
132 |
|
|
133 |
<p class=ed>If a <code>Document</code> node has no |
<p class=ed>If a <code>Document</code> node has no |
134 |
xml-well-formedness-error, entity-error, and unknown-error, |
xml-well-formedness-error, entity-error, and unknown-error, |
135 |
then it is well-formed. If a well-formed <code>Document</code> |
then it is well-formed. If a well-formed <code>Document</code> |
194 |
(MAY or MUST), #dt-compat for compatibility, |
(MAY or MUST), #dt-compat for compatibility, |
195 |
#dt-interop for interoperability</p></div> |
#dt-interop for interoperability</p></div> |
196 |
|
|
197 |
|
</div> |
198 |
|
|
199 |
|
<div class=section id=definitions> |
200 |
|
<h3>Definitions</h3> |
201 |
|
|
202 |
<p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is |
<p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is |
203 |
the <abbr>XML</abbr> version of the document to which the node belongs. |
the <abbr>XML</abbr> version of the document to which the node belongs. |
204 |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
205 |
of the document is the value of the <code>xmlVersion</code> |
of the document is the value of the <code>xmlVersion</code> |
206 |
attribute. For a <code>DocumentType</code> node whose |
attribute of the node. For a <code>DocumentType</code> node whose |
207 |
<code>ownerDocument</code> is set to <code>null</code>, |
<code>ownerDocument</code> attribute is set to <code>null</code>, |
208 |
the <abbr>XML</abbr> version of the document is <code>1.0</code>. |
the <abbr>XML</abbr> version of the document is <code>1.0</code><!-- |
209 |
|
since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->. |
210 |
For any other node, the <abbr>XML</abbr> version of the document |
For any other node, the <abbr>XML</abbr> version of the document |
211 |
is that of the <code>Document</code> node contained in the |
is that of the <code>Document</code> node contained in the |
212 |
<code>ownerDocument</code> attribute of the node.</p> |
<code>ownerDocument</code> attribute of the node.</p> |
213 |
|
|
214 |
|
</div> |
215 |
|
|
216 |
|
|
217 |
|
<div class=section id=checking-components> |
218 |
|
<h3>Checking Components</h3> |
219 |
|
|
220 |
|
<p>The algorithm |
221 |
|
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
222 |
|
validate an <abbr>XML</abbr> character data |
223 |
|
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
224 |
|
<ol> |
225 |
|
<li>If <var>s</var> contains a character that is <em>not</em> in |
226 |
|
the character class <a href="#class-Char10"><code>Char10</code></a>, |
227 |
|
then raise an |
228 |
|
<a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li> |
229 |
|
<li>If <var>s</var> contains a character that is in the character |
230 |
|
class <a href="#class-CompatChar10"><code>CompatChar10</code></a>, |
231 |
|
then raise an |
232 |
|
<a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li> |
233 |
|
<li>If <var>s</var> contains a character that is in the character |
234 |
|
class <a href="#class-ControlChar10"><code>ControlChar10</code></a>, |
235 |
|
then raise an |
236 |
|
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
237 |
|
<li class=ed>@@ XML 1.1 support</li> |
238 |
|
<li class=ed>@@ If U+000D, round-trip-error</li> |
239 |
|
</ol> |
240 |
|
|
241 |
|
<p>The algorithm |
242 |
|
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
243 |
|
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
244 |
|
as following:</p> |
245 |
|
<ol> |
246 |
|
<li class=ed>@@</li> |
247 |
|
</ol> |
248 |
|
|
249 |
|
<p>The algorithm |
250 |
|
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
251 |
|
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
252 |
|
is defined as following:</p> |
253 |
|
<ol> |
254 |
|
<li class=ed>@@</li> |
255 |
|
</ol> |
256 |
|
|
257 |
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
258 |
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
259 |
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
260 |
|
<ol> |
261 |
|
<li>If <var>pid</var> contains any character |
262 |
|
that is outside of the range of <code>#x20 | #xD | #xA | |
263 |
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
264 |
|
then it is an |
265 |
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
266 |
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
267 |
|
<code class=charname>CHARACTER TABULATION</code>, |
268 |
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
269 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
270 |
|
characters, if the first character of <var>pid</var> is |
271 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
272 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
273 |
|
<code class=charname>SPACE</code> character, or if there is a |
274 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
275 |
|
immediately followed by another <code class=char>U+0020</code> |
276 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
277 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
278 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
279 |
|
</ol> |
280 |
|
|
281 |
|
</div> |
282 |
|
|
283 |
|
<div class=section id=checking-node> |
284 |
|
<h3>Checking <code>Node</code></h3> |
285 |
|
|
286 |
<p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to |
<p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to |
287 |
check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as |
check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as |
288 |
following:</p> |
following:</p> |
579 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
580 |
</dl> |
</dl> |
581 |
|
|
|
<p>The algorithm |
|
|
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
|
|
validate an <abbr>XML</abbr> character data |
|
|
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
|
|
<ol> |
|
|
<li class=ed>@@</li> |
|
|
</ol> |
|
|
|
|
|
<p>The algorithm |
|
|
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
|
|
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
|
|
as following:</p> |
|
|
<ol> |
|
|
<li class=ed>@@</li> |
|
|
</ol> |
|
|
|
|
|
<p>The algorithm |
|
|
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
|
|
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
|
|
is defined as following:</p> |
|
|
<ol> |
|
|
<li class=ed>@@</li> |
|
|
</ol> |
|
|
|
|
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
|
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
|
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li>If <var>pid</var> contains any character |
|
|
that is outside of the range of <code>#x20 | #xD | #xA | |
|
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
|
|
then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
|
|
<code class=charname>CHARACTER TABULATION</code>, |
|
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
|
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
|
|
characters, if the first character of <var>pid</var> is |
|
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
|
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
|
|
<code class=charname>SPACE</code> character, or if there is a |
|
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
|
|
immediately followed by another <code class=char>U+0020</code> |
|
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
|
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
|
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
|
|
</ol> |
|
|
|
|
582 |
</div> |
</div> |
583 |
|
|
584 |
<div class="section" id="examples"> |
</div> |
|
<h2>Examples</h2> |
|
|
|
|
|
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
|
585 |
|
|
586 |
<div class="ed issue"> |
<div id=classes class=section> |
587 |
|
<h2>Character Classes</h2> |
588 |
|
|
589 |
<div class="example figure block"> |
<p>This section defines a couple of character classes. |
590 |
<div class="caption">...</div> |
These classes are referred to by algorithms specified above.</p> |
591 |
|
|
592 |
<pre><code>...</code></pre> |
<p>Character class <dfn id=class-Char10><code>Char10</code></dfn> |
593 |
|
contains the following characters:</p> |
594 |
|
<ul> |
595 |
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
596 |
|
TABULATION</code></li> |
597 |
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
598 |
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
599 |
|
RETURN</code></li> |
600 |
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code> |
601 |
|
.. <code class=char>U+D7FF</code></li> |
602 |
|
<li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code> |
603 |
|
<code class=charname>REPLACEMENT CHARACTER</code></li> |
604 |
|
<li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li> |
605 |
|
</ul> |
606 |
|
<div class="note memo"> |
607 |
|
<p>This character class contains all characters allowed in the production rule |
608 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a> |
609 |
|
of <abbr>XML</abbr> 1.0 |
610 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
611 |
</div> |
</div> |
612 |
|
|
613 |
|
<p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn> |
614 |
|
contains the following characters:</p> |
615 |
|
<ul> |
616 |
|
<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> |
617 |
|
</ul> |
618 |
|
|
619 |
|
<p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn> |
620 |
|
contains the following characters:</p> |
621 |
|
<ul> |
622 |
|
<li><code class=char>U+007F</code> <code class=charname>DELETE</code> .. |
623 |
|
<code class=char>U+0084</code> <code class=charname>INDEX</code></li> |
624 |
|
<li><code class=char>U+0086</code> <code class=charname>START OF SELECTED |
625 |
|
AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION |
626 |
|
PROGRAM COMMAND</code></li> |
627 |
|
<li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li> |
628 |
|
<li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li> |
629 |
|
<li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li> |
630 |
|
<li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li> |
631 |
|
<li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li> |
632 |
|
<li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li> |
633 |
|
<li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li> |
634 |
|
<li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li> |
635 |
|
<li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li> |
636 |
|
<li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li> |
637 |
|
<li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li> |
638 |
|
<li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li> |
639 |
|
<li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li> |
640 |
|
<li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li> |
641 |
|
<li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li> |
642 |
|
<li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li> |
643 |
|
<li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li> |
644 |
|
</ul> |
645 |
|
<div class="note memo"> |
646 |
|
<p>This character class contains the characters listed in the Note in |
647 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a> |
648 |
|
of <abbr>XML</abbr> 1.0 |
649 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>, |
650 |
|
as amended by |
651 |
|
<a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p> |
652 |
</div> |
</div> |
653 |
|
|
654 |
</div> |
</div> |