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-13>13 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" id=checking-dom> |
124 |
<h2>Checking <abbr>DOM</abbr></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 |
<div class=section id=error-categories> |
131 |
<h3>Error Classification</h3> |
132 |
|
133 |
<p class=ed>If a <code>Document</code> node has no |
134 |
xml-well-formedness-error, entity-error, and unknown-error, |
135 |
then it is well-formed. If a well-formed <code>Document</code> |
136 |
node has no xml-validity-error, it is valid.</p> |
137 |
|
138 |
<div class="note memo"> |
139 |
<p>A well$B!>(Bformed <code>Document</code> can be safely serialized |
140 |
into a well$B!>(Bformed XML document. A valid <code>Document</code> |
141 |
can be easily serialized into a valid XML document.</p> |
142 |
</div> |
143 |
|
144 |
<p>Errors are classified into these |
145 |
<dfn id=error-category title="error category">error categories</dfn>:</p> |
146 |
|
147 |
<dl id=errors> |
148 |
<dt><dfn id=entity-error><code>entity-error</code></dfn></dt> |
149 |
<dd> |
150 |
<p class=ed>@@</p> |
151 |
<div class="note memo"> |
152 |
<p>This <span class=ed>algorithm</span> does not support |
153 |
<abbr>DOM</abbr> tree with one or more <code>EntityReference</code> |
154 |
nodes. It is expected that any entity references are expanded |
155 |
at the parse time and any unexpandable entity references |
156 |
make parse time errors raised so that never result in |
157 |
<abbr>DOM</abbr> tree with <code>EntityReference</code> nodes.</p> |
158 |
</div> |
159 |
</dd> |
160 |
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
161 |
<dd class=ed>@@</dd> |
162 |
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
163 |
<dd class=ed>@@</dd> |
164 |
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
165 |
<dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0 |
166 |
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
167 |
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> / |
168 |
<abbr>XML</abbr> 1.1 |
169 |
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
170 |
<a href="@@/#dt-error">error</a>) |
171 |
that is not classified to any other <a href="#error-category">error |
172 |
category</a>.</dd> |
173 |
<dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt> |
174 |
<dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0 |
175 |
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
176 |
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal |
177 |
error</a> / <abbr>XML</abbr> 1.1 |
178 |
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
179 |
<a href="@@/#dt-fatal">fatal error</a>) |
180 |
that is not classified to any other <a href="#error-category">error |
181 |
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
182 |
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
183 |
<dd>A violation of validity constraint in XML document.</dd> |
184 |
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
185 |
<dd><p>If an <code>xml-well-formedness-error</code> is raised, |
186 |
it would not be possible to generate an XML serialization that |
187 |
would match to the appropriate production rule and that would not |
188 |
violate to any well$B!>(Bformedness constraint in XML |
189 |
specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>, |
190 |
<a href="#ref-XML11">XML11</a>]</cite>.</p></dd> |
191 |
</dl> |
192 |
|
193 |
<div class=ed><p>@@ TODO: #dt-atuseroption at user option |
194 |
(MAY or MUST), #dt-compat for compatibility, |
195 |
#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 |
203 |
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 |
205 |
of the document is the value of the <code>xmlVersion</code> |
206 |
attribute of the node. For a <code>DocumentType</code> node whose |
207 |
<code>ownerDocument</code> attribute is set to <code>null</code>, |
208 |
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 |
211 |
is that of the <code>Document</code> node contained in the |
212 |
<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 |
220 |
check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as |
221 |
following:</p> |
222 |
<dl class=switch> |
223 |
<dt>If <var>n</var> is an <code>Attr</code> node</dt> |
224 |
<dd> |
225 |
<ol> |
226 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
227 |
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
228 |
<li>If the <code>prefix</code> attribute value is different from |
229 |
<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> |
231 |
<li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
232 |
<code>childNodes</code> list of <var>n</var>, |
233 |
<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>, |
245 |
<code>manakaiAttributeType</code></li> |
246 |
</ol> |
247 |
</dd> |
248 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
249 |
<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> |
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>, then it is an |
275 |
<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 |
277 |
any nodes, they are in |
278 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
279 |
</ol> |
280 |
</dd> |
281 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
282 |
<dd> |
283 |
<ol> |
284 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
285 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
286 |
data</a>.</li> |
287 |
<li>If the <code>data</code> attribute value contains |
288 |
a string <code>--</code>, or if it ends with a character |
289 |
<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> |
291 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
292 |
any nodes, they are in |
293 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
294 |
</ol> |
295 |
</dd> |
296 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
297 |
<dd> |
298 |
<ol> |
299 |
<li>If <a href="#xml-version"><abbr>XML</abbr> version</a> of <var>n</var> |
300 |
is different from <code>1.0</code> or <code>1.1</code>, |
301 |
then it is an <code class=ed>unknown-error?</code>.</li> |
302 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
303 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
304 |
<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> |
306 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
307 |
consist of zero or more <code>Comment</code> and/or |
308 |
<code>ProcessingInstruction</code> nodes, followed by |
309 |
an optional <code>DocumentType</code> node, followed |
310 |
by zero or more <code>Comment</code> and/or |
311 |
<code>ProcessingInstruction</code> nodes, followed by |
312 |
an <code>Element</code> node, followed |
313 |
by zero or more <code>Comment</code> and/or |
314 |
<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> |
316 |
<li>For each node <dfn id=var-document-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>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> |
325 |
</ol> |
326 |
</dd> |
327 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
328 |
<dd> |
329 |
<ol> |
330 |
<li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn> |
331 |
in the <code>childNodes</code> list of <var>n</var>, |
332 |
<ol> |
333 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
334 |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
335 |
<code>Comment</code>, <code>ProcessingInstruction</code>, or |
336 |
<code>EntityReference</code> node, then it is an |
337 |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
338 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
339 |
<code>EntityReference</code> node, then it is an |
340 |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
341 |
<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> |
346 |
</dd> |
347 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
348 |
<dd> |
349 |
<ol> |
350 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
351 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
352 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
353 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
354 |
<li>If the <code>systemId</code> attribute value contains |
355 |
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> |
357 |
<!-- publicId = non-null and systemId = null --> |
358 |
<li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn> |
359 |
in the <code>childNodes</code> list of <var>n</var>, |
360 |
<ol> |
361 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
362 |
<code>ProcessingInstruction</code> node, then it is an |
363 |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
364 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
365 |
<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>, |
370 |
<code>elementTypes</code>, externally declared?</li> |
371 |
</ol> |
372 |
</dd> |
373 |
<dt>If <var>n</var> is an <code>Element</code> node</dt> |
374 |
<dd> |
375 |
<ol> |
376 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
377 |
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
378 |
<li>If the <code>prefix</code> attribute value is different from |
379 |
<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> |
381 |
<li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn> |
382 |
in the <code>childNodes</code> list of <var>n</var>, |
383 |
<ol> |
384 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
385 |
<code>Element</code>, |
386 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
387 |
<code>ProcessingInstruction</code>, or |
388 |
<code>EntityReference</code> node, then it is an |
389 |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
390 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
391 |
<code>EntityReference</code> node, then it is an |
392 |
<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> |
398 |
</dd> |
399 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
400 |
<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> |
409 |
<dd> |
410 |
<ol> |
411 |
<li>An <a href="#entity-error" id=ee-entity-node><code>entity-error</code></a> <span class=ed>@@ if !notationName</span>.</li> |
412 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
413 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
414 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
415 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
416 |
<li>If the <code>systemId</code> attribute value contains |
417 |
both <code>"</code> and <code>'</code> characters, it is a |
418 |
<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 --> |
420 |
<li class=ed>@@ <code>notationName</code></li> |
421 |
<li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn> |
422 |
in the <code>childNodes</code> list of <var>n</var>, |
423 |
<ol> |
424 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
425 |
<code>Element</code>, |
426 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
427 |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
428 |
node, then it is an |
429 |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
430 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
431 |
<code>EntityReference</code> node, then it is an |
432 |
<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> |
438 |
</dd> |
439 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
440 |
<dd> |
441 |
<ol> |
442 |
<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 |
444 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
445 |
<li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn> |
446 |
in the <code>childNodes</code> list of <var>n</var>, |
447 |
<ol> |
448 |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
449 |
<code>Element</code>, |
450 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
451 |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
452 |
node, then it is an |
453 |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
454 |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
455 |
<code>EntityReference</code> node, then it is an |
456 |
<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> |
462 |
</dd> |
463 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
464 |
<dd> |
465 |
<ol> |
466 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
467 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
468 |
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
469 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
470 |
<li>If the <code>systemId</code> attribute value contains |
471 |
both <code>"</code> and <code>'</code> characters, it is a |
472 |
<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 |
474 |
any nodes, they are in |
475 |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li> |
476 |
</ol> |
477 |
</dd> |
478 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
479 |
<dd> |
480 |
<ol> |
481 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
482 |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
483 |
<li>If the <code>target</code> attribute value matches to |
484 |
<code>XML</code> case-insensitively, then it is a |
485 |
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
486 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
487 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
488 |
data</a>.</li> |
489 |
<li>If the <code>data</code> attribute value contains |
490 |
a string <code>?></code>, or starts with either |
491 |
<code class=char>U+0009</code>, <code class=char>U+000A</code>, |
492 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
493 |
character, then it is a |
494 |
<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 |
496 |
any nodes, they are in |
497 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
498 |
</ol> |
499 |
</dd> |
500 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
501 |
<dd> |
502 |
<ol> |
503 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
504 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
505 |
data</a>.</li> |
506 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
507 |
any nodes, they are in |
508 |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li> |
509 |
</ol> |
510 |
</dd> |
511 |
<dt>Otherwise</dt> |
512 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
513 |
</dl> |
514 |
|
515 |
</div> |
516 |
|
517 |
<div class=section id=checking-components> |
518 |
<h3>Checking Components</h3> |
519 |
|
520 |
<p>The algorithm |
521 |
<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 |
523 |
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
524 |
<ol> |
525 |
<li class=ed>@@</li> |
526 |
</ol> |
527 |
|
528 |
<p>The algorithm |
529 |
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
530 |
<code>Name</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> is defined |
531 |
as following:</p> |
532 |
<ol> |
533 |
<li class=ed>@@</li> |
534 |
</ol> |
535 |
|
536 |
<p>The algorithm |
537 |
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
538 |
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
539 |
is defined as following:</p> |
540 |
<ol> |
541 |
<li class=ed>@@</li> |
542 |
</ol> |
543 |
|
544 |
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
545 |
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
546 |
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
547 |
<ol> |
548 |
<li>If <var>pid</var> contains any character |
549 |
that is outside of the range of <code>#x20 | #xD | #xA | |
550 |
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
551 |
then it is an |
552 |
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
553 |
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
554 |
<code class=charname>CHARACTER TABULATION</code>, |
555 |
<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> |
567 |
|
568 |
</div> |
569 |
|
570 |
</div> |
571 |
|
572 |
<div id="references" class="section reference"> |
573 |
<h2>References</h2> |
574 |
|
575 |
<div id="normative-references" class="section normative reference"> |
576 |
<h3>Normative References</h3> |
577 |
|
578 |
<dl> |
579 |
<dt id=ref-DOM3CORE>DOM3CORE</dt> |
580 |
<dd class=ed>@@ W3C DOM Level 3 Core</dd> |
581 |
<dt id=ref-DOMDTDEF>DOMDTDEF</dt> |
582 |
<dd class=ed>@@ manakai's extension to DOM for document type definitions</dd> |
583 |
<dt id="ref-KEYWORDS">KEYWORDS</dt> |
584 |
<dd><cite><a href="urn:ietf:rfc:2119">Key words for use in |
585 |
<abbr>RFCs</abbr> to Indicate Requirement Levels</a></cite>, |
586 |
<abbr title="Internet Engineering Task Force">IETF</abbr> |
587 |
<a href="urn:ietf:bcp:14"><abbr title="Best Current Practice">BCP</abbr> |
588 |
14</a>, <abbr title="Request for Comments">RFC</abbr> 2119, |
589 |
<time datetime=1997-03>March 1997</time>. |
590 |
<em>This</em> version of the specification is referenced.</dd> |
591 |
<dt id=ref-INFOSET>INFOSET</dt> |
592 |
<dd class=ed>@@</dd> |
593 |
<dt id=ref-XML10">XML10</dt> |
594 |
<dd><cite><a href="http://www.w3.org/TR/2006/REC-xml-20060816">Extensible |
595 |
Markup Language (<abbr>XML</abbr>) 1.0 (Fourth Edition)</a></cite>, |
596 |
<abbr>W3C</abbr> Recommendation, <time datetime=2006-08-16>16 August |
597 |
2006</time>, edited in place <time datetime=2006-09-29>29 September |
598 |
2006</time>. Tje latest version of the specification is available at |
599 |
<code class=uri><<a href="http://www.w3.org/TR/xml">http://www.w3.org/TR/xml</a>></code>. |
600 |
<em>This</em> version of the specification is referenced.</dd> |
601 |
<dt id=ref-XML11>XML11</dt> |
602 |
<dd class=ed>@@</dd> |
603 |
</dl> |
604 |
</div> |
605 |
|
606 |
<div id="informative-references" class="section informative reference"> |
607 |
<h3>Non$B!>(Bnormative References</h3> |
608 |
|
609 |
<dl class=ed> |
610 |
<dt id=ref-CSS>CSS</dt> |
611 |
<dd><cite><a href="http://www.w3.org/TR/2007/CR-CSS21-20070719">Cascading |
612 |
Style Sheets Level 2 Revision 1 (<abbr>CSS</abbr> 2.1) |
613 |
Specification</a></cite>, |
614 |
<abbr title="World Wide Web Consortium">W3C</abbr> Candidate |
615 |
Recommendation, <time datetime=2007-07-19>19 July 2007</time>. |
616 |
Work in progress. The latest version of the specification is |
617 |
available at |
618 |
<code class=URI><<a href="http://www.w3.org/TR/CSS21">http://www.w3.org/TR/CSS21</a>></code>.</dd> |
619 |
<dt id=ref-CSSOM>CSSOM</dt> |
620 |
<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 |
621 |
Style Sheets Object Model (<abbr>CSSOM</abbr>)</a></cite>, |
622 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
623 |
<time datetime=2007-06-18>18 June 2007</time>. Work in progress. |
624 |
The latest Editor's Draft of the specification is available at |
625 |
<code class=URI><<a href="http://dev.w3.org/csswg/cssom/Overview.html">http://dev.w3.org/csswg/cssom/Overview.html</a>></code>.</dd> |
626 |
<dt id=ref-HTML5>HTML5</dt> |
627 |
<dd><cite><a href="http://whatwg.org/html5"><abbr>HTML</abbr> 5</a></cite>, |
628 |
<abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr> |
629 |
Working Draft. Work in progress.</dd> |
630 |
<dt id=ref-SAPI>SAPI</dt> |
631 |
<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>, |
632 |
<abbr title="World Wide Web Consortium">W3C</abbr> Editor's Draft, |
633 |
<time datetime=2007-08-29>29 August 2007</time>. Work in progress. |
634 |
The latest Editor's Draft of the specification is available at |
635 |
<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>. |
636 |
The latest published version of the specification is available at |
637 |
<code class=URI><<a href="http://www.w3.org/TR/selectors-api/">http://www.w3.org/TR/selectors-api/</a>></code>.</dd> |
638 |
<dt id=XBL2>XBL2</dt> |
639 |
<dd><cite><a href="http://www.mozilla.org/projects/xbl/xbl2.html"><abbr>XBL</abbr> |
640 |
2.0</a></cite>, Mozilla.org, <time datetime=2007-03-15>15 Mar 2007</time>. |
641 |
Work in progress. The latest |
642 |
<abbr title="World Wide Web Consortium">W3C</abbr>$B!>(Bpublished |
643 |
version of the specification is available at |
644 |
<code class=URI><<a href="http://www.w3.org/TR/xbl/">http://www.w3.org/TR/xbl/</a>></code>.</dd> |
645 |
<dt id=ref-XML5>XML5</dt> |
646 |
<dd class=ed>@@</dd> |
647 |
</dl> |
648 |
</div> |
649 |
|
650 |
</div> |
651 |
|
652 |
</body> |
653 |
</html> |