| 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 |
|
<div class=section id=checking-node> |
| 217 |
|
<h3>Checking <code>Node</code></h3> |
| 218 |
|
|
| 219 |
<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 |
| 220 |
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 |
| 221 |
following:</p> |
following:</p> |
| 228 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
| 229 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
| 230 |
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> |
| 231 |
<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 |
|
| 232 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
| 233 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
| 234 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
| 235 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
| 236 |
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
| 237 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 238 |
|
<code>EntityReference</code> node, then it is an |
| 239 |
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
| 240 |
|
<li>Otherwise, |
| 241 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 242 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
| 243 |
|
</ol></li> |
| 244 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
| 245 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
| 246 |
</ol> |
</ol> |
| 247 |
</dd> |
</dd> |
| 248 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
| 249 |
<dd class=ed></dd> |
<dd> |
| 250 |
|
<ol> |
| 251 |
|
<li class=ed></li> |
| 252 |
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
| 253 |
|
<code>childNodes</code> list of <var>n</var>, |
| 254 |
|
<ol> |
| 255 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
| 256 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
| 257 |
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
| 258 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 259 |
|
<code>EntityReference</code> node, then it is an |
| 260 |
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
| 261 |
|
<li>Otherwise, |
| 262 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 263 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
| 264 |
|
</ol></li> |
| 265 |
|
</ol> |
| 266 |
|
</dd> |
| 267 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
| 268 |
<dd> |
<dd> |
| 269 |
<ol> |
<ol> |
| 271 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 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>, then it is a |
a string <code>]]></code>, then it is an |
| 275 |
<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> |
| 276 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 277 |
any nodes, they are in |
any nodes, they are in |
| 278 |
<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> |
| 279 |
</ol> |
</ol> |
| 280 |
</dd> |
</dd> |
| 281 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
| 286 |
data</a>.</li> |
data</a>.</li> |
| 287 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
| 288 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
| 289 |
<code>-</code>, then it is a |
<code>-</code>, then it is an |
| 290 |
<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> |
| 291 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 292 |
any nodes, they are in |
any nodes, they are in |
| 293 |
<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> |
| 294 |
</ol> |
</ol> |
| 295 |
</dd> |
</dd> |
| 296 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
| 301 |
then it is an <code class=ed>unknown-error?</code>.</li> |
then it is an <code class=ed>unknown-error?</code>.</li> |
| 302 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
| 303 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
| 304 |
<span class=ed>@@ formal def</span>, then it is a |
<span class=ed>@@ formal def</span>, then it is an |
| 305 |
<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> |
| 306 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
<li>The <code>childNodes</code> list of <var>n</var> have to |
| 307 |
consist of zero or more <code>Comment</code> and/or |
consist of zero or more <code>Comment</code> and/or |
| 311 |
<code>ProcessingInstruction</code> nodes, followed by |
<code>ProcessingInstruction</code> nodes, followed by |
| 312 |
an <code>Element</code> node, followed |
an <code>Element</code> node, followed |
| 313 |
by zero or more <code>Comment</code> and/or |
by zero or more <code>Comment</code> and/or |
| 314 |
<code>ProcessingInstruction</code> nodes. Any violation to this is a |
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
| 315 |
<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> |
| 316 |
<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> |
| 317 |
<code>childNodes</code> list of <var>n</var>, |
in the <code>childNodes</code> list of <var>n</var>, |
| 318 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
| 319 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 320 |
|
<code>EntityReference</code> node, then |
| 321 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 322 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
| 323 |
|
</ol></li> |
| 324 |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
| 325 |
</ol> |
</ol> |
| 326 |
</dd> |
</dd> |
| 327 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
| 328 |
<dd> |
<dd> |
| 329 |
<ol> |
<ol> |
| 330 |
<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> |
| 331 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
| 332 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
| 333 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 334 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
| 335 |
<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 |
| 336 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>EntityReference</code> node, then it is an |
| 337 |
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> |
| 338 |
<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 |
| 339 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<code>EntityReference</code> node, then it is an |
| 340 |
<code>childNodes</code> list of <var>n</var> |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
| 341 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, |
| 342 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 343 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
| 344 |
|
</ol></li> |
| 345 |
</ol> |
</ol> |
| 346 |
</dd> |
</dd> |
| 347 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
| 355 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
| 356 |
<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> |
| 357 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
| 358 |
<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> |
| 359 |
a node which is <em>not</em> <code>ProcessingInstruction</code> node, |
in the <code>childNodes</code> list of <var>n</var>, |
| 360 |
then it is a |
<ol> |
| 361 |
<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 |
| 362 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
<code>ProcessingInstruction</code> node, then it is an |
| 363 |
<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>. |
| 364 |
<code>childNodes</code> list of <var>n</var>, |
<span class=ed>@@ ref to manakai's extensions</span></li> |
| 365 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
| 366 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 367 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
| 368 |
|
</ol></li> |
| 369 |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
| 370 |
<code>elementTypes</code>, externally declared?</li> |
<code>elementTypes</code>, externally declared?</li> |
| 371 |
</ol> |
</ol> |
| 378 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
| 379 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
| 380 |
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> |
| 381 |
<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> |
| 382 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
| 383 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
| 384 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 385 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
| 386 |
<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>, |
| 387 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or |
| 388 |
an <code>EntityReference</code> node, it is an |
<code>EntityReference</code> node, then it is an |
| 389 |
<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> |
| 390 |
<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 |
| 391 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
| 392 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
| 393 |
|
<li>Otherwise, |
| 394 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 395 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
| 396 |
|
</ol></li> |
| 397 |
</ol> |
</ol> |
| 398 |
</dd> |
</dd> |
| 399 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
| 400 |
<dd class=ed></dd> |
<dd> |
| 401 |
|
<ol> |
| 402 |
|
<li class=ed></li> |
| 403 |
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 404 |
|
any nodes, they are in |
| 405 |
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
| 406 |
|
</ol> |
| 407 |
|
</dd> |
| 408 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
| 409 |
<dd> |
<dd> |
| 410 |
<ol> |
<ol> |
| 418 |
<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> |
| 419 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
| 420 |
<li class=ed>@@ <code>notationName</code></li> |
<li class=ed>@@ <code>notationName</code></li> |
| 421 |
<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> |
| 422 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
| 423 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
| 424 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 425 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
| 426 |
<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>, |
| 427 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
| 428 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
| 429 |
<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> |
| 430 |
<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 |
| 431 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
| 432 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
| 433 |
|
<li>Otherwise, |
| 434 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 435 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
| 436 |
|
</ol></li> |
| 437 |
</ol> |
</ol> |
| 438 |
</dd> |
</dd> |
| 439 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
| 442 |
<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> |
| 443 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 444 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 445 |
<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> |
| 446 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
| 447 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
| 448 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 449 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
| 450 |
<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>, |
| 451 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
| 452 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
| 453 |
<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> |
| 454 |
<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 |
| 455 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
| 456 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
| 457 |
|
<li>Otherwise, |
| 458 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 459 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
| 460 |
|
</ol></li> |
| 461 |
</ol> |
</ol> |
| 462 |
</dd> |
</dd> |
| 463 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
| 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 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 474 |
any nodes, they are in |
any nodes, they are in |
| 475 |
<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> |
| 476 |
</ol> |
</ol> |
| 477 |
</dd> |
</dd> |
| 478 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
| 494 |
<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> |
| 495 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 496 |
any nodes, they are in |
any nodes, they are in |
| 497 |
<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> |
| 498 |
</ol> |
</ol> |
| 499 |
</dd> |
</dd> |
| 500 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
| 505 |
data</a>.</li> |
data</a>.</li> |
| 506 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 507 |
any nodes, they are in |
any nodes, they are in |
| 508 |
<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> |
| 509 |
</ol> |
</ol> |
| 510 |
</dd> |
</dd> |
| 511 |
<dt>Otherwise</dt> |
<dt>Otherwise</dt> |
| 512 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
| 513 |
</dl> |
</dl> |
| 514 |
|
|
| 515 |
|
</div> |
| 516 |
|
|
| 517 |
|
<div class=section id=checking-components> |
| 518 |
|
<h3>Checking Components</h3> |
| 519 |
|
|
| 520 |
<p>The algorithm |
<p>The algorithm |
| 521 |
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
| 522 |
validate an <abbr>XML</abbr> character data |
validate an <abbr>XML</abbr> character data |
| 545 |
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
| 546 |
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
| 547 |
<ol> |
<ol> |
| 548 |
<li>If <var>pid</var> contains any character |
<li>If <var>pid</var> contains any character |
| 549 |
that is outside of the range of <code>#x20 | <!--#xD | #xA |--> |
that is outside of the range of <code>#x20 | #xD | #xA | |
| 550 |
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
| 551 |
or contains a leading <code class=char>U+0020</code> character, |
then it is an |
| 552 |
a trailing <code class=char>U+0020</code> character, or a |
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
| 553 |
sequence of two or more <code class=char>U+0020</code> characters, |
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
| 554 |
then it is a |
<code class=charname>CHARACTER TABULATION</code>, |
| 555 |
<a href="#xml-well-formedness-error" id=wfe-dt-public-id><code>xml-well-formedness-error</code></a>.</li> |
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
| 556 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
| 557 |
|
characters, if the first character of <var>pid</var> is |
| 558 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
| 559 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
| 560 |
|
<code class=charname>SPACE</code> character, or if there is a |
| 561 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
| 562 |
|
immediately followed by another <code class=char>U+0020</code> |
| 563 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
| 564 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
| 565 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
| 566 |
</ol> |
</ol> |
| 567 |
|
|
| 568 |
</div> |
</div> |
| 569 |
|
|
|
<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> |
|
|
|
|
|
</div> |
|
|
|
|
| 570 |
</div> |
</div> |
| 571 |
|
|
| 572 |
<div id="references" class="section reference"> |
<div id="references" class="section reference"> |