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-15>15 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 |
|
<li>If an empty-element tag is used for an element which is <em>not</em> |
233 |
|
declared <code>EMPTY</code>, then raise an |
234 |
|
<a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>.</li> |
235 |
|
<li>If an empty-element tag is <em>not</em> used for an element which is |
236 |
|
declared <code>EMPTY</code>, then raise an |
237 |
|
<a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>.</li> |
238 |
|
<!-- |
239 |
|
|
240 |
|
#vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting |
241 |
|
#wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset |
242 |
|
#ExtSubset Well-formedness constraint: External Subset |
243 |
|
#PE-between-Decls Well-formedness constraint: PE Between Declarations |
244 |
|
#GIMatch Well-formedness constraint: Element Type Match |
245 |
|
#uniqattspec Well-formedness constraint: Unique Att Spec |
246 |
|
#NoExternalRefs Well-formedness constraint: No External Entity References |
247 |
|
#CleanAttrVals Well-formedness constraint: No < in Attribute Values |
248 |
|
|
249 |
|
@@ Need detailed review, but maybe should be in parsing phase |
250 |
|
|
251 |
|
#vc-check-rmd Validity constraint: Standalone Document Declaration |
252 |
|
|
253 |
|
--> |
254 |
|
</ul> |
255 |
|
</div> |
256 |
|
|
257 |
|
<div class="section" id=checking-dom> |
258 |
|
<h2>Checking <abbr>DOM</abbr></h2> |
259 |
|
|
260 |
|
<p>The following algorithms and definitions are applied to |
261 |
|
<abbr>XML</abbr> documents; especially, they are not applied |
262 |
|
to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> |
263 |
|
|
264 |
|
<div class=section id=definitions> |
265 |
|
<h3>Definitions</h3> |
266 |
|
|
267 |
<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 |
268 |
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. |
269 |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
270 |
of the document is the value of the <code>xmlVersion</code> |
of the document is the value of the <code>xmlVersion</code> |
271 |
attribute. For a <code>DocumentType</code> node whose |
attribute of the node. For a <code>DocumentType</code> node whose |
272 |
<code>ownerDocument</code> is set to <code>null</code>, |
<code>ownerDocument</code> attribute is set to <code>null</code>, |
273 |
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><!-- |
274 |
|
since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->. |
275 |
For any other node, the <abbr>XML</abbr> version of the document |
For any other node, the <abbr>XML</abbr> version of the document |
276 |
is that of the <code>Document</code> node contained in the |
is that of the <code>Document</code> node contained in the |
277 |
<code>ownerDocument</code> attribute of the node.</p> |
<code>ownerDocument</code> attribute of the node.</p> |
278 |
|
|
279 |
|
</div> |
280 |
|
|
281 |
|
|
282 |
|
<div class=section id=checking-components> |
283 |
|
<h3>Checking Components</h3> |
284 |
|
|
285 |
|
<p>The algorithm |
286 |
|
<dfn id=algorithm-to-validate-an-xml-character-data title-"to validate an XML character data">to |
287 |
|
validate an <abbr>XML</abbr> character data |
288 |
|
(<dfn id=var-s><var>s</var></dfn>)</dfn> is defined as following:</p> |
289 |
|
<ol> |
290 |
|
<li>If <var>s</var> contains a character that is <em>not</em> in |
291 |
|
the character class <a href="#class-Char10"><code>Char10</code></a>, |
292 |
|
then raise an |
293 |
|
<a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li> |
294 |
|
<li>If <var>s</var> contains a character that is in the character |
295 |
|
class <a href="#class-CompatChar10"><code>CompatChar10</code></a>, |
296 |
|
then raise an |
297 |
|
<a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li> |
298 |
|
<li>If <var>s</var> contains a character that is in the character |
299 |
|
class <a href="#class-ControlChar10"><code>ControlChar10</code></a>, |
300 |
|
then raise an |
301 |
|
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
302 |
|
<li class=ed>@@ XML 1.1 support</li> |
303 |
|
<li>If <var>s</var> contains a <code class=char>U+000D</code> |
304 |
|
<code class=charname>CARRIAGE RETURN</code> character, then |
305 |
|
raise a |
306 |
|
<a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>. |
307 |
|
<span class=ed>@@ We should not raise duplicate errors for U+000D |
308 |
|
in attribute values. In addition, we should support a mode where |
309 |
|
U+000D will be serialized as 
 (so that no round-trip-error |
310 |
|
will be raised).</span></li> |
311 |
|
</ol> |
312 |
|
|
313 |
|
<p>The algorithm |
314 |
|
<dfn id=algorithm-to-validate-a-name title="to validate a Name">to validate a |
315 |
|
<code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn> is defined |
316 |
|
as following:</p> |
317 |
|
<ol> |
318 |
|
<li>If <var>s</var> begins with the string <code>xml</code> (in any |
319 |
|
case combination), then raise an |
320 |
|
<a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>. |
321 |
|
<span class=ed>@@ except for attribute names <code>xml:lang</code>, |
322 |
|
<code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>, |
323 |
|
<code>xmlns</code>, <code>xmlns:<var>*</var></code>, |
324 |
|
pi name <code>xml-stylesheet</code>.</span><!-- |
325 |
|
"names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification.": |
326 |
|
xml:base and xml:id specifications violate to this sentense! |
327 |
|
--></li> |
328 |
|
<!-- COLON in Name is a lowercase "should not" in a Note of [XML10], |
329 |
|
[XML11]. --> |
330 |
|
<li class=ed>@@</li> |
331 |
|
</ol> |
332 |
|
|
333 |
|
<p>The algorithm |
334 |
|
<dfn id=algorithm-to-validate-a-ncname title="to validate an NCName">to |
335 |
|
validate an <code>NCName</code> (<dfn id=var-name><var>name</var></dfn>)</dfn> |
336 |
|
is defined as following:</p> |
337 |
|
<ol> |
338 |
|
<li class=ed>@@</li> |
339 |
|
</ol> |
340 |
|
|
341 |
|
<p>To <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate |
342 |
|
a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the |
343 |
|
algorithm below <em class=rfc2119>MUST</em> be used:</p> |
344 |
|
<ol> |
345 |
|
<li>If <var>pid</var> contains any character |
346 |
|
that is outside of the range of <code>#x20 | #xD | #xA | |
347 |
|
[a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]</code><!-- @@ TODO: formal def -->, |
348 |
|
then it is an |
349 |
|
<a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li> |
350 |
|
<li>If <var>pid</var> contains one of <code class=char>U+0009</code> |
351 |
|
<code class=charname>CHARACTER TABULATION</code>, |
352 |
|
<code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>, |
353 |
|
and <code class=char>U+000D</code> <code class=charname>LINE FEED</code> |
354 |
|
characters, if the first character of <var>pid</var> is |
355 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character, |
356 |
|
if the last character of <var>pid</var> is <code class=char>U+0020</code> |
357 |
|
<code class=charname>SPACE</code> character, or if there is a |
358 |
|
<code class=char>U+0020</code> <code class=charname>SPACE</code> character |
359 |
|
immediately followed by another <code class=char>U+0020</code> |
360 |
|
<code class=charname>SPACE</code> character in <var>pid</var>, then it is a |
361 |
|
<a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.</li> |
362 |
|
<li class=ed>@@ Should we check formal-public-identifierness?</li> |
363 |
|
</ol> |
364 |
|
|
365 |
|
</div> |
366 |
|
|
367 |
|
<div class=section id=checking-node> |
368 |
|
<h3>Checking <code>Node</code></h3> |
369 |
|
|
370 |
<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 |
371 |
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 |
372 |
following:</p> |
following:</p> |
379 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
380 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
381 |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
382 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
|
a node which is <em>not</em> <code>Text</code> or |
|
|
<code>EntityReference</code> node, then it is a |
|
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
an <code>EntityReference</code> node, it is an |
|
|
<a href="#entity-error" id=ee-er-in-attr><code>entity-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
|
383 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
384 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
385 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
386 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
387 |
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
388 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
389 |
|
<code>EntityReference</code> node, then it is an |
390 |
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
391 |
|
<li>Otherwise, |
392 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
393 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
394 |
|
</ol></li> |
395 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
396 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
397 |
|
and <code>value</code> attribute of <var>n</var> is neither |
398 |
|
<code>default</code> nor <code>preserve</code>, then it is an |
399 |
|
<a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!-- |
400 |
|
Note that <!ATTLIST e xml:space (default|preserve) "a">... |
401 |
|
<e xml:space="default"/> is conforming and valid. --></li> |
402 |
|
<li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its |
403 |
|
successor] or an empty string, then xml-misc-warning |
404 |
|
(a "fact"-level error; not an XML error).</li> |
405 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
406 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code> (#ValueType Validity constraint: Attribute Value Type)</li> |
407 |
|
<!-- xml:space MUST be declared to be valid. --> |
408 |
</ol> |
</ol> |
409 |
</dd> |
</dd> |
410 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
411 |
<dd class=ed></dd> |
<dd> |
412 |
|
<ol> |
413 |
|
<li class=ed></li> |
414 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
415 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
416 |
|
and <span class=ed>its declared type is different from (default|preserve), |
417 |
|
(default), or (preserve)</span>, then raise an |
418 |
|
<a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li> |
419 |
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
420 |
|
<code>childNodes</code> list of <var>n</var>, |
421 |
|
<ol> |
422 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
423 |
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
424 |
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
425 |
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
426 |
|
<code>EntityReference</code> node, then it is an |
427 |
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
428 |
|
<li>Otherwise, |
429 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
430 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
431 |
|
</ol></li> |
432 |
|
</ol> |
433 |
|
</dd> |
434 |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
435 |
<dd> |
<dd> |
436 |
<ol> |
<ol> |
438 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
439 |
data</a>.</li> |
data</a>.</li> |
440 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
441 |
a string <code>]]></code>, then it is a |
a string <code>]]></code>, then raise an |
442 |
<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> |
443 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
444 |
any nodes, they are in |
any nodes, they are in |
445 |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
446 |
</ol> |
</ol> |
447 |
</dd> |
</dd> |
448 |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
449 |
<dd> |
<dd> |
450 |
<ol> |
<ol> |
451 |
|
<li>Raise an |
452 |
|
<a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li> |
453 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
454 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
455 |
data</a>.</li> |
data</a>.</li> |
456 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains |
457 |
a string <code>--</code>, or if it ends with a character |
a string <code>--</code>, or if it ends with a character |
458 |
<code>-</code>, then it is a |
<code>-</code>, then raise an |
459 |
<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>.<!-- |
460 |
|
"for compatibility" --></li> |
461 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
462 |
any nodes, they are in |
any nodes, they are in |
463 |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
464 |
</ol> |
</ol> |
465 |
</dd> |
</dd> |
466 |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
471 |
then it is an <code class=ed>unknown-error?</code>.</li> |
then it is an <code class=ed>unknown-error?</code>.</li> |
472 |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
473 |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
474 |
<span class=ed>@@ formal def</span>, then it is a |
<span class=ed>@@ formal def</span>, then it is an |
475 |
<a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li> |
476 |
<li>The <code>childNodes</code> list of <var>n</var> have to |
<li>The <code>childNodes</code> list of <var>n</var> have to |
477 |
consist of zero or more <code>Comment</code> and/or |
consist of zero or more <code>Comment</code> and/or |
481 |
<code>ProcessingInstruction</code> nodes, followed by |
<code>ProcessingInstruction</code> nodes, followed by |
482 |
an <code>Element</code> node, followed |
an <code>Element</code> node, followed |
483 |
by zero or more <code>Comment</code> and/or |
by zero or more <code>Comment</code> and/or |
484 |
<code>ProcessingInstruction</code> nodes. Any violation to this is a |
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
485 |
<a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li> |
486 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn> |
487 |
<code>childNodes</code> list of <var>n</var>, |
in the <code>childNodes</code> list of <var>n</var>, |
488 |
which is different from <code>EntityReference</code> recursively.</li> |
<ol> |
489 |
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
490 |
|
<code>EntityReference</code> node, then |
491 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
492 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
493 |
|
</ol></li> |
494 |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
495 |
</ol> |
</ol> |
496 |
</dd> |
</dd> |
497 |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
498 |
<dd> |
<dd> |
499 |
<ol> |
<ol> |
500 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn> |
501 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
502 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
503 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
504 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
505 |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Comment</code>, <code>ProcessingInstruction</code>, or |
506 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>EntityReference</code> node, then it is an |
507 |
an <code>EntityReference</code> node, it is an |
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
508 |
<a href="#entity-error" id=ee-er-in-df><code>entity-error</code></a>.</li> |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
509 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<code>EntityReference</code> node, then it is an |
510 |
<code>childNodes</code> list of <var>n</var> |
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
511 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, |
512 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
513 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
514 |
|
</ol></li> |
515 |
</ol> |
</ol> |
516 |
</dd> |
</dd> |
517 |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
519 |
<ol> |
<ol> |
520 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
521 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
522 |
|
<li>Follow the following substeps: |
523 |
|
<ol> |
524 |
|
<li>If <code>ownerDocument</code> attribute of <var>n</var> is |
525 |
|
<code>null</code>, then abort these substeps.</li> |
526 |
|
<li>If <code>documentElement</code> attribute of the node |
527 |
|
set to <code>ownerDocument</code> attribute of <var>n</var> is |
528 |
|
<code>null</code>, then abort these substeps.</li> |
529 |
|
<li>If <code>nodeName</code> attribute of the node set to |
530 |
|
<code>documentElement</code> attribute of the node set to |
531 |
|
<code>ownerDocument</code> attribute of <var>n</var> is |
532 |
|
different from <code>nodeName</code> of <var>n</var>, |
533 |
|
then raise an |
534 |
|
<a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li> |
535 |
|
</ol> |
536 |
|
</li> |
537 |
<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 |
538 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
539 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
540 |
both <code>"</code> and <code>'</code> characters, it is a |
both <code>"</code> and <code>'</code> characters, it is a |
541 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
542 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
543 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn> |
544 |
a node which is <em>not</em> <code>ProcessingInstruction</code> node, |
in the <code>childNodes</code> list of <var>n</var>, |
545 |
then it is a |
<ol> |
546 |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
547 |
<span class=ed>@@ ref to manakai's extensions</span></li> |
<code>ProcessingInstruction</code> node, then it is an |
548 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
549 |
<code>childNodes</code> list of <var>n</var>, |
<span class=ed>@@ ref to manakai's extensions</span></li> |
550 |
which is different from <code>EntityReference</code> recursively.</li> |
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
551 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
552 |
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
553 |
|
</ol></li> |
554 |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
<li class=ed>@@ <code>entities</code>, <code>notations</code>, |
555 |
<code>elementTypes</code>, externally declared?</li> |
<code>elementTypes</code>, externally declared?</li> |
556 |
</ol> |
</ol> |
563 |
<li>If the <code>prefix</code> attribute value is different from |
<li>If the <code>prefix</code> attribute value is different from |
564 |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
<code>null</code>, then <a href="#algorithm-to-validate-a-ncname">validate |
565 |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
566 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn> |
567 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
568 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
569 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
570 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
571 |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
572 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or |
573 |
an <code>EntityReference</code> node, it is an |
<code>EntityReference</code> node, then it is an |
574 |
<a href="#entity-error" id=ee-er-in-element><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
575 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
576 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
577 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
578 |
|
<li>Otherwise, |
579 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
580 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
581 |
|
</ol></li> |
582 |
|
<li class=ed>@@ #elementvalid Validity constraint: Element Valid</li> |
583 |
|
<li class=ed>@@ #uniqattspec Well-formedness constraint: Unique Att Spec</li> |
584 |
</ol> |
</ol> |
585 |
</dd> |
</dd> |
586 |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
587 |
<dd class=ed></dd> |
<dd> |
588 |
|
<ol> |
589 |
|
<li class=ed></li> |
590 |
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
591 |
|
any nodes, they are in |
592 |
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
593 |
|
</ol> |
594 |
|
</dd> |
595 |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
<dt>If <var>n</var> is an <code>Entity</code> node</dt> |
596 |
<dd> |
<dd> |
597 |
<ol> |
<ol> |
605 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
606 |
<!-- publicId = non-null and systemId = null --> |
<!-- publicId = non-null and systemId = null --> |
607 |
<li class=ed>@@ <code>notationName</code></li> |
<li class=ed>@@ <code>notationName</code></li> |
608 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn> |
609 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
610 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
611 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
612 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
613 |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
614 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
615 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
616 |
<a href="#entity-error" id=ee-er-in-er><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
617 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
618 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
619 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
620 |
|
<li>Otherwise, |
621 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
622 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
623 |
|
</ol></li> |
624 |
</ol> |
</ol> |
625 |
</dd> |
</dd> |
626 |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
629 |
<li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li> |
<li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li> |
630 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
631 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
632 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn> |
633 |
a node which is <em>not</em> <code>Element</code>, |
in the <code>childNodes</code> list of <var>n</var>, |
634 |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
<ol> |
635 |
<code>ProcessingInstruction</code>, or |
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
636 |
<code>EntityReference</code> node, then it is a |
<code>Element</code>, |
637 |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
638 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
639 |
an <code>EntityReference</code> node, it is an |
node, then it is an |
640 |
<a href="#entity-error" id=ee-er-in-entity><code>entity-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
641 |
<li><a href="#algorithm-to-check-a-node">Check each node</a>, in |
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
642 |
<code>childNodes</code> list of <var>n</var>, |
<code>EntityReference</code> node, then it is an |
643 |
which is different from <code>EntityReference</code> recursively.</li> |
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
644 |
|
<li>Otherwise, |
645 |
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
646 |
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
647 |
|
</ol></li> |
648 |
</ol> |
</ol> |
649 |
</dd> |
</dd> |
650 |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
659 |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-dt-system-id><code>xml-well-formedness-error</code></a>.</li> |
660 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
661 |
any nodes, they are in |
any nodes, they are in |
662 |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li> |
663 |
</ol> |
</ol> |
664 |
</dd> |
</dd> |
665 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
666 |
<dd> |
<dd> |
667 |
<ol> |
<ol> |
668 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li>If the <code>target</code> attribute value matches to the string |
669 |
<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 |
|
670 |
<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> |
671 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li>Otherwise, <a href="#algorithm-to-validate-a-ncname">validate the |
672 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
673 |
|
<li>Then, |
674 |
|
<a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML character data">validate |
675 |
|
the <code>data</code> attribute value as an <abbr>XML</abbr> character |
676 |
data</a>.</li> |
data</a>.</li> |
677 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains a string |
678 |
a string <code>?></code>, or starts with either |
<code>?></code>, then raise a |
679 |
<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> |
680 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
<li>If the <code>data</code> attribute value starts with either |
681 |
character, then it is a |
<code class=char>U+0009</code> <code class=charname>CHARACTER |
682 |
<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 |
683 |
|
FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE |
684 |
|
RETURN</code>, or <code class=char>U+0020</code> |
685 |
|
<code class=charname>SPACE</code> character, then raise a |
686 |
|
<a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li> |
687 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
688 |
any nodes, they are in |
any nodes, then raise an |
689 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
690 |
</ol> |
</ol> |
691 |
</dd> |
</dd> |
692 |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
697 |
data</a>.</li> |
data</a>.</li> |
698 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
699 |
any nodes, they are in |
any nodes, they are in |
700 |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>s.</li> |
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li> |
701 |
</ol> |
</ol> |
702 |
</dd> |
</dd> |
703 |
<dt>Otherwise</dt> |
<dt>Otherwise</dt> |
704 |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
705 |
</dl> |
</dl> |
706 |
|
|
|
<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> |
|
|
|
|
707 |
</div> |
</div> |
708 |
|
|
709 |
<div class="section" id="examples"> |
</div> |
|
<h2>Examples</h2> |
|
|
|
|
|
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
|
710 |
|
|
711 |
<div class="ed issue"> |
<div id=classes class=section> |
712 |
|
<h2>Character Classes</h2> |
713 |
|
|
714 |
<div class="example figure block"> |
<p>This section defines a couple of character classes. |
715 |
<div class="caption">...</div> |
These classes are referred to by algorithms specified above.</p> |
716 |
|
|
717 |
<pre><code>...</code></pre> |
<p>Character class <dfn id=class-Char10><code>Char10</code></dfn> |
718 |
|
contains the following characters:</p> |
719 |
|
<ul> |
720 |
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
721 |
|
TABULATION</code></li> |
722 |
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
723 |
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
724 |
|
RETURN</code></li> |
725 |
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code> |
726 |
|
.. <code class=char>U+D7FF</code></li> |
727 |
|
<li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code> |
728 |
|
<code class=charname>REPLACEMENT CHARACTER</code></li> |
729 |
|
<li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li> |
730 |
|
</ul> |
731 |
|
<div class="note memo"> |
732 |
|
<p>This character class contains all characters allowed in the production rule |
733 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a> |
734 |
|
of <abbr>XML</abbr> 1.0 |
735 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
736 |
</div> |
</div> |
737 |
|
|
738 |
|
<p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn> |
739 |
|
contains the following characters:</p> |
740 |
|
<ul> |
741 |
|
<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> |
742 |
|
</ul> |
743 |
|
|
744 |
|
<p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn> |
745 |
|
contains the following characters:</p> |
746 |
|
<ul> |
747 |
|
<li><code class=char>U+007F</code> <code class=charname>DELETE</code> .. |
748 |
|
<code class=char>U+0084</code> <code class=charname>INDEX</code></li> |
749 |
|
<li><code class=char>U+0086</code> <code class=charname>START OF SELECTED |
750 |
|
AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION |
751 |
|
PROGRAM COMMAND</code></li> |
752 |
|
<li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li> |
753 |
|
<li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li> |
754 |
|
<li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li> |
755 |
|
<li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li> |
756 |
|
<li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li> |
757 |
|
<li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li> |
758 |
|
<li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li> |
759 |
|
<li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li> |
760 |
|
<li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li> |
761 |
|
<li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li> |
762 |
|
<li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li> |
763 |
|
<li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li> |
764 |
|
<li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li> |
765 |
|
<li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li> |
766 |
|
<li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li> |
767 |
|
<li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li> |
768 |
|
<li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li> |
769 |
|
</ul> |
770 |
|
<div class="note memo"> |
771 |
|
<p>This character class contains the characters listed in the Note in |
772 |
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a> |
773 |
|
of <abbr>XML</abbr> 1.0 |
774 |
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>, |
775 |
|
as amended by |
776 |
|
<a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p> |
777 |
</div> |
</div> |
778 |
|
|
779 |
</div> |
</div> |