/[suikacvs]/markup/xml/xmlcc/xmlcc-work.en.html
Suika

Contents of /markup/xml/xmlcc/xmlcc-work.en.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (hide annotations) (download) (as text)
Sat Dec 1 15:18:43 2007 UTC (18 years, 7 months ago) by wakaba
Branch: MAIN
Changes since 1.20: +11 -0 lines
File MIME type: text/html
Oops\!  The most important characters were not part of PubidChar class

1 wakaba 1.1 <!DOCTYPE html>
2     <html lang="en" class="formal-specification status-work-in-progress">
3     <head>
4 wakaba 1.2 <title>manakai's XML Conformance Checking</title>
5 wakaba 1.1 <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 wakaba 1.6 <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 wakaba 1.1 </head>
17     <body class="has-abstract">
18    
19     <div class="header">
20 wakaba 1.12 <h1>manakai's <abbr>XML</abbr> Conformance Checking</h1>
21 wakaba 1.17 <h2>Working Draft <time datetime=2007-12-01>1 December 2007</time></h2>
22 wakaba 1.1
23 wakaba 1.2 <dl class="versions-uri">
24 wakaba 1.1 <dt>This Version</dt>
25 wakaba 1.2 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work"
26     >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>&gt;</code></dd>
27 wakaba 1.1 <dt>Latest Version</dt>
28 wakaba 1.2 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc"
29     >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc</a>&gt;</code></dd>
30 wakaba 1.1 <dt>Latest Working Draft</dt>
31 wakaba 1.2 <dd><code class="URI">&lt;<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work"
32     >http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>&gt;</code></dd>
33 wakaba 1.1 <!-- <dt>Previous Version</dt> -->
34     <dt>Version History</dt>
35 wakaba 1.2 <dd><code class=URI>&lt;<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>&gt;</code></dd>
36 wakaba 1.1 </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">&lt;<a href="mailto:[email protected]" rel="author"
42     >[email protected]</a>&gt;</code></dd>
43     </dl>
44    
45     <p class="copyright" lang="en">&#xA9; <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">&lt;<a
56     href="http://www.gnu.org/copyleft/fdl.html"
57     rel="license">http://www.gnu.org/copyleft/fdl.html</a>&gt;</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    
124 wakaba 1.9 <div class=section id=error-categories>
125 wakaba 1.14 <h2>Error Classification</h2>
126 wakaba 1.9
127 wakaba 1.1 <p class=ed>If a <code>Document</code> node has no
128     xml-well-formedness-error, entity-error, and unknown-error,
129     then it is well-formed. If a well-formed <code>Document</code>
130     node has no xml-validity-error, it is valid.</p>
131    
132     <div class="note memo">
133     <p>A well$B!>(Bformed <code>Document</code> can be safely serialized
134     into a well$B!>(Bformed XML document. A valid <code>Document</code>
135     can be easily serialized into a valid XML document.</p>
136     </div>
137    
138 wakaba 1.17 <p class=ed>To be a conforming <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-validating">validating XML processor</a>,
139     ...</p>
140    
141 wakaba 1.1 <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 wakaba 1.4 <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 wakaba 1.1 <dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt>
158     <dd class=ed>@@</dd>
159 wakaba 1.12 <dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt>
160     <dd>
161     <p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a>
162     will be raised when a construct, which might not be restored to the same
163     construct when it is serialized and then re-parsed by a conforming
164     processor, is encountered.</p>
165     <div class="example memo">
166     <p>For a <code>Comment</code> node a
167     <a href="#round-trip-warning"><code>round-trip-warning</code></a> will
168     be raised, since <abbr>XML</abbr> processors are not required to
169     report texts of comments for applications.</p>
170     </div>
171     </dd>
172 wakaba 1.1 <dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt>
173     <dd class=ed>@@</dd>
174     <dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt>
175     <dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0
176     <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
177     <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> /
178     <abbr>XML</abbr> 1.1
179     <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
180     <a href="@@/#dt-error">error</a>)
181     that is not classified to any other <a href="#error-category">error
182     category</a>.</dd>
183     <dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt>
184     <dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0
185     <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>
186     <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal
187     error</a> / <abbr>XML</abbr> 1.1
188     <cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite>
189     <a href="@@/#dt-fatal">fatal error</a>)
190     that is not classified to any other <a href="#error-category">error
191     category</a>. <span class=ed>@@ What errors fall into this category?</span></dd>
192 wakaba 1.13 <dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt>
193     <dd>
194     <p>An
195     <a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a>
196     will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement
197     in <abbr>XML</abbr> specification is not met.</p>
198     </dd>
199 wakaba 1.1 <dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt>
200     <dd>A violation of validity constraint in XML document.</dd>
201     <dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt>
202     <dd><p>If an <code>xml-well-formedness-error</code> is raised,
203     it would not be possible to generate an XML serialization that
204     would match to the appropriate production rule and that would not
205     violate to any well$B!>(Bformedness constraint in XML
206     specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>,
207     <a href="#ref-XML11">XML11</a>]</cite>.</p></dd>
208     </dl>
209    
210     <div class=ed><p>@@ TODO: #dt-atuseroption at user option
211     (MAY or MUST), #dt-compat for compatibility,
212     #dt-interop for interoperability</p></div>
213    
214 wakaba 1.9 </div>
215 wakaba 1.14
216     <div class=section id=parsing-xml>
217     <h2>Parsing <abbr>XML</abbr> Document</h2>
218    
219     <ul>
220     <li>If the <abbr>XML</abbr> document does not begin with an
221     <abbr>XML</abbr> declaration, then raise an
222     <a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li>
223     <li>If the replacement text of an entity declaration is
224     <code>&lt;</code>, then raise an
225     <a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!--
226     "strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11].
227     --></li>
228 wakaba 1.16 <li>If there is an element type declaration whose <code>Name</code>
229     value is already declared, then raise an
230     <a href="#xml-validity-error" id=vc-edunique><code>xml-validity-error</code></a>.</li>
231 wakaba 1.14 <li>If attribute definition whose <code>Name</code> is
232     <code>xml:space</code> has <span class=ed>declared type different from
233     (default|preserve), (default), or (preserve)</span>, then raise an
234     <a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>.
235     <span class=ed>@@ duplication with
236     <a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!--
237     <!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li>
238 wakaba 1.15 <li>If an empty-element tag is used for an element which is <em>not</em>
239     declared <code>EMPTY</code>, then raise an
240     <a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>.</li>
241     <li>If an empty-element tag is <em>not</em> used for an element which is
242     declared <code>EMPTY</code>, then raise an
243     <a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>.</li>
244 wakaba 1.14 <!--
245    
246     #vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting
247     #wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset
248     #ExtSubset Well-formedness constraint: External Subset
249     #PE-between-Decls Well-formedness constraint: PE Between Declarations
250 wakaba 1.15 #GIMatch Well-formedness constraint: Element Type Match
251     #uniqattspec Well-formedness constraint: Unique Att Spec
252     #NoExternalRefs Well-formedness constraint: No External Entity References
253     #CleanAttrVals Well-formedness constraint: No < in Attribute Values
254 wakaba 1.16 #vc-PEinGroup Validity constraint: Proper Group/PE Nesting
255     "For interoperability, if a parameter-entity reference appears in a choice, seq, or Mixed construct, its replacement text SHOULD contain at least one non-blank character, and neither the first nor last non-blank character of the replacement text SHOULD be a connector (| or ,)."
256     "For interoperability, an XML processor MAY at user option issue a warning when more than one attribute-list declaration is provided for a given element type, or more than one attribute definition is provided for a given attribute, but this is not an error."
257 wakaba 1.17 #condsec-nesting Validity constraint: Proper Conditional Section/PE Nesting
258     #wf-Legalchar Well-formedness constraint: Legal Character
259     #textent Well-formedness constraint: Parsed Entity
260     #norecursion Well-formedness constraint: No Recursion
261     #indtd Well-formedness constraint: In DTD
262     "External parsed entities SHOULD each begin with a text declaration."
263     "It is an error for a reference to an unparsed entity to appear in the EntityValue in an entity declaration."
264     #UniqueNotationName Validity constraint: Unique Notation Name
265 wakaba 1.14
266     @@ Need detailed review, but maybe should be in parsing phase
267    
268     #vc-check-rmd Validity constraint: Standalone Document Declaration
269    
270 wakaba 1.17 @@ Need dtailed review
271    
272     #wf-entdeclared Well-formedness constraint: Entity Declared
273     #vc-entdeclared Validity constraint: Entity Declared
274     "For interoperability, valid documents SHOULD declare the entities amp, lt, gt, apos, quot, in the form specified in 4.6 Predefined Entities."
275     "If the entities lt or amp are declared, they MUST be declared as internal entities whose replacement text is a character reference to the respective character (less-than sign or ampersand) being escaped; the double escaping is REQUIRED for these entities so that references to them produce a well-formed result. If the entities gt, apos, or quot are declared, they MUST be declared as internal entities whose replacement text is the single character being escaped (or a character reference to that character; the double escaping here is OPTIONAL but harmless)."
276    
277     @@ flaged and then reported in DOM check phase
278    
279     "Entities encoded in UTF-16 MUST and entities encoded in UTF-8 MAY begin with the Byte Order Mark"
280     "In the absence of external character encoding information (such as MIME headers), parsed entities which are stored in an encoding other than UTF-8 or UTF-16 MUST begin with a text declaration"
281     "In an encoding declaration, the values "UTF-8", "UTF-16", "ISO-10646-UCS-2", and "ISO-10646-UCS-4" SHOULD be used for the various encodings and transformations of Unicode / ISO/IEC 10646, the values "ISO-8859-1", "ISO-8859-2", ... "ISO-8859-n" (where n is the part number) SHOULD be used for the parts of ISO 8859, and the values "ISO-2022-JP", "Shift_JIS", and "EUC-JP" SHOULD be used for the various encoded forms of JIS X-0208-1997. It is RECOMMENDED that character encodings registered (as charsets) with the Internet Assigned Numbers Authority [IANA-CHARSETS], other than those just listed, be referred to using their registered names; other encodings SHOULD use names starting with an "x-" prefix."
282    
283     @@ in parsing phase
284    
285     "It is a fatal error when an XML processor encounters an entity with an encoding that it is unable to process. It is a fatal error if an XML entity is determined (via default, encoding declaration, or higher-level protocol) to be in a certain encoding but contains byte sequences that are not legal in that encoding."
286    
287 wakaba 1.14 -->
288     </ul>
289     </div>
290    
291     <div class="section" id=checking-dom>
292     <h2>Checking <abbr>DOM</abbr></h2>
293    
294     <p>The following algorithms and definitions are applied to
295     <abbr>XML</abbr> documents; especially, they are not applied
296     to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p>
297 wakaba 1.9
298     <div class=section id=definitions>
299     <h3>Definitions</h3>
300    
301 wakaba 1.1 <p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is
302     the <abbr>XML</abbr> version of the document to which the node belongs.
303     For a <code>Documemt</code> node, the <abbr>XML</abbr> version
304     of the document is the value of the <code>xmlVersion</code>
305 wakaba 1.9 attribute of the node. For a <code>DocumentType</code> node whose
306     <code>ownerDocument</code> attribute is set to <code>null</code>,
307     the <abbr>XML</abbr> version of the document is <code>1.0</code><!--
308     since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->.
309 wakaba 1.1 For any other node, the <abbr>XML</abbr> version of the document
310     is that of the <code>Document</code> node contained in the
311     <code>ownerDocument</code> attribute of the node.</p>
312    
313 wakaba 1.9 </div>
314    
315 wakaba 1.10
316     <div class=section id=checking-components>
317 wakaba 1.19 <h3>Conformance Checking Algorithms for Components</h3>
318 wakaba 1.10
319 wakaba 1.19 <p>To
320     <dfn id=algorithm-to-validate-an-xml-character-data title="validate an XML string">to
321     validate an <abbr>XML</abbr> string (<dfn id=var-s><var>s</var></dfn>)</dfn>,
322     the following algorithm <em class=rfc2119>MUST</em> be used:</p>
323 wakaba 1.10 <ol>
324 wakaba 1.11 <li>If <var>s</var> contains a character that is <em>not</em> in
325     the character class <a href="#class-Char10"><code>Char10</code></a>,
326     then raise an
327     <a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li>
328     <li>If <var>s</var> contains a character that is in the character
329     class <a href="#class-CompatChar10"><code>CompatChar10</code></a>,
330     then raise an
331     <a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li>
332     <li>If <var>s</var> contains a character that is in the character
333     class <a href="#class-ControlChar10"><code>ControlChar10</code></a>,
334     then raise an
335     <a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li>
336     <li class=ed>@@ XML 1.1 support</li>
337 wakaba 1.13 <li>If <var>s</var> contains a <code class=char>U+000D</code>
338     <code class=charname>CARRIAGE RETURN</code> character, then
339     raise a
340     <a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>.
341     <span class=ed>@@ We should not raise duplicate errors for U+000D
342     in attribute values. In addition, we should support a mode where
343     U+000D will be serialized as &#x000D; (so that no round-trip-error
344     will be raised).</span></li>
345 wakaba 1.10 </ol>
346    
347 wakaba 1.19 <p>To
348     <dfn id=algorithm-to-validate-a-name title="validate a Name">validate a
349     <code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn>, the following
350     algorithm <em class=rfc2119>MUST</em> be used:</p>
351 wakaba 1.10 <ol>
352 wakaba 1.19 <li>If <var>s</var> is an empty string, then raise an
353     <a href="#xml-well-formedness-error" id=wfe-name-empty><code>xml-well-formedness-error</code></a>.
354     Abort these steps.</li>
355     <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate
356     <var>s</var> as an <abbr>XML</abbr> string</a>.</li>
357     <li>If the first character in <var>s</var> is a character that is
358     <em>not</em> in the character class
359     <a href="#class-NameStartChar10"><code>NameStartChar10</code></a>, then raise
360     an
361     <a href="#xml-well-formedness-error" id=wfe-name-startchar><code>xml-well-formedness-error</code></a>.</li>
362     <li>If a character other than the first character in <var>s</var> is a
363     character that is <em>not</em> in the character class
364     <a href="#class-NameChar10"><code>NameChar10</code></a>, then raise an
365     <a href="#xml-well-formedness-error" id=wfe-name-char><code>xml-well-formedness-error</code></a>.</li>
366 wakaba 1.12 <li>If <var>s</var> begins with the string <code>xml</code> (in any
367     case combination), then raise an
368     <a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>.
369     <span class=ed>@@ except for attribute names <code>xml:lang</code>,
370     <code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>,
371     <code>xmlns</code>, <code>xmlns:<var>*</var></code>,
372 wakaba 1.15 pi name <code>xml-stylesheet</code>.</span><!--
373     "names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification.":
374 wakaba 1.19 xmlns, xml-stylesheet, xml:base and xml:id specifications violate to this sentense!
375 wakaba 1.15 --></li>
376 wakaba 1.12 <!-- COLON in Name is a lowercase "should not" in a Note of [XML10],
377     [XML11]. -->
378 wakaba 1.19 <li class=ed>@@ XML 1.1 support</li>
379 wakaba 1.10 </ol>
380    
381 wakaba 1.19 <p>To
382     <dfn id=algorithm-to-validate-an-ncname title="validate an NCName">validate
383     an <code>NCName</code> (<dfn id=var-ncname-s><var>s</var></dfn>)</dfn>, the
384     following algorithm <em class=rfc2119>MUST</em> be used:</p>
385 wakaba 1.10 <ol>
386 wakaba 1.19 <li><a href="#algorithm-to-validate-a-name" title="validate a Name">Validate
387     <var>s</var> as a <code>Name</code></a>.</li>
388 wakaba 1.10 <li class=ed>@@</li>
389     </ol>
390    
391 wakaba 1.18 <p>To
392     <dfn id=algorithm-to-validate-a-public-identifier title="validate a public identifier">validate
393 wakaba 1.10 a public identifier (<dfn id=var-pid><var>pid</var></dfn>)</dfn>, the
394 wakaba 1.18 following algorithm <em class=rfc2119>MUST</em> be used:</p>
395 wakaba 1.10 <ol>
396 wakaba 1.20 <li>If <var>pid</var> is <code>null</code>, abort these steps.</li>
397     <li>If <var>pid</var> contains a character that is <em>not</em> in the
398     character class <a href="#class-PubidChar"><code>PubidChar</code></a>, then
399     raise an
400     <a href="#xml-well-formedness-error" id=wfe-pubid-char><code>xml-well-formedness-error</code></a>.</li>
401 wakaba 1.10 <li>If <var>pid</var> contains one of <code class=char>U+0009</code>
402     <code class=charname>CHARACTER TABULATION</code>,
403     <code class=char>U+000A</code> <code class=charname>CARRIAGE RETURN</code>,
404     and <code class=char>U+000D</code> <code class=charname>LINE FEED</code>
405     characters, if the first character of <var>pid</var> is
406     <code class=char>U+0020</code> <code class=charname>SPACE</code> character,
407     if the last character of <var>pid</var> is <code class=char>U+0020</code>
408     <code class=charname>SPACE</code> character, or if there is a
409     <code class=char>U+0020</code> <code class=charname>SPACE</code> character
410     immediately followed by another <code class=char>U+0020</code>
411     <code class=charname>SPACE</code> character in <var>pid</var>, then it is a
412 wakaba 1.18 <a href="#round-trip-error" id=rte-pubid-space><code>round-trip-error</code></a>.
413     <span class=ed>Is this really a roundtripness problem? XML spec
414     does only define the way to match public identifiers in fact, no
415     canonical form.</span></li>
416 wakaba 1.10 </ol>
417    
418 wakaba 1.18 <p>To
419     <dfn id=algorithm-to-validate-a-system-identifier title="validate a system identifier">validate
420     a system identifier (<dfn id=var-sid><var>sid</var></dfn>)</dfn>, the
421     following algorithm <em class=rfc2119>MUST</em> be used:</p>
422     <ol>
423     <li>If <var>sid</var> is <code>null</code>, abort these steps.</li>
424 wakaba 1.19 <li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate
425     <var>sid</var> as an <abbr>XML</abbr> string</a>.</li>
426 wakaba 1.18 <li>If <var>sid</var> contains both <code class=char>U+0022</code>
427     <code class=charname>QUOTATION MARK</code> (<code class=char>"</code>) and
428     <code class=char>U+0027</code> <code class=charname>APOSTROPHE</code>
429     (<code class=char>'</code>) characters, raise an
430     <a href="#xml-well-formedness-error" id=wfe-sid-lit><code>xml-well-formedness-error</code></a>.</li>
431     <li>If <var>sid</var> contains at least one <code class=char>U+0023</code>
432     <code class=charname>NUMBER SIGN</code> (<code class=char>#</code>)
433     character, then raise an
434     <a href="#xml-misc-error" id=xme-sid-fragment><code>xml-misc-error</code></a>.</li>
435     <li class=ed>@@ If <var>sid</var> cannot be converted to a URI
436     reference, then raise a fact-level error (xml-misc-warning?).<!--
437     XML 1.0 has no conformance language for system identifier being
438