| 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 <abbr>XML</abbr> Conformance Checking</h1> |
| 21 |
<h2>Working Draft <time datetime=2007-11-12>12 November 2007</time></h2> |
<h2>Working Draft <time datetime=2007-11-14>14 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 |
|
|
|
<div class="section"> |
|
|
<h2 class=ed>Algorithms</h2> |
|
| 123 |
|
|
| 124 |
<p>The following algorithms and definitions are applied to |
<div class=section id=error-categories> |
| 125 |
<abbr>XML</abbr> documents; especially, they are not applied |
<h2>Error Classification</h2> |
|
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
|
| 126 |
|
|
| 127 |
<p class=ed>If a <code>Document</code> node has no |
<p class=ed>If a <code>Document</code> node has no |
| 128 |
xml-well-formedness-error, entity-error, and unknown-error, |
xml-well-formedness-error, entity-error, and unknown-error, |
| 153 |
</dd> |
</dd> |
| 154 |
<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> |
| 155 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
| 156 |
|
<dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt> |
| 157 |
|
<dd> |
| 158 |
|
<p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a> |
| 159 |
|
will be raised when a construct, which might not be restored to the same |
| 160 |
|
construct when it is serialized and then re-parsed by a conforming |
| 161 |
|
processor, is encountered.</p> |
| 162 |
|
<div class="example memo"> |
| 163 |
|
<p>For a <code>Comment</code> node a |
| 164 |
|
<a href="#round-trip-warning"><code>round-trip-warning</code></a> will |
| 165 |
|
be raised, since <abbr>XML</abbr> processors are not required to |
| 166 |
|
report texts of comments for applications.</p> |
| 167 |
|
</div> |
| 168 |
|
</dd> |
| 169 |
<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> |
| 170 |
<dd class=ed>@@</dd> |
<dd class=ed>@@</dd> |
| 171 |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
| 186 |
<a href="@@/#dt-fatal">fatal error</a>) |
<a href="@@/#dt-fatal">fatal error</a>) |
| 187 |
that is not classified to any other <a href="#error-category">error |
that is not classified to any other <a href="#error-category">error |
| 188 |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
| 189 |
|
<dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt> |
| 190 |
|
<dd> |
| 191 |
|
<p>An |
| 192 |
|
<a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a> |
| 193 |
|
will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement |
| 194 |
|
in <abbr>XML</abbr> specification is not met.</p> |
| 195 |
|
</dd> |
| 196 |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
| 197 |
<dd>A violation of validity constraint in XML document.</dd> |
<dd>A violation of validity constraint in XML document.</dd> |
| 198 |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
| 208 |
(MAY or MUST), #dt-compat for compatibility, |
(MAY or MUST), #dt-compat for compatibility, |
| 209 |
#dt-interop for interoperability</p></div> |
#dt-interop for interoperability</p></div> |
| 210 |
|
|
| 211 |
|
</div> |
| 212 |
|
|
| 213 |
|
<div class=section id=parsing-xml> |
| 214 |
|
<h2>Parsing <abbr>XML</abbr> Document</h2> |
| 215 |
|
|
| 216 |
|
<ul> |
| 217 |
|
<li>If the <abbr>XML</abbr> document does not begin with an |
| 218 |
|
<abbr>XML</abbr> declaration, then raise an |
| 219 |
|
<a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li> |
| 220 |
|
<li>If the replacement text of an entity declaration is |
| 221 |
|
<code><</code>, then raise an |
| 222 |
|
<a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- |
| 223 |
|
"strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. |
| 224 |
|
--></li> |
| 225 |
|
<li>If attribute definition whose <code>Name</code> is |
| 226 |
|
<code>xml:space</code> has <span class=ed>declared type different from |
| 227 |
|
(default|preserve), (default), or (preserve)</span>, then raise an |
| 228 |
|
<a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>. |
| 229 |
|
<span class=ed>@@ duplication with |
| 230 |
|
<a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!-- |
| 231 |
|
<!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li> |
| 232 |
|
<!-- |
| 233 |
|
|
| 234 |
|
#vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting |
| 235 |
|
#wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset |
| 236 |
|
#ExtSubset Well-formedness constraint: External Subset |
| 237 |
|
#PE-between-Decls Well-formedness constraint: PE Between Declarations |
| 238 |
|
|
| 239 |
|
@@ Need detailed review, but maybe should be in parsing phase |
| 240 |
|
|
| 241 |
|
#vc-check-rmd Validity constraint: Standalone Document Declaration |
| 242 |
|
|
| 243 |
|
--> |
| 244 |
|
</ul> |
| 245 |
|
</div> |
| 246 |
|
|
| 247 |
|
<div class="section" id=checking-dom> |
| 248 |
|
<h2>Checking <abbr>DOM</abbr></h2> |
| 249 |
|
|
| 250 |
|
<p>The following algorithms and definitions are applied to |
| 251 |
|
<abbr>XML</abbr> documents; especially, they are not applied |
| 252 |
|
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
| 253 |
|
|
| 254 |
|
<div class=section id=definitions> |
| 255 |
|
<h3>Definitions</h3> |
| 256 |
|
|
| 257 |
<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 |
| 258 |
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. |
| 259 |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
| 260 |
of the document is the value of the <code>xmlVersion</code> |
of the document is the value of the <code>xmlVersion</code> |
| 261 |
attribute. For a <code>DocumentType</code> node whose |
attribute of the node. For a <code>DocumentType</code> node whose |
| 262 |
<code>ownerDocument</code> is set to <code>null</code>, |
<code>ownerDocument</code> attribute is set to <code>null</code>, |
| 263 |
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><!-- |
| 264 |
|
since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->. |
| 265 |
For any other node, the <abbr>XML</abbr> version of the document |
For any other node, the <abbr>XML</abbr> version of the document |
| 266 |
is that of the <code>Document</code> node contained in the |
is that of the <code>Document</code> node contained in the |
| 267 |
<code>ownerDocument</code> attribute of the node.</p> |
<code>ownerDocument</code> attribute of the node.</p> |
| 268 |
|
|
| 269 |
|
</div> |
| 270 |
|
|
| 271 |
|
|
| 272 |
|
<div class=section id=checking-components> |
| 273 |
|
<h3>Checking Components</h3> |
| 274 |
|
|
| 275 |
|
<p>The algorithm |
| 276 |
|
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
| 277 |
|
validate an <abbr>XML</abbr> character data |
| 278 |
|
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
| 279 |
|
<ol> |
| 280 |
|
<li>If <var>s</var> contains a character that is <em>not</em> in |
| 281 |
|
the character class <a href="#class-Char10"><code>Char10</code></a>, |
| 282 |
|
then raise an |
| 283 |
|
<a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li> |
| 284 |
|
<li>If <var>s</var> contains a character that is in the character |
| 285 |
|
class <a href="#class-CompatChar10"><code>CompatChar10</code></a>, |
| 286 |
|
then raise an |
| 287 |
|
<a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li> |
| 288 |
|
<li>If <var>s</var> contains a character that is in the character |
| 289 |
|
class <a href="#class-ControlChar10"><code>ControlChar10</code></a>, |
| 290 |
|
then raise an |
| 291 |
|
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
| 292 |
|
<li class=ed>@@ XML 1.1 support</li> |
| 293 |
|
<li>If <var>s</var> contains a <code class=char>U+000D</code> |
| 294 |
|
<code class=charname>CARRIAGE RETURN</code> character, then |
| 295 |
|
raise a |
| 296 |
|
<a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>. |
| 297 |
|
<span class=ed>@@ We should not raise duplicate errors for U+000D |
| 298 |
|
in attribute values. In addition, we should support a mode where |
| 299 |
|
U+000D will be serialized as 
 (so that no round-trip-error |
| 300 |
|
will be raised).</span></li> |
| 301 |
|
</ol> |
| 302 |
|
|
| 303 |
|
<p>The algorithm |
| 304 |
|
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
| 305 |
|
<code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn> is defined |
| 306 |
|
as following:</p> |
| 307 |
|
<ol> |
| 308 |
|
<li>If <var>s</var> begins with the string <code>xml</code> (in any |
| 309 |
|
case combination), then raise an |
| 310 |
|
<a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>. |
| 311 |
|
<span class=ed>@@ except for attribute names <code>xml:lang</code>, |
| 312 |
|
<code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>, |
| 313 |
|
<code>xmlns</code>, <code>xmlns:<var>*</var></code>, |
| 314 |
|
pi name <code>xml-stylesheet</code>.</span></li> |
| 315 |
|
<!-- COLON in Name is a lowercase "should not" in a Note of [XML10], |
| 316 |
|
[XML11]. --> |
| 317 |
|
<li class=ed>@@</li> |
| 318 |
|
</ol> |
| 319 |
|
|
| 320 |
|
<p>The algorithm |
| 321 |
|
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
| 322 |
|
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
| 323 |
|
is defined as following:</p> |
| 324 |
|
<ol> |
| 325 |
|
<li class=ed>@@</li> |
| 326 |
|
</ol> |
| 327 |
|
|
| 328 |
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
| 329 |
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
| 330 |
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
| 331 |
|
<ol> |
| 332 |
|
<li>If <var>pid</var> contains any character |
| 333 |
|
that is outside of the range of <code>#x20 | #xD | #xA | |
| 334 |
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
| 335 |
|
then it is an |
| 336 |
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
| 337 |
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
| 338 |
|
<code class=charname>CHARACTER TABULATION</code>, |
| 339 |
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
| 340 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
| 341 |
|
characters, if the first character of <var>pid</var> is |
| 342 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
| 343 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
| 344 |
|
<code class=charname>SPACE</code> character, or if there is a |
| 345 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
| 346 |
|
immediately followed by another <code class=char>U+0020</code> |
| 347 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
| 348 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
| 349 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
| 350 |
|
</ol> |
| 351 |
|
|
| 352 |
|
</div> |
| 353 |
|
|
| 354 |
|
<div class=section id=checking-node> |
| 355 |
|
<h3>Checking <code>Node</code></h3> |
| 356 |
|
|
| 357 |
<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 |
| 358 |
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 |
| 359 |
following:</p> |
following:</p> |
| 379 |
<a href="#algorithm-to-check-a-node" title="check a node">check |
<a href="#algorithm-to-check-a-node" title="check a node">check |
| 380 |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
| 381 |
</ol></li> |
</ol></li> |
| 382 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
| 383 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
| 384 |
|
and <code>value</code> attribute of <var>n</var> is neither |
| 385 |
|
<code>default</code> nor <code>preserve</code>, then it is an |
| 386 |
|
<a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!-- |
| 387 |
|
Note that <!ATTLIST e xml:space (default|preserve) "a">... |
| 388 |
|
<e xml:space="default"/> is conforming and valid. --></li> |
| 389 |
|
<li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its |
| 390 |
|
successor] or an empty string, then xml-misc-warning |
| 391 |
|
(a "fact"-level error; not an XML error).</li> |
| 392 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
| 393 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
| 394 |
|
<!-- xml:space MUST be declared to be valid. --> |
| 395 |
</ol> |
</ol> |
| 396 |
</dd> |
</dd> |
| 397 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
| 398 |
<dd> |
<dd> |
| 399 |
<ol> |
<ol> |
| 400 |
<li class=ed></li> |
<li class=ed></li> |
| 401 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
| 402 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
| 403 |
|
and <span class=ed>its declared type is different from (default|preserve), |
| 404 |
|
(default), or (preserve)</span>, then raise an |
| 405 |
|
<a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li> |
| 406 |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
| 407 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
| 408 |
<ol> |
<ol> |
| 425 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 426 |
data</a>.</li> |
data</a>.</li> |
| 427 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
| 428 |
a string <code>]]></code>, then it is an |
a string <code>]]></code>, then raise an |
| 429 |
<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>.<!-- "for compatibility" --></li> |
| 430 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 431 |
any nodes, they are in |
any nodes, they are in |
| 432 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
| 435 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
| 436 |
<dd> |
<dd> |
| 437 |
<ol> |
<ol> |
| 438 |
|
<li>Raise an |
| 439 |
|
<a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li> |
| 440 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
| 441 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 442 |
data</a>.</li> |
data</a>.</li> |
| 443 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
| 444 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
| 445 |
<code>-</code>, then it is an |
<code>-</code>, then raise an |
| 446 |
<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>.<!-- |
| 447 |
|
"for compatibility" --></li> |
| 448 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 449 |
any nodes, they are in |
any nodes, they are in |
| 450 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
| 506 |
<ol> |
<ol> |
| 507 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 508 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 509 |
|
<li>Follow the following substeps: |
| 510 |
|
<ol> |
| 511 |
|
<li>If <code>ownerDocument</code> attribute of <var>n</var> is |
| 512 |
|
<code>null</code>, then abort these substeps.</li> |
| 513 |
|
<li>If <code>documentElement</code> attribute of the node |
| 514 |
|
set to <code>ownerDocument</code> attribute of <var>n</var> is |
| 515 |
|
<code>null</code>, then abort these substeps.</li> |
| 516 |
|
<li>If <code>nodeName</code> attribute of the node set to |
| 517 |
|
<code>documentElement</code> attribute of the node set to |
| 518 |
|
<code>ownerDocument</code> attribute of <var>n</var> is |
| 519 |
|
different from <code>nodeName</code> of <var>n</var>, |
| 520 |
|
then raise an |
| 521 |
|
<a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li> |
| 522 |
|
</ol> |
| 523 |
|
</li> |
| 524 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
| 525 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
| 526 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
| 650 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
| 651 |
<dd> |
<dd> |
| 652 |
<ol> |
<ol> |
| 653 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li>If the <code>target</code> attribute value matches to the string |
| 654 |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
<code>xml</code> in any case combination, then raise a |
|
<li>If the <code>target</code> attribute value matches to |
|
|
<code>XML</code> case-insensitively, then it is a |
|
| 655 |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
| 656 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li>Otherwise, <a href="#algorithm-to-validate-a-ncname">validate the |
| 657 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
| 658 |
|
<li>Then, |
| 659 |
|
<a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML character data">validate |
| 660 |
|
the <code>data</code> attribute value as an <abbr>XML</abbr> character |
| 661 |
data</a>.</li> |
data</a>.</li> |
| 662 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains a string |
| 663 |
a string <code>?></code>, or starts with either |
<code>?></code>, then raise a |
| 664 |
<code class=char>U+0009</code>, <code class=char>U+000A</code>, |
<a href="#xml-well-formedness-error" id=wfe-pi-pic><code>xml-well-formedness-error</code></a>.</li> |
| 665 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
<li>If the <code>data</code> attribute value starts with either |
| 666 |
character, then it is a |
<code class=char>U+0009</code> <code class=charname>CHARACTER |
| 667 |
<a href="#round-trip-error" id=rte-pi-data><code>round-trip-error</code></a>.</li> |
TABULATION</code>, <code class=char>U+000A</code> <code class=charname>LINE |
| 668 |
|
FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE |
| 669 |
|
RETURN</code>, or <code class=char>U+0020</code> |
| 670 |
|
<code class=charname>SPACE</code> character, then raise a |
| 671 |
|
<a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li> |
| 672 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 673 |
any nodes, they are in |
any nodes, then raise an |
| 674 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
| 675 |
</ol> |
</ol> |
| 676 |
</dd> |
</dd> |
| 689 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
| 690 |
</dl> |
</dl> |
| 691 |
|
|
|
<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> |
|
|
|
|
| 692 |
</div> |
</div> |
| 693 |
|
|
| 694 |
<div class="section" id="examples"> |
</div> |
|
<h2>Examples</h2> |
|
|
|
|
|
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
|
| 695 |
|
|
| 696 |
<div class="ed issue"> |
<div id=classes class=section> |
| 697 |
|
<h2>Character Classes</h2> |
| 698 |
|
|
| 699 |
<div class="example figure block"> |
<p>This section defines a couple of character classes. |
| 700 |
<div class="caption">...</div> |
These classes are referred to by algorithms specified above.</p> |
| 701 |
|
|
| 702 |
<pre><code>...</code></pre> |
<p>Character class <dfn id=class-Char10><code>Char10</code></dfn> |
| 703 |
|
contains the following characters:</p> |
| 704 |
|
<ul> |
| 705 |
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
| 706 |
|
TABULATION</code></li> |
| 707 |
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
| 708 |
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
| 709 |
|
RETURN</code></li> |
| 710 |
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code> |
| 711 |
|
.. <code class=char>U+D7FF</code></li> |
| 712 |
|
<li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code> |
| 713 |
|
<code class=charname>REPLACEMENT CHARACTER</code></li> |
| 714 |
|
<li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li> |
| 715 |
|
</ul> |
| 716 |
|
<div class="note memo"> |
| 717 |
|
<p>This character class contains all characters allowed in the production rule |
| 718 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a> |
| 719 |
|
of <abbr>XML</abbr> 1.0 |
| 720 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
| 721 |
</div> |
</div> |
| 722 |
|
|
| 723 |
|
<p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn> |
| 724 |
|
contains the following characters:</p> |
| 725 |
|
<ul> |
| 726 |
|
<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> |
| 727 |
|
</ul> |
| 728 |
|
|
| 729 |
|
<p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn> |
| 730 |
|
contains the following characters:</p> |
| 731 |
|
<ul> |
| 732 |
|
<li><code class=char>U+007F</code> <code class=charname>DELETE</code> .. |
| 733 |
|
<code class=char>U+0084</code> <code class=charname>INDEX</code></li> |
| 734 |
|
<li><code class=char>U+0086</code> <code class=charname>START OF SELECTED |
| 735 |
|
AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION |
| 736 |
|
PROGRAM COMMAND</code></li> |
| 737 |
|
<li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li> |
| 738 |
|
<li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li> |
| 739 |
|
<li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li> |
| 740 |
|
<li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li> |
| 741 |
|
<li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li> |
| 742 |
|
<li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li> |
| 743 |
|
<li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li> |
| 744 |
|
<li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li> |
| 745 |
|
<li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li> |
| 746 |
|
<li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li> |
| 747 |
|
<li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li> |
| 748 |
|
<li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li> |
| 749 |
|
<li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li> |
| 750 |
|
<li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li> |
| 751 |
|
<li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li> |
| 752 |
|
<li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li> |
| 753 |
|
<li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li> |
| 754 |
|
</ul> |
| 755 |
|
<div class="note memo"> |
| 756 |
|
<p>This character class contains the characters listed in the Note in |
| 757 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a> |
| 758 |
|
of <abbr>XML</abbr> 1.0 |
| 759 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>, |
| 760 |
|
as amended by |
| 761 |
|
<a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p> |
| 762 |
</div> |
</div> |
| 763 |
|
|
| 764 |
</div> |
</div> |