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> |
295 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
296 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
297 |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
298 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
|
a node which is <em>not</em> <code>Text</code> or |
|
|
<code>EntityReference</code> node, then it is a |
|
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
an <code>EntityReference</code> node, it is an |
|
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
|
299 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
300 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
301 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
302 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
303 |
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
304 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
305 |
|
<code>EntityReference</code> node, then it is an |
306 |
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
307 |
|
<li>Otherwise, |
308 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
309 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
310 |
|
</ol></li> |
311 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
312 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
313 |
</ol> |
</ol> |
314 |
</dd> |
</dd> |
315 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
316 |
<dd class=ed></dd> |
<dd> |
317 |
|
<ol> |
318 |
|
<li class=ed></li> |
319 |
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
320 |
|
<code>childNodes</code> list of <var>n</var>, |
321 |
|
<ol> |
322 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
323 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
324 |
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
325 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
326 |
|
<code>EntityReference</code> node, then it is an |
327 |
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
328 |
|
<li>Otherwise, |
329 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
330 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
331 |
|
</ol></li> |
332 |
|
</ol> |
333 |
|
</dd> |
334 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
335 |
<dd> |
<dd> |
336 |
<ol> |
<ol> |
338 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
339 |
data</a>.</li> |
data</a>.</li> |
340 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
341 |
a string <code>]]></code>, then it is a |
a string <code>]]></code>, then it is an |
342 |
<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>.</li> |
343 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
344 |
any nodes, they are in |
any nodes, they are in |
345 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
346 |
</ol> |
</ol> |
347 |
</dd> |
</dd> |
348 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
353 |
data</a>.</li> |
data</a>.</li> |
354 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
355 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
356 |
<code>-</code>, then it is a |
<code>-</code>, then it is an |
357 |
<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>.</li> |
358 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
359 |
any nodes, they are in |
any nodes, they are in |
360 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
361 |
</ol> |
</ol> |
362 |
</dd> |
</dd> |
363 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
368 |
then it is an <code class=ed>unknown-error?</code>.</li> |
then it is an <code class=ed>unknown-error?</code>.</li> |
369 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
370 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
371 |
<span class=ed>@@ formal def</span>, then it is a |
<span class=ed>@@ formal def</span>, then it is an |
372 |
<a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li> |
373 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
<li>The <code>childNodes</code> list of <var>n</var> have to |
374 |
consist of zero or more <code>Comment</code> and/or |
consist of zero or more <code>Comment</code> and/or |
378 |
<code>ProcessingInstruction</code> nodes, followed by |
<code>ProcessingInstruction</code> nodes, followed by |
379 |
an <code>Element</code> node, followed |
an <code>Element</code> node, followed |
380 |
by zero or more <code>Comment</code> and/or |
by zero or more <code>Comment</code> and/or |
381 |
<code>ProcessingInstruction</code> nodes. Any violation to this is a |
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
382 |
<a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li> |
383 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn> |
384 |
<code>childNodes</code> list of <var>n</var>, |
in the <code>childNodes</code> list of <var>n</var>, |
385 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
386 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
387 |
|
<code>EntityReference</code> node, then |
388 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
389 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
390 |
|
</ol></li> |
391 |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
392 |
</ol> |
</ol> |
393 |
</dd> |
</dd> |
394 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
395 |
<dd> |
<dd> |
396 |
<ol> |
<ol> |
397 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn> |
398 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
399 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
400 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
401 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
402 |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Comment</code>, <code>ProcessingInstruction</code>, or |
403 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>EntityReference</code> node, then it is an |
404 |
an <code>EntityReference</code> node, it is an |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
405 |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
406 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<code>EntityReference</code> node, then it is an |
407 |
<code>childNodes</code> list of <var>n</var> |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
408 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, |
409 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
410 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
411 |
|
</ol></li> |
412 |
</ol> |
</ol> |
413 |
</dd> |
</dd> |
414 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
422 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
423 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
424 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
425 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn> |
426 |
a node which is <em>not</em> <code>ProcessingInstruction</code> node, |
in the <code>childNodes</code> list of <var>n</var>, |
427 |
then it is a |
<ol> |
428 |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
429 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
<code>ProcessingInstruction</code> node, then it is an |
430 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
431 |
<code>childNodes</code> list of <var>n</var>, |
<span class=ed>@@ ref to manakai's extensions</span></li> |
432 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
433 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
434 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
435 |
|
</ol></li> |
436 |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
437 |
<code>elementTypes</code>, externally declared?</li> |
<code>elementTypes</code>, externally declared?</li> |
438 |
</ol> |
</ol> |
445 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
446 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
447 |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
448 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn> |
449 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
450 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
451 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
452 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
453 |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
454 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or |
455 |
an <code>EntityReference</code> node, it is an |
<code>EntityReference</code> node, then it is an |
456 |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
457 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
458 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
459 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
460 |
|
<li>Otherwise, |
461 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
462 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
463 |
|
</ol></li> |
464 |
</ol> |
</ol> |
465 |
</dd> |
</dd> |
466 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
467 |
<dd class=ed></dd> |
<dd> |
468 |
|
<ol> |
469 |
|
<li class=ed></li> |
470 |
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
471 |
|
any nodes, they are in |
472 |
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
473 |
|
</ol> |
474 |
|
</dd> |
475 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
476 |
<dd> |
<dd> |
477 |
<ol> |
<ol> |
485 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
486 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
487 |
<li class=ed>@@ <code>notationName</code></li> |
<li class=ed>@@ <code>notationName</code></li> |
488 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn> |
489 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
490 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
491 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
492 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
493 |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
494 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
495 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
496 |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
497 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
498 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
499 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
500 |
|
<li>Otherwise, |
501 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
502 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
503 |
|
</ol></li> |
504 |
</ol> |
</ol> |
505 |
</dd> |
</dd> |
506 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
509 |
<li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li> |
<li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li> |
510 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
511 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
512 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn> |
513 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
514 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
515 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
516 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
517 |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
518 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
519 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
520 |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
521 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
522 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
523 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
524 |
|
<li>Otherwise, |
525 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
526 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
527 |
|
</ol></li> |
528 |
</ol> |
</ol> |
529 |
</dd> |
</dd> |
530 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
539 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
540 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
541 |
any nodes, they are in |
any nodes, they are in |
542 |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li> |
543 |
</ol> |
</ol> |
544 |
</dd> |
</dd> |
545 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
561 |
<a href="#round-trip-error" id=rte-pi-data><code>round-trip-error</code></a>.</li> |
<a href="#round-trip-error" id=rte-pi-data><code>round-trip-error</code></a>.</li> |
562 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
563 |
any nodes, they are in |
any nodes, they are in |
564 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
565 |
</ol> |
</ol> |
566 |
</dd> |
</dd> |
567 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
572 |
data</a>.</li> |
data</a>.</li> |
573 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
574 |
any nodes, they are in |
any nodes, they are in |
575 |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li> |
576 |
</ol> |
</ol> |
577 |
</dd> |
</dd> |
578 |
<dt>Otherwise</dt> |
<dt>Otherwise</dt> |
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> |