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 |
|
|
143 |
|
|
144 |
<dl id=errors> |
<dl id=errors> |
145 |
<dt><dfn id=entity-error><code>entity-error</code></dfn></dt> |
<dt><dfn id=entity-error><code>entity-error</code></dfn></dt> |
146 |
<dd class=ed>@@</dd> |
<dd> |
147 |
|
<p class=ed>@@</p> |
148 |
|
<div class="note memo"> |
149 |
|
<p>This <span class=ed>algorithm</span> does not support |
150 |
|
<abbr>DOM</abbr> tree with one or more <code>EntityReference</code> |
151 |
|
nodes. It is expected that any entity references are expanded |
152 |
|
at the parse time and any unexpandable entity references |
153 |
|
make parse time errors raised so that never result in |
154 |
|
<abbr>DOM</abbr> tree with <code>EntityReference</code> nodes.</p> |
155 |
|
</div> |
156 |
|
</dd> |
157 |
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
158 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
159 |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
214 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
215 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
216 |
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> |
217 |
<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 |
218 |
a node which is <em>not</em> <code>Text</code> or |
<code>childNodes</code> list of <var>n</var>, |
219 |
<code>EntityReference</code> node, then it is a |
<ol> |
220 |
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
221 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>Text</code> or <code>EntityReference</code> node, then it is an |
222 |
an <code>EntityReference</code> node, it is an |
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
223 |
<a href="#entity-error" id=ee-er-in-attr><code>entity-error</code></a>.</li> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
224 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<code>EntityReference</code> node, then it is an |
225 |
which is different from <code>EntityReference</code> in |
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
226 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<li>Otherwise, |
227 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
228 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
229 |
|
</ol></li> |
230 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
231 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
232 |
</ol> |
</ol> |
233 |
</dd> |
</dd> |
234 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
235 |
<dd class=ed></dd> |
<dd> |
236 |
|
<ol> |
237 |
|
<li class=ed></li> |
238 |
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
239 |
|
<code>childNodes</code> list of <var>n</var>, |
240 |
|
<ol> |
241 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
242 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
243 |
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
244 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
245 |
|
<code>EntityReference</code> node, then it is an |
246 |
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
247 |
|
<li>Otherwise, |
248 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
249 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
250 |
|
</ol></li> |
251 |
|
</ol> |
252 |
|
</dd> |
253 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
254 |
<dd> |
<dd> |
255 |
<ol> |
<ol> |
257 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
258 |
data</a>.</li> |
data</a>.</li> |
259 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
260 |
a string <code>]]></code>, then it is a |
a string <code>]]></code>, then it is an |
261 |
<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> |
262 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
263 |
any nodes, they are in |
any nodes, they are in |
264 |
<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> |
265 |
</ol> |
</ol> |
266 |
</dd> |
</dd> |
267 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
272 |
data</a>.</li> |
data</a>.</li> |
273 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
274 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
275 |
<code>-</code>, then it is a |
<code>-</code>, then it is an |
276 |
<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> |
277 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
278 |
any nodes, they are in |
any nodes, they are in |
279 |
<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> |
280 |
</ol> |
</ol> |
281 |
</dd> |
</dd> |
282 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
287 |
then it is an <code class=ed>unknown-error?</code>.</li> |
then it is an <code class=ed>unknown-error?</code>.</li> |
288 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
289 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
290 |
<span class=ed>@@ formal def</span>, then it is a |
<span class=ed>@@ formal def</span>, then it is an |
291 |
<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> |
292 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
<li>The <code>childNodes</code> list of <var>n</var> have to |
293 |
consist of zero or more <code>Comment</code> and/or |
consist of zero or more <code>Comment</code> and/or |
297 |
<code>ProcessingInstruction</code> nodes, followed by |
<code>ProcessingInstruction</code> nodes, followed by |
298 |
an <code>Element</code> node, followed |
an <code>Element</code> node, followed |
299 |
by zero or more <code>Comment</code> and/or |
by zero or more <code>Comment</code> and/or |
300 |
<code>ProcessingInstruction</code> nodes. Any violation to this is a |
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
301 |
<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> |
302 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn> |
303 |
which is different from <code>EntityReference</code> in |
in the <code>childNodes</code> list of <var>n</var>, |
304 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<ol> |
305 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
306 |
|
<code>EntityReference</code> node, then |
307 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
308 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
309 |
|
</ol></li> |
310 |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
311 |
</ol> |
</ol> |
312 |
</dd> |
</dd> |
313 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
314 |
<dd> |
<dd> |
315 |
<ol> |
<ol> |
316 |
<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> |
317 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
318 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
319 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
320 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
321 |
<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 |
322 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>EntityReference</code> node, then it is an |
323 |
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> |
324 |
<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 |
325 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<code>EntityReference</code> node, then it is an |
326 |
which is different from <code>EntityReference</code> in |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
327 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<li>Otherwise, |
328 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
329 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
330 |
|
</ol></li> |
331 |
</ol> |
</ol> |
332 |
</dd> |
</dd> |
333 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
335 |
<ol> |
<ol> |
336 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
337 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
338 |
<li>If the <code>publicId</code> attribute value contains any character |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
339 |
that is outside of the range of <code>#x20 | <!--#xD | #xA |--> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
[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> |
|
340 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
341 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
342 |
<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> |
343 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
344 |
<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> |
345 |
a node which is <em>not</em> <code>ProcessingInstruction</code> node, |
in the <code>childNodes</code> list of <var>n</var>, |
346 |
then it is a |
<ol> |
347 |
<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 |
348 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
<code>ProcessingInstruction</code> node, then it is an |
349 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
350 |
which is different from <code>EntityReference</code> in |
<span class=ed>@@ ref to manakai's extensions</span></li> |
351 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
352 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
353 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
354 |
|
</ol></li> |
355 |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
356 |
<code>elementTypes</code>, externally declared?</li> |
<code>elementTypes</code>, externally declared?</li> |
357 |
</ol> |
</ol> |
364 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
365 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
366 |
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> |
367 |
<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> |
368 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
369 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
370 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
371 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
372 |
<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>, |
373 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or |
374 |
an <code>EntityReference</code> node, it is an |
<code>EntityReference</code> node, then it is an |
375 |
<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> |
376 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
377 |
which is different from <code>EntityReference</code> in |
<code>EntityReference</code> node, then it is an |
378 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
379 |
|
<li>Otherwise, |
380 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
381 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
382 |
|
</ol></li> |
383 |
</ol> |
</ol> |
384 |
</dd> |
</dd> |
385 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
386 |
<dd class=ed></dd> |
<dd> |
387 |
|
<ol> |
388 |
|
<li class=ed></li> |
389 |
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
390 |
|
any nodes, they are in |
391 |
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
392 |
|
</ol> |
393 |
|
</dd> |
394 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
395 |
<dd> |
<dd> |
396 |
<ol> |
<ol> |
397 |
<li>An <a href="#entity-error" id=ee-entity-node><code>entity-error</code></a> <span class=ed>@@ if !notationName</span>.</li> |
<li>An <a href="#entity-error" id=ee-entity-node><code>entity-error</code></a> <span class=ed>@@ if !notationName</span>.</li> |
398 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
399 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
400 |
<li>If the <code>publicId</code> attribute value contains any character |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
401 |
that is outside of the range of <code>#x20 | <!--#xD | #xA |--> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
[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> |
|
402 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
403 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
404 |
<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> |
405 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
406 |
<li class=ed>@@ <code>notationName</code></li> |
<li class=ed>@@ <code>notationName</code></li> |
407 |
<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> |
408 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
409 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
410 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
411 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
412 |
<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>, |
413 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
414 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
415 |
<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> |
416 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
417 |
which is different from <code>EntityReference</code> in |
<code>EntityReference</code> node, then it is an |
418 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
419 |
|
<li>Otherwise, |
420 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
421 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
422 |
|
</ol></li> |
423 |
</ol> |
</ol> |
424 |
</dd> |
</dd> |
425 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
428 |
<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> |
429 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
430 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
431 |
<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> |
432 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
433 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
434 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
435 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
436 |
<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>, |
437 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
438 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
439 |
<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> |
440 |
<li><a href="#algorithm-to-check-a-node">Check each node</a> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
441 |
which is different from <code>EntityReference</code> in |
<code>EntityReference</code> node, then it is an |
442 |
<code>childNodes</code> list of <var>n</var> recursively.</li> |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
443 |
|
<li>Otherwise, |
444 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
445 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
446 |
|
</ol></li> |
447 |
</ol> |
</ol> |
448 |
</dd> |
</dd> |
449 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
451 |
<ol> |
<ol> |
452 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
453 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
454 |
<li>If the <code>publicId</code> attribute value contains any character |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
455 |
that is outside of the range of <code>#x20 | <!--#xD | #xA |--> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
[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> |
|
456 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
457 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
458 |
<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> |
459 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
460 |
any nodes, they are in |
any nodes, they are in |
461 |
<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> |
462 |
</ol> |
</ol> |
463 |
</dd> |
</dd> |
464 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
480 |
<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> |
481 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
482 |
any nodes, they are in |
any nodes, they are in |
483 |
<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> |
484 |
</ol> |
</ol> |
485 |
</dd> |
</dd> |
486 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
491 |
data</a>.</li> |
data</a>.</li> |
492 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
493 |
any nodes, they are in |
any nodes, they are in |
494 |
<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> |
495 |
</ol> |
</ol> |
496 |
</dd> |
</dd> |
497 |
<dt>Otherwise</dt> |
<dt>Otherwise</dt> |
522 |
<li class=ed>@@</li> |
<li class=ed>@@</li> |
523 |
</ol> |
</ol> |
524 |
|
|
525 |
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
526 |
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
527 |
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
528 |
|
<ol> |
529 |
|
<li>If <var>pid</var> contains any character |
530 |
|
that is outside of the range of <code>#x20 | #xD | #xA | |
531 |
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
532 |
|
then it is an |
533 |
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
534 |
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
535 |
|
<code class=charname>CHARACTER TABULATION</code>, |
536 |
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
537 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
538 |
|
characters, if the first character of <var>pid</var> is |
539 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
540 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
541 |
|
<code class=charname>SPACE</code> character, or if there is a |
542 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
543 |
|
immediately followed by another <code class=char>U+0020</code> |
544 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
545 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
546 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
547 |
|
</ol> |
548 |
|
|
549 |
</div> |
</div> |
550 |
|
|
551 |
<div class="section" id="examples"> |
<div class="section" id="examples"> |