4 |
<title>manakai's XML Conformance Checking</title> |
<title>manakai's XML Conformance Checking</title> |
5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
6 |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
7 |
|
<style> |
8 |
|
a[id]::before { |
9 |
|
content: "[" attr(id) "]"; |
10 |
|
color: gray; |
11 |
|
font-size: 70%; |
12 |
|
font-family: Courier New, monospace; |
13 |
|
vertical-align: 60%; |
14 |
|
} |
15 |
|
</style> |
16 |
</head> |
</head> |
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 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> |
282 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
283 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
284 |
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> |
285 |
<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-er-in-attr><code>entity-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
|
286 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
287 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
288 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
289 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
290 |
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
291 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
292 |
|
<code>EntityReference</code> node, then it is an |
293 |
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
294 |
|
<li>Otherwise, |
295 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
296 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
297 |
|
</ol></li> |
298 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
299 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
300 |
</ol> |
</ol> |
301 |
</dd> |
</dd> |
302 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
303 |
<dd class=ed></dd> |
<dd> |
304 |
|
<ol> |
305 |
|
<li class=ed></li> |
306 |
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
307 |
|
<code>childNodes</code> list of <var>n</var>, |
308 |
|
<ol> |
309 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
310 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
311 |
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
312 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
313 |
|
<code>EntityReference</code> node, then it is an |
314 |
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
315 |
|
<li>Otherwise, |
316 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
317 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
318 |
|
</ol></li> |
319 |
|
</ol> |
320 |
|
</dd> |
321 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
322 |
<dd> |
<dd> |
323 |
<ol> |
<ol> |
325 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
326 |
data</a>.</li> |
data</a>.</li> |
327 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
328 |
a string <code>]]></code>, then it is a |
a string <code>]]></code>, then it is an |
329 |
<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> |
330 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
331 |
any nodes, they are in |
any nodes, they are in |
332 |
<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> |
333 |
</ol> |
</ol> |
334 |
</dd> |
</dd> |
335 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
340 |
data</a>.</li> |
data</a>.</li> |
341 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
342 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
343 |
<code>-</code>, then it is a |
<code>-</code>, then it is an |
344 |
<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> |
345 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
346 |
any nodes, they are in |
any nodes, they are in |
347 |
<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> |
348 |
</ol> |
</ol> |
349 |
</dd> |
</dd> |
350 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
355 |
then it is an <code class=ed>unknown-error?</code>.</li> |
then it is an <code class=ed>unknown-error?</code>.</li> |
356 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
357 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
358 |
<span class=ed>@@ formal def</span>, then it is a |
<span class=ed>@@ formal def</span>, then it is an |
359 |
<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> |
360 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
<li>The <code>childNodes</code> list of <var>n</var> have to |
361 |
consist of zero or more <code>Comment</code> and/or |
consist of zero or more <code>Comment</code> and/or |
365 |
<code>ProcessingInstruction</code> nodes, followed by |
<code>ProcessingInstruction</code> nodes, followed by |
366 |
an <code>Element</code> node, followed |
an <code>Element</code> node, followed |
367 |
by zero or more <code>Comment</code> and/or |
by zero or more <code>Comment</code> and/or |
368 |
<code>ProcessingInstruction</code> nodes. Any violation to this is a |
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
369 |
<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> |
370 |
<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> |
371 |
<code>childNodes</code> list of <var>n</var>, |
in the <code>childNodes</code> list of <var>n</var>, |
372 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
373 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
374 |
|
<code>EntityReference</code> node, then |
375 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
376 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
377 |
|
</ol></li> |
378 |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
379 |
</ol> |
</ol> |
380 |
</dd> |
</dd> |
381 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
382 |
<dd> |
<dd> |
383 |
<ol> |
<ol> |
384 |
<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> |
385 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
386 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
387 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
388 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
389 |
<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 |
390 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>EntityReference</code> node, then it is an |
391 |
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> |
392 |
<a href="#entity-error" id=ee-er-in-df><code>entity-error</code></a>.</li> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
393 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<code>EntityReference</code> node, then it is an |
394 |
<code>childNodes</code> list of <var>n</var> |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
395 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, |
396 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
397 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
398 |
|
</ol></li> |
399 |
</ol> |
</ol> |
400 |
</dd> |
</dd> |
401 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
409 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
410 |
<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> |
411 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
412 |
<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> |
413 |
a node which is <em>not</em> <code>ProcessingInstruction</code> node, |
in the <code>childNodes</code> list of <var>n</var>, |
414 |
then it is a |
<ol> |
415 |
<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 |
416 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
<code>ProcessingInstruction</code> node, then it is an |
417 |
<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>. |
418 |
<code>childNodes</code> list of <var>n</var>, |
<span class=ed>@@ ref to manakai's extensions</span></li> |
419 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
420 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
421 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
422 |
|
</ol></li> |
423 |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
424 |
<code>elementTypes</code>, externally declared?</li> |
<code>elementTypes</code>, externally declared?</li> |
425 |
</ol> |
</ol> |
432 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
433 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
434 |
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> |
435 |
<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> |
436 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
437 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
438 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
439 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
440 |
<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>, |
441 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or |
442 |
an <code>EntityReference</code> node, it is an |
<code>EntityReference</code> node, then it is an |
443 |
<a href="#entity-error" id=ee-er-in-element><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
444 |
<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 |
445 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
446 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
447 |
|
<li>Otherwise, |
448 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
449 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
450 |
|
</ol></li> |
451 |
</ol> |
</ol> |
452 |
</dd> |
</dd> |
453 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
454 |
<dd class=ed></dd> |
<dd> |
455 |
|
<ol> |
456 |
|
<li class=ed></li> |
457 |
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
458 |
|
any nodes, they are in |
459 |
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
460 |
|
</ol> |
461 |
|
</dd> |
462 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
463 |
<dd> |
<dd> |
464 |
<ol> |
<ol> |
472 |
<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> |
473 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
474 |
<li class=ed>@@ <code>notationName</code></li> |
<li class=ed>@@ <code>notationName</code></li> |
475 |
<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> |
476 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
477 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
478 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
479 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
480 |
<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>, |
481 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
482 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
483 |
<a href="#entity-error" id=ee-er-in-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> |
484 |
<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 |
485 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
486 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
487 |
|
<li>Otherwise, |
488 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
489 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
490 |
|
</ol></li> |
491 |
</ol> |
</ol> |
492 |
</dd> |
</dd> |
493 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
496 |
<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> |
497 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
498 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
499 |
<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> |
500 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
501 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
502 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
503 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
504 |
<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>, |
505 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
506 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
507 |
<a href="#entity-error" id=ee-er-in-entity><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
508 |
<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 |
509 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
510 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
511 |
|
<li>Otherwise, |
512 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
513 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
514 |
|
</ol></li> |
515 |
</ol> |
</ol> |
516 |
</dd> |
</dd> |
517 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
526 |
<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> |
527 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
528 |
any nodes, they are in |
any nodes, they are in |
529 |
<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> |
530 |
</ol> |
</ol> |
531 |
</dd> |
</dd> |
532 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
548 |
<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> |
549 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
550 |
any nodes, they are in |
any nodes, they are in |
551 |
<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> |
552 |
</ol> |
</ol> |
553 |
</dd> |
</dd> |
554 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
559 |
data</a>.</li> |
data</a>.</li> |
560 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
561 |
any nodes, they are in |
any nodes, they are in |
562 |
<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> |
563 |
</ol> |
</ol> |
564 |
</dd> |
</dd> |
565 |
<dt>Otherwise</dt> |
<dt>Otherwise</dt> |
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 -->, |
|
|
or contains a leading <code class=char>U+0020</code> character, |
|
|
a trailing <code class=char>U+0020</code> character, or a |
|
|
sequence of two or more <code class=char>U+0020</code> characters, |
|
|
then it is a |
|
|
<a href="#xml-well-formedness-error" id=wfe-dt-public-id><code>xml-well-formedness-error</code></a>.</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> |