Parent Directory
|
Revision Log
|
Patch
| revision 1.11 by wakaba, Tue Nov 13 13:00:14 2007 UTC | revision 1.25 by wakaba, Sat Mar 29 02:22:57 2008 UTC | |
|---|---|---|
| # | Line 17 | Line 17 |
| 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-13>13 November 2007</time></h2> | <h2>Working Draft <time datetime=2008-03-29>29 March 2008</time></h2> |
| 22 | ||
| 23 | <dl class="versions-uri"> | <dl class="versions-uri"> |
| 24 | <dt>This Version</dt> | <dt>This Version</dt> |
| # | Line 42 | Line 42 |
| 42 | >[email protected]</a>></code></dd> | >[email protected]</a>></code></dd> |
| 43 | </dl> | </dl> |
| 44 | ||
| 45 | <p class="copyright" lang="en">© <time>2007</time> <a | <p class="copyright" lang="en">© <time>2007</time>$B!>(B<time>2008</time> <a |
| 46 | href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. | href="http://suika.fam.cx/~wakaba/who?" rel="author">Wakaba</a>. |
| 47 | Permission is granted to copy, distribute and/or modify this document | Permission is granted to copy, distribute and/or modify this document |
| 48 | under the terms of the <a rel="license" | under the terms of the <a rel="license" |
| # | Line 118 else in this specification is normative. | Line 118 else in this specification is normative. |
| 118 | <p><span class=ed>Algorithm is normative but non-normative</span>. | <p><span class=ed>Algorithm is normative but non-normative</span>. |
| 119 | In addition, the order in which <a href="#errors">errors</a> are | In addition, the order in which <a href="#errors">errors</a> are |
| 120 | raised is undefined.</p> | raised is undefined.</p> |
| </div> | ||
| 121 | ||
| 122 | <div class="section" id=checking-dom> | <p>This document sometimes cites parts of <abbr>XML</abbr> 1.0 specification |
| 123 | <h2>Checking <abbr>DOM</abbr></h2> | by hyperlinks. When the document being processed is an <abbr>XML</abbr> 1.1 |
| 124 | document, however, corresponding parts of the <abbr>XML</abbr> 1.1 | |
| 125 | specification should be consulted instead.</p> | |
| 126 | </div> | |
| 127 | ||
| <p>The following algorithms and definitions are applied to | ||
| <abbr>XML</abbr> documents; especially, they are not applied | ||
| to <abbr>HTML</abbr> documents.<!-- TODO: ref to HTML5 --></p> | ||
| 128 | ||
| 129 | <div class=section id=error-categories> | <div class=section id=error-categories> |
| 130 | <h3>Error Classification</h3> | <h2>Error Classification</h2> |
| 131 | ||
| 132 | <p class=ed>If a <code>Document</code> node has no | <p class=ed>If a <code>Document</code> node has no |
| 133 | xml-well-formedness-error, entity-error, and unknown-error, | xml-well-formedness-error, entity-error, and unknown-error, |
| # | Line 141 into a well$B!>(Bformed XML document. | Line 140 into a well$B!>(Bformed XML document. |
| 140 | can be easily serialized into a valid XML document.</p> | can be easily serialized into a valid XML document.</p> |
| 141 | </div> | </div> |
| 142 | ||
| 143 | <p class=ed>To be a conforming <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-validating">validating XML processor</a>, | |
| 144 | ...</p> | |
| 145 | ||
| 146 | <p>Errors are classified into these | <p>Errors are classified into these |
| 147 | <dfn id=error-category title="error category">error categories</dfn>:</p> | <dfn id=error-category title="error category">error categories</dfn>:</p> |
| 148 | ||
| # | Line 159 can be easily serialized into a valid XM | Line 161 can be easily serialized into a valid XM |
| 161 | </dd> | </dd> |
| 162 | <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> |
| 163 | <dd class=ed>@@</dd> | <dd class=ed>@@</dd> |
| 164 | <dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt> | |
| 165 | <dd> | |
| 166 | <p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a> | |
| 167 | will be raised when a construct, which might not be restored to the same | |
| 168 | construct when it is serialized and then re-parsed by a conforming | |
| 169 | processor, is encountered.</p> | |
| 170 | <div class="example memo"> | |
| 171 | <p>For a <code>Comment</code> node a | |
| 172 | <a href="#round-trip-warning"><code>round-trip-warning</code></a> will | |
| 173 | be raised, since <abbr>XML</abbr> processors are not required to | |
| 174 | report texts of comments for applications.</p> | |
| 175 | </div> | |
| 176 | </dd> | |
| 177 | <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> |
| 178 | <dd class=ed>@@</dd> | <dd class=ed>@@</dd> |
| 179 | <dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> | <dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
| # | Line 179 can be easily serialized into a valid XM | Line 194 can be easily serialized into a valid XM |
| 194 | <a href="@@/#dt-fatal">fatal error</a>) | <a href="@@/#dt-fatal">fatal error</a>) |
| 195 | that is not classified to any other <a href="#error-category">error | that is not classified to any other <a href="#error-category">error |
| 196 | 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> |
| 197 | <dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt> | |
| 198 | <dd> | |
| 199 | <p>An | |
| 200 | <a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a> | |
| 201 | will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement | |
| 202 | in <abbr>XML</abbr> specification is not met.</p> | |
| 203 | </dd> | |
| 204 | <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> |
| 205 | <dd>A violation of validity constraint in XML document.</dd> | <dd>A violation of validity constraint in XML document.</dd> |
| 206 | <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> |
| # | Line 192 can be easily serialized into a valid XM | Line 214 can be easily serialized into a valid XM |
| 214 | ||
| 215 | <div class=ed><p>@@ TODO: #dt-atuseroption at user option | <div class=ed><p>@@ TODO: #dt-atuseroption at user option |
| 216 | (MAY or MUST), #dt-compat for compatibility, | (MAY or MUST), #dt-compat for compatibility, |
| 217 | #dt-interop for interoperability</p></div> | #dt-interop for interoperability</p> |
| 218 | ||
| 219 | <p>TODO: XML 1.1, XML Namespace 1.0/1.1, xml:base, xml:id | |
| 220 | </div> | </div> |
| 221 | ||
| 222 | </div> | |
| 223 | ||
| 224 | <div class=section id=parsing-xml> | |
| 225 | <h2>Parsing <abbr>XML</abbr> Document</h2> | |
| 226 | ||
| 227 | <p>When an <abbr>XML</abbr> document is parsed, the following clauses | |
| 228 | are applied:</p> | |
| 229 | <dl class=switch> | |
| 230 | <dt>For the document | |
| 231 | <dd>If the <abbr>XML</abbr> document does not begin with an | |
| 232 | <abbr>XML</abbr> declaration, then the parser <em class=rfc2119>MUST</em> | |
| 233 | raise an | |
| 234 | <a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>. | |
| 235 | <dt>For the document type declaration | |
| 236 | <dd class=ed>@@ read external entity | |
| 237 | <dt>For each internal general entity declaration being processed by the parser | |
| 238 | <dd>If the | |
| 239 | <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-EntityValue"><code>EntityValue</code></a> | |
| 240 | part of the general entity declaration contains a bare <code>U+003C</code> | |
| 241 | <code>LESS-THAN SIGN</code> (<code><</code>) character, then the parser | |
| 242 | <em class=rfc2119>MUST</em> raise an | |
| 243 | <a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- | |
| 244 | "strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. | |
| 245 | --> | |
| 246 | <dt>For each element type declaration being processed by the parser | |
| 247 | <dd>If there is another processed element type declaration whose | |
| 248 | <code>Name</code> is equal to the <code>Name</code> of the element type | |
| 249 | declaration, then the parser <em class=rfc2119>MUST</em> raise an | |
| 250 | <a href="#xml-validity-error" id=vc-edunique><code>xml-validity-error</code></a>. | |
| 251 | <dt>For each attribute definition list declaration being processed by the | |
| 252 | parser | |
| 253 | <dd>If there is another processed attribute defintion list declaration whose | |
| 254 | <code>Name</code> is equal to the <code>Name</code> of the attribute | |
| 255 | definition list declaration, then the parser <em class=rfc2119>MUST</em> | |
| 256 | raise an | |
| 257 | <a href="#xml-misc-warning" id=xme-attlist-unique><code>xml-misc-warning</code></a>. | |
| 258 | <dd>For each attribute definition in the attribute definition list | |
| 259 | declaration, if there is another processed attribute definition whose | |
| 260 | <code>Name</code> is equal to the <code>Name</code> of the attribute | |
| 261 | definition (whether or not in the same attribute definition list | |
| 262 | declaration), then the parser <em class=rfc2119>MUST</em> raise an | |
| 263 | <a href="#xml-misc-warning" id=xme-attrdef-unique><code>xml-misc-warning</code></a>. | |
| 264 | <!-- | |
| 265 | <q>For interoperability, an XML processor <em class=rfc2119>MAY</em> at | |
| 266 | user option issue a warning when more than one attribute-list declaration | |
| 267 | is provided for a given element type, or more than one attribute definition | |
| 268 | is provided for a given attribute, but this is not an error.</q> | |
| 269 | --> | |
| 270 | <!-- | |
| 271 | NOTE: <!ATTLIST a xml:space (default) #IMPLIED xml:space CDATA #IMPLIED> | |
| 272 | will not be warned. | |
| 273 | --> | |
| 274 | ||
| 275 | <dt>For each entity declaration being processed by the parser | |
| 276 | <dd>If the entity declaration declares a parameter entity and the | |
| 277 | <code>Name</code> of the entity begins with the string <code>xml</code> | |
| 278 | (in any combination of upper- and lowercase letters), then the parser | |
| 279 | <em class=rfc2119>MUST</em> raise an | |
| 280 | <a href="#xml-misc-warning" id=xmw-reserved-pe-name><code>xml-misc-warning</code></a>. | |
| 281 | <dd>If the entity declaration contains the <code>EntityValue</code>, then | |
| 282 | for each occurence of any references to unparsed entities in the | |
| 283 | <code>EntityValue</code>, the parser <em class=rfc2119>MUST</em> raise an | |
| 284 | <a href="#xml-misc-error" id=xme-unparsed-in-ev><code>xml-misc-error</code></a>. | |
| 285 | <!-- | |
| 286 | <q>It is an error for a reference to an unparsed entity to appear in the | |
| 287 | EntityValue in an entity declaration.</q> | |
| 288 | --> | |
| 289 | ||
| 290 | <dt>For each notation declaration being processed by the parser | |
| 291 | <dd>If there is another processed notation declaration whose | |
| 292 | <code>Name</code> is equal to the <code>Name</code> of the notation | |
| 293 | declaration, then the parser <em class=rfc2119>MUST</em> raise an | |
| 294 | <a href="#xml-validity-error" id=vc-uniquenotationname><code>xml-validity-error</code></a>. | |
| 295 | <!-- <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#UniqueNotationName">Validity constraint: Unique Notation Name</a> --> | |
| 296 | ||
| 297 | <dt>For each empty-element tag | |
| 298 | <dd>If the <code>Name</code> of the tag is not declared by a processed | |
| 299 | element type declaration as <code>EMPTY</code> content, then the parser | |
| 300 | <em class=rfc2119>MUST</em> raise an | |
| 301 | <a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>. | |
| 302 | <dt>For each start-tag | |
| 303 | <dd>If the <code>Name</code> of the tag is declared by a processed element | |
| 304 | type declaration as <code>EMPTY</code> content, then the parser | |
| 305 | <em class=rfc2119>MUST</em> raise an | |
| 306 | <a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>. | |
| 307 | ||
| 308 | <dt>For each parameter entity reference | |
| 309 | <dd>If the declaration for the entity is not read (i.e. no declaration | |
| 310 | for the entity is processed or the external entity referenced by the | |
| 311 | declaration cannot be retrieved), then: | |
| 312 | <ul> | |
| 313 | <li>If the parameter entity is contained in a declaration, then the | |
| 314 | declaration <em class=rfc2119>MUST</em> be ignored <em>except</em> that | |
| 315 | any error before the parameter entity <em class=rfc2119>MUST</em> be | |
| 316 | raised as usual. | |
| 317 | <li>If the parameter entity is contained in the status portion of a | |
| 318 | conditional section, then the conditional section | |
| 319 | <em class=rfc2119>MUST</em> be processed as if it were an | |
| 320 | <code>IGNORE</code>d section. | |
| 321 | <li>The parser <em class=rfc2119>MUST NOT</em> process any entity or | |
| 322 | attribute-list declaration after the parameter entity reference in the DTD | |
| 323 | <em>except</em> when the <code>standalone</code> pseudo-attribute of the | |
| 324 | XML declaration (if any) is set to <code>yes</code>. | |
| 325 | <!-- This requirement is enforced for internal DTD subset case in | |
| 326 | XML 1.0/1.1 specification (section 5.1) but not for any other cases. --> | |
| 327 | <!-- According to this definition, element type declarations, notation | |
| 328 | declarations, and PIs ARE processed. --> | |
| 329 |