| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en" class="formal-specification status-work-in-progress"> |
| 3 |
<head> |
| 4 |
<title>manakai's XML Conformance Checking</title> |
| 5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
| 6 |
<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> |
| 17 |
<body class="has-abstract"> |
| 18 |
|
| 19 |
<div class="header"> |
| 20 |
<h1>manakai's XML Conformance Checking</h1> |
| 21 |
<h2>Working Draft <time datetime=2007-11-12>12 November 2007</time></h2> |
| 22 |
|
| 23 |
<dl class="versions-uri"> |
| 24 |
<dt>This Version</dt> |
| 25 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work" |
| 26 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>></code></dd> |
| 27 |
<dt>Latest Version</dt> |
| 28 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc" |
| 29 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc</a>></code></dd> |
| 30 |
<dt>Latest Working Draft</dt> |
| 31 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work" |
| 32 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>></code></dd> |
| 33 |
<!-- <dt>Previous Version</dt> --> |
| 34 |
<dt>Version History</dt> |
| 35 |
<dd><code class=URI><<a href="http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html">http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html</a>></code></dd> |
| 36 |
</dl> |
| 37 |
<dl class="authors" id="author"> |
| 38 |
<dt>Author</dt> |
| 39 |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
| 40 |
lang=ja>Wakaba</a> |
| 41 |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
| 42 |
>w@suika.fam.cx</a>></code></dd> |
| 43 |
</dl> |
| 44 |
|
| 45 |
<p class="copyright" lang="en">© <time>2007</time> <a |
| 46 |
href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
| 47 |
Permission is granted to copy, distribute and/or modify this document |
| 48 |
under the terms of the <a rel="license" |
| 49 |
href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>, |
| 50 |
Version 1.2 |
| 51 |
or any later version published by the <a |
| 52 |
href="http://www.fsf.org/">Free Software Foundation</a>; |
| 53 |
with no Invariant Sections, no Front$B!>(BCover Texts, and no Back$B!>(BCover |
| 54 |
Texts. A copy of the license is |
| 55 |
available at <code class="URI"><<a |
| 56 |
href="http://www.gnu.org/copyleft/fdl.html" |
| 57 |
rel="license">http://www.gnu.org/copyleft/fdl.html</a>></code>.</p> |
| 58 |
</div> |
| 59 |
|
| 60 |
<div id="abstract" class="section"> |
| 61 |
<h2>Abstract</h2> |
| 62 |
|
| 63 |
<div class="ed issue">...</div> |
| 64 |
|
| 65 |
</div> |
| 66 |
|
| 67 |
<div id="status" class="section"> |
| 68 |
<h2>Status of This Document</h2> |
| 69 |
|
| 70 |
<p class=section-info><em>This section describes the status of this document |
| 71 |
at the time of its publication. Other documents |
| 72 |
might supersede this document.</em></p> |
| 73 |
|
| 74 |
<p>This document is a working draft, produced as part of the |
| 75 |
<a href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a> |
| 76 |
subproject of the |
| 77 |
<a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a> |
| 78 |
project. It might be updated, replaced, or obsoleted by |
| 79 |
other documents at any time. It is inappropriate to |
| 80 |
cite this document as other than <q>work in progress</q>.</p> |
| 81 |
|
| 82 |
<p>Comments on this document are welcome and |
| 83 |
may be sent to the <a href="#author">author</a>.</p> |
| 84 |
|
| 85 |
<p>Translations of thie document might be available. |
| 86 |
The English version of the document is the only |
| 87 |
normative version.</p> |
| 88 |
</div> |
| 89 |
|
| 90 |
<div id="introduction" class="section"> |
| 91 |
<h2>Introduction</h2> |
| 92 |
|
| 93 |
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
| 94 |
|
| 95 |
<div class="issue ed">...</div> |
| 96 |
|
| 97 |
|
| 98 |
</div> |
| 99 |
|
| 100 |
<div class="section" id="terminology"> |
| 101 |
<h2>Terminology</h2> |
| 102 |
|
| 103 |
<p>The key words <q><em class="rfc2119">MUST</em></q>, |
| 104 |
<q><em class="rfc2119">MUST NOT</em></q>, |
| 105 |
<q><em class="rfc2119">SHOULD</em></q>, |
| 106 |
<q><em class="rfc2119">SHOULD NOT</em></q>, and |
| 107 |
<q><em class=rfc2119>MAY</em></q> in this |
| 108 |
document are to be interpreted as described in |
| 109 |
<a href="urn:ietf:rfc:2119"><abbr title="Request for Comments">RFC</abbr> |
| 110 |
2119</a> |
| 111 |
<cite class="bibref normative">[<a href="#ref-KEYWORDS">KEYWORDS</a>]</cite>.</p> |
| 112 |
|
| 113 |
<!-- Strictly speaking the paragraph below is not part of terminology. --> |
| 114 |
<p>All examples and notes in this specification are non$B!>(Bnormative, |
| 115 |
as are all sections explicitly marked non$B!>(Bnormative. Everything |
| 116 |
else in this specification is normative.</p> |
| 117 |
|
| 118 |
<p><span class=ed>Algorithm is normative but non-normative</span>. |
| 119 |
In addition, the order in which <a href="#errors">errors</a> are |
| 120 |
raised is undefined.</p> |
| 121 |
</div> |
| 122 |
|
| 123 |
<div class="section"> |
| 124 |
<h2 class=ed>Algorithms</h2> |
| 125 |
|
| 126 |
<p>The following algorithms and definitions are applied to |
| 127 |
<abbr>XML</abbr> documents; especially, they are not applied |
| 128 |
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
| 129 |
|
| 130 |
<p class=ed>If a <code>Document</code> node has no |
| 131 |
xml-well-formedness-error, entity-error, and unknown-error, |
| 132 |
then it is well-formed. If a well-formed <code>Document</code> |
| 133 |
node has no xml-validity-error, it is valid.</p> |
| 134 |
|
| 135 |
<div class="note memo"> |
| 136 |
<p>A well$B!>(Bformed <code>Document</code> can be safely serialized |
| 137 |
into a well$B!>(Bformed XML document. A valid <code>Document</code> |
| 138 |
can be easily serialized into a valid XML document.</p> |
| 139 |
</div> |
| 140 |
|
| 141 |
<p>Errors are classified into these |
| 142 |
<dfn id=error-category title="error category">error categories</dfn>:</p> |
| 143 |
|
| 144 |
<dl id=errors> |
| 145 |
<dt><dfn id=entity-error><code>entity-error</code></dfn></dt> |
| 146 |
<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> |
| 158 |
<dd class=ed>@@</dd> |
| 159 |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
| 160 |
<dd class=ed>@@</dd> |
| 161 |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
| 162 |
<dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0 |
| 163 |
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
| 164 |
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> / |
| 165 |
<abbr>XML</abbr> 1.1 |
| 166 |
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
| 167 |
<a href="@@/#dt-error">error</a>) |
| 168 |
that is not classified to any other <a href="#error-category">error |
| 169 |
category</a>.</dd> |
| 170 |
<dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt> |
| 171 |
<dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0 |
| 172 |
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
| 173 |
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal |
| 174 |
error</a> / <abbr>XML</abbr> 1.1 |
| 175 |
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
| 176 |
<a href="@@/#dt-fatal">fatal error</a>) |
| 177 |
that is not classified to any other <a href="#error-category">error |
| 178 |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
| 179 |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
| 180 |
<dd>A violation of validity constraint in XML document.</dd> |
| 181 |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
| 182 |
<dd><p>If an <code>xml-well-formedness-error</code> is raised, |
| 183 |
it would not be possible to generate an XML serialization that |
| 184 |
would match to the appropriate production rule and that would not |
| 185 |
violate to any well$B!>(Bformedness constraint in XML |
| 186 |
specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>, |
| 187 |
<a href="#ref-XML11">XML11</a>]</cite>.</p></dd> |
| 188 |
</dl> |
| 189 |
|
| 190 |
<div class=ed><p>@@ TODO: #dt-atuseroption at user option |
| 191 |
(MAY or MUST), #dt-compat for compatibility, |
| 192 |
#dt-interop for interoperability</p></div> |
| 193 |
|
| 194 |
<p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is |
| 195 |
the <abbr>XML</abbr> version of the document to which the node belongs. |
| 196 |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
| 197 |
of the document is the value of the <code>xmlVersion</code> |
| 198 |
attribute. For a <code>DocumentType</code> node whose |
| 199 |
<code>ownerDocument</code> is set to <code>null</code>, |
| 200 |
the <abbr>XML</abbr> version of the document is <code>1.0</code>. |
| 201 |
For any other node, the <abbr>XML</abbr> version of the document |
| 202 |
is that of the <code>Document</code> node contained in the |
| 203 |
<code>ownerDocument</code> attribute of the node.</p> |
| 204 |
|
| 205 |
<p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to |
| 206 |
check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as |
| 207 |
following:</p> |
| 208 |
<dl class=switch> |
| 209 |
<dt>If <var>n</var> is an <code>Attr</code> node</dt> |
| 210 |
<dd> |
| 211 |
<ol> |
| 212 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 213 |
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
| 214 |
<li>If the <code>prefix</code> attribute value is different from |
| 215 |
<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> |
| 217 |
<li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
| 218 |
<code>childNodes</code> list of <var>n</var>, |
| 219 |
<ol> |
| 220 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
| 221 |
<code>Text</code> or <code>EntityReference</code> node, then it is an |
| 222 |
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
| 223 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 224 |
<code>EntityReference</code> node, then it is an |
| 225 |
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
| 226 |
<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>, |
| 231 |
<code>manakaiAttributeType</code></li> |
| 232 |
</ol> |
| 233 |
</dd> |
| 234 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
| 235 |
<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> |
| 254 |
<dd> |
| 255 |
<ol> |
| 256 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
| 257 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 258 |
data</a>.</li> |
| 259 |
<li>If the <code>data</code> attribute value contains |
| 260 |
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> |
| 262 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 263 |
any nodes, they are in |
| 264 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
| 265 |
</ol> |
| 266 |
</dd> |
| 267 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
| 268 |
<dd> |
| 269 |
<ol> |
| 270 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
| 271 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 272 |
data</a>.</li> |
| 273 |
<li>If the <code>data</code> attribute value contains |
| 274 |
a string <code>--</code>, or if it ends with a character |
| 275 |
<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> |
| 277 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 278 |
any nodes, they are in |
| 279 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
| 280 |
</ol> |
| 281 |
</dd> |
| 282 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
| 283 |
<dd> |
| 284 |
<ol> |
| 285 |
<li>If <a href="#xml-version"><abbr>XML</abbr> version</a> of <var>n</var> |
| 286 |
is different from <code>1.0</code> or <code>1.1</code>, |
| 287 |
then it is an <code class=ed>unknown-error?</code>.</li> |
| 288 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
| 289 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
| 290 |
<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> |
| 292 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
| 293 |
consist of zero or more <code>Comment</code> and/or |
| 294 |
<code>ProcessingInstruction</code> nodes, followed by |
| 295 |
an optional <code>DocumentType</code> node, followed |
| 296 |
by zero or more <code>Comment</code> and/or |
| 297 |
<code>ProcessingInstruction</code> nodes, followed by |
| 298 |
an <code>Element</code> node, followed |
| 299 |
by zero or more <code>Comment</code> and/or |
| 300 |
<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> |
| 302 |
<li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 303 |
in the <code>childNodes</code> list of <var>n</var>, |
| 304 |
<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> |
| 311 |
</ol> |
| 312 |
</dd> |
| 313 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
| 314 |
<dd> |
| 315 |
<ol> |
| 316 |
<li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 317 |
in the <code>childNodes</code> list of <var>n</var>, |
| 318 |
<ol> |
| 319 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 320 |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
| 321 |
<code>Comment</code>, <code>ProcessingInstruction</code>, or |
| 322 |
<code>EntityReference</code> node, then it is an |
| 323 |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
| 324 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 325 |
<code>EntityReference</code> node, then it is an |
| 326 |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
| 327 |
<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> |
| 332 |
</dd> |
| 333 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
| 334 |
<dd> |
| 335 |
<ol> |
| 336 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 337 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 338 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
| 339 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
| 340 |
<li>If the <code>systemId</code> attribute value contains |
| 341 |
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> |
| 343 |
<!-- publicId = non-null and systemId = null --> |
| 344 |
<li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 345 |
in the <code>childNodes</code> list of <var>n</var>, |
| 346 |
<ol> |
| 347 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
| 348 |
<code>ProcessingInstruction</code> node, then it is an |
| 349 |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
| 350 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
| 351 |
<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>, |
| 356 |
<code>elementTypes</code>, externally declared?</li> |
| 357 |
</ol> |
| 358 |
</dd> |
| 359 |
<dt>If <var>n</var> is an <code>Element</code> node</dt> |
| 360 |
<dd> |
| 361 |
<ol> |
| 362 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 363 |
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
| 364 |
<li>If the <code>prefix</code> attribute value is different from |
| 365 |
<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> |
| 367 |
<li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 368 |
in the <code>childNodes</code> list of <var>n</var>, |
| 369 |
<ol> |
| 370 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 371 |
<code>Element</code>, |
| 372 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
| 373 |
<code>ProcessingInstruction</code>, or |
| 374 |
<code>EntityReference</code> node, then it is an |
| 375 |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
| 376 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 377 |
<code>EntityReference</code> node, then it is an |
| 378 |
<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> |
| 384 |
</dd> |
| 385 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
| 386 |
<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> |
| 395 |
<dd> |
| 396 |
<ol> |
| 397 |
<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 |
| 399 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 400 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
| 401 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
| 402 |
<li>If the <code>systemId</code> attribute value contains |
| 403 |
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> |
| 405 |
<!-- publicId = non-null and systemId = null --> |
| 406 |
<li class=ed>@@ <code>notationName</code></li> |
| 407 |
<li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 408 |
in the <code>childNodes</code> list of <var>n</var>, |
| 409 |
<ol> |
| 410 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 411 |
<code>Element</code>, |
| 412 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
| 413 |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
| 414 |
node, then it is an |
| 415 |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
| 416 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
| 417 |
<code>EntityReference</code> node, then it is an |
| 418 |
<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> |
| 424 |
</dd> |
| 425 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
| 426 |
<dd> |
| 427 |
<ol> |
| 428 |
<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 |
| 430 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 431 |
<li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn> |
| 432 |
in the <code>childNodes</code> list of <var>n</var>, |
| 433 |
<ol> |
| 434 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 435 |
<code>Element</code>, |
| 436 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
| 437 |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
| 438 |
node, then it is an |
| 439 |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
| 440 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
| 441 |
<code>EntityReference</code> node, then it is an |
| 442 |
<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> |
| 448 |
</dd> |
| 449 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
| 450 |
<dd> |
| 451 |
<ol> |
| 452 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 453 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
| 454 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
| 455 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
| 456 |
<li>If the <code>systemId</code> attribute value contains |
| 457 |
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> |
| 459 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 460 |
any nodes, they are in |
| 461 |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li> |
| 462 |
</ol> |
| 463 |
</dd> |
| 464 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
| 465 |
<dd> |
| 466 |
<ol> |
| 467 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
| 468 |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
| 469 |
<li>If the <code>target</code> attribute value matches to |
| 470 |
<code>XML</code> case-insensitively, then it is a |
| 471 |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
| 472 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
| 473 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 474 |
data</a>.</li> |
| 475 |
<li>If the <code>data</code> attribute value contains |
| 476 |
a string <code>?></code>, or starts with either |
| 477 |
<code class=char>U+0009</code>, <code class=char>U+000A</code>, |
| 478 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
| 479 |
character, then it is a |
| 480 |
<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 |
| 482 |
any nodes, they are in |
| 483 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
| 484 |
</ol> |
| 485 |
</dd> |
| 486 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
| 487 |
<dd> |
| 488 |
<ol> |
| 489 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
| 490 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
| 491 |
data</a>.</li> |
| 492 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
| 493 |
any nodes, they are in |
| 494 |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li> |
| 495 |
</ol> |
| 496 |
</dd> |
| 497 |
<dt>Otherwise</dt> |
| 498 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
| 499 |
</dl> |
| 500 |
|
| 501 |
<p>The algorithm |
| 502 |
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
| 503 |
validate an <abbr>XML</abbr> character data |
| 504 |
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
| 505 |
<ol> |
| 506 |
<li class=ed>@@</li> |
| 507 |
</ol> |
| 508 |
|
| 509 |
<p>The algorithm |
| 510 |
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
| 511 |
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
| 512 |
as following:</p> |
| 513 |
<ol> |
| 514 |
<li class=ed>@@</li> |
| 515 |
</ol> |
| 516 |
|
| 517 |
<p>The algorithm |
| 518 |
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
| 519 |
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
| 520 |
is defined as following:</p> |
| 521 |
<ol> |
| 522 |
<li class=ed>@@</li> |
| 523 |
</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> |
| 550 |
|
| 551 |
<div class="section" id="examples"> |
| 552 |
<h2>Examples</h2> |
| 553 |
|
| 554 |
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
| 555 |
|
| 556 |
<div class="ed issue"> |
| 557 |
|
| 558 |
<div class="example figure block"> |
| 559 |
<div class="caption">...</div> |
| 560 |
|
| 561 |
<pre><code>...</code></pre> |
| 562 |
</div> |
| 563 |
|
| 564 |
</div> |
| 565 |
|
| 566 |
</div> |
| 567 |
|
| 568 |
<div id="references" class="section reference"> |
| 569 |
<h2>References</h2> |
| 570 |
|
| 571 |
<div id="normative-references" class="section normative reference"> |
| 572 |
<h3>Normative References</h3> |
| 573 |
|
| 574 |
<dl> |
| 575 |
<dt id=ref-DOM3CORE>DOM3CORE</dt> |
| 576 |
<dd class=ed>@@ W3C DOM Level 3 Core</dd> |
| 577 |
<dt id=ref-DOMDTDEF>DOMDTDEF</dt> |
| 578 |
<dd class=ed>@@ manakai's extension to DOM for document type definitions</dd> |
| 579 |
<dt id="ref-KEYWORDS">KEYWORDS</dt> |
| 580 |
<dd><cite><a href="urn:ietf:rfc:2119">Key words for use in |
| 581 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
| 582 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
| 583 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
| 584 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
| 585 |
<time datetime=1997-03>March 1997</time>. |
| 586 |
<em>This</em> version of the specification is referenced.</dd> |
| 587 |
<dt id=ref-INFOSET>INFOSET</dt> |
| 588 |
<dd class=ed>@@</dd> |
| 589 |
<dt id=ref-XML10">XML10</dt> |
| 590 |
<dd><cite><a href="http://www.w3.org/TR/2006/REC-xml-20060816">Extensible |
| 591 |
Markup Language (<abbr>XML</abbr>) 1.0 (Fourth Edition)</a></cite>, |
| 592 |
<abbr>W3C</abbr> Recommendation, <time datetime=2006-08-16>16 August |
| 593 |
2006</time>, edited in place <time datetime=2006-09-29>29 September |
| 594 |
2006</time>. Tje latest version of the specification is available at |
| 595 |
<code class=uri><<a href="http://www.w3.org/TR/xml">http://www.w3.org/TR/xml</a>></code>. |
| 596 |
<em>This</em> version of the specification is referenced.</dd> |
| 597 |
<dt id=ref-XML11>XML11</dt> |
| 598 |
<dd class=ed>@@</dd> |
| 599 |
</dl> |
| 600 |
</div> |
| 601 |
|
| 602 |
<div id="informative-references" class="section informative reference"> |
| 603 |
<h3>Non$B!>(Bnormative References</h3> |
| 604 |
|
| 605 |
<dl class=ed> |
| 606 |
<dt id=ref-CSS>CSS</dt> |
| 607 |
<dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading |
| 608 |
Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1) |
| 609 |
Specification</a></cite>, |
| 610 |
<abbr title="World Wide Web Consortium">W3C</abbr> Candidate |
| 611 |
Recommendation, <time datetime=2007-07-19>19 July 2007</time>. |
| 612 |
Work in progress. The latest version of the specification is |
| 613 |
available at |
| 614 |
<code class=URI><<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd> |
| 615 |
<dt id=ref-CSSOM>CSSOM</dt> |
| 616 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/csswg/cssom/Overview.html?rev=1.55&content-type=text/html;%20charset=utf-8">Cascading |
| 617 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
| 618 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
| 619 |
<time datetime=2007-06-18>18 June 2007</time>. Work in progress. |
| 620 |
The latest Editor's Draft of the specification is available at |
| 621 |
<code class=URI><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
| 622 |
<dt id=ref-HTML5>HTML5</dt> |
| 623 |
<dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>, |
| 624 |
<abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr> |
| 625 |
Working Draft. Work in progress.</dd> |
| 626 |
<dt id=ref-SAPI>SAPI</dt> |
| 627 |
<dd><cite><a href="http://dev.w3.org/cvsweb/~checkout~/2006/webapi/selectors-api/Overview.html?rev=1.28&content-type=text/html;%20charset=utf-8">Selectors <abbr>API</abbr></a></cite>, |
| 628 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
| 629 |
<time datetime=2007-08-29>29 August 2007</time>. Work in progress. |
| 630 |
The latest Editor's Draft of the specification is available at |
| 631 |
<code class=URI><<a href="http://dev.w3.org/2006/webapi/selectors-api/Overview.html">http://dev.w3.org/2006/webapi/selectors-api/Overview.html</a>></code>. |
| 632 |
The latest published version of the specification is available at |
| 633 |
<code class=URI><<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd> |
| 634 |
<dt id=XBL2>XBL2</dt> |
| 635 |
<dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr> |
| 636 |
2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>. |
| 637 |
Work in progress. The latest |
| 638 |
<abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished |
| 639 |
version of the specification is available at |
| 640 |
<code class=URI><<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd> |
| 641 |
<dt id=ref-XML5>XML5</dt> |
| 642 |
<dd class=ed>@@</dd> |
| 643 |
</dl> |
| 644 |
</div> |
| 645 |
|
| 646 |
</div> |
| 647 |
|
| 648 |
</body> |
| 649 |
</html> |