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 class=ed>@@</li> |
226 |
|
</ol> |
227 |
|
|
228 |
|
<p>The algorithm |
229 |
|
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
230 |
|
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
231 |
|
as following:</p> |
232 |
|
<ol> |
233 |
|
<li class=ed>@@</li> |
234 |
|
</ol> |
235 |
|
|
236 |
|
<p>The algorithm |
237 |
|
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
238 |
|
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
239 |
|
is defined as following:</p> |
240 |
|
<ol> |
241 |
|
<li class=ed>@@</li> |
242 |
|
</ol> |
243 |
|
|
244 |
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
245 |
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
246 |
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
247 |
|
<ol> |
248 |
|
<li>If <var>pid</var> contains any character |
249 |
|
that is outside of the range of <code>#x20 | #xD | #xA | |
250 |
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
251 |
|
then it is an |
252 |
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
253 |
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
254 |
|
<code class=charname>CHARACTER TABULATION</code>, |
255 |
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
256 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
257 |
|
characters, if the first character of <var>pid</var> is |
258 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
259 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
260 |
|
<code class=charname>SPACE</code> character, or if there is a |
261 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
262 |
|
immediately followed by another <code class=char>U+0020</code> |
263 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
264 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
265 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
266 |
|
</ol> |
267 |
|
|
268 |
|
</div> |
269 |
|
|
270 |
|
<div class=section id=checking-node> |
271 |
|
<h3>Checking <code>Node</code></h3> |
272 |
|
|
273 |
<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 |
274 |
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 |
275 |
following:</p> |
following:</p> |
566 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
567 |
</dl> |
</dl> |
568 |
|
|
|
<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> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="section" id="examples"> |
|
|
<h2>Examples</h2> |
|
|
|
|
|
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
|
|
|
|
|
<div class="ed issue"> |
|
|
|
|
|
<div class="example figure block"> |
|
|
<div class="caption">...</div> |
|
|
|
|
|
<pre><code>...</code></pre> |
|
|
</div> |
|
|
|
|
569 |
</div> |
</div> |
570 |
|
|
571 |
</div> |
</div> |