124 |
<h2>Parsing <abbr>XML</abbr> Document</h2> |
<h2>Parsing <abbr>XML</abbr> Document</h2> |
125 |
|
|
126 |
<ul> |
<ul> |
127 |
|
<li>If the <abbr>XML</abbr> document does not begin with an |
128 |
|
<abbr>XML</abbr> declaration, then raise an |
129 |
|
<a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li> |
130 |
<li>If the replacement text of an entity declaration is |
<li>If the replacement text of an entity declaration is |
131 |
<code><</code>, then raise an |
<code><</code>, then raise an |
132 |
<a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- |
<a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- |
133 |
"strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. |
"strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. |
134 |
--></li> |
--></li> |
135 |
|
<li>If attribute definition whose <code>Name</code> is |
136 |
|
<code>xml:space</code> has <span class=ed>declared type different from |
137 |
|
(default|preserve), (default), or (preserve)</span>, then raise an |
138 |
|
<a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>. |
139 |
|
<span class=ed>@@ duplication with |
140 |
|
<a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!-- |
141 |
|
<!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li> |
142 |
|
<!-- |
143 |
|
|
144 |
|
#vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting |
145 |
|
#wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset |
146 |
|
#ExtSubset Well-formedness constraint: External Subset |
147 |
|
#PE-between-Decls Well-formedness constraint: PE Between Declarations |
148 |
|
|
149 |
|
@@ Need detailed review, but maybe should be in parsing phase |
150 |
|
|
151 |
|
#vc-check-rmd Validity constraint: Standalone Document Declaration |
152 |
|
|
153 |
|
--> |
154 |
</ul> |
</ul> |
155 |
</div> |
</div> |
156 |
|
|
226 |
<a href="@@/#dt-fatal">fatal error</a>) |
<a href="@@/#dt-fatal">fatal error</a>) |
227 |
that is not classified to any other <a href="#error-category">error |
that is not classified to any other <a href="#error-category">error |
228 |
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> |
229 |
|
<dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt> |
230 |
|
<dd> |
231 |
|
<p>An |
232 |
|
<a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a> |
233 |
|
will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement |
234 |
|
in <abbr>XML</abbr> specification is not met.</p> |
235 |
|
</dd> |
236 |
<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> |
237 |
<dd>A violation of validity constraint in XML document.</dd> |
<dd>A violation of validity constraint in XML document.</dd> |
238 |
<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> |
289 |
then raise an |
then raise an |
290 |
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
291 |
<li class=ed>@@ XML 1.1 support</li> |
<li class=ed>@@ XML 1.1 support</li> |
292 |
<li class=ed>@@ If U+000D, round-trip-error</li> |
<li>If <var>s</var> contains a <code class=char>U+000D</code> |
293 |
|
<code class=charname>CARRIAGE RETURN</code> character, then |
294 |
|
raise a |
295 |
|
<a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>. |
296 |
|
<span class=ed>@@ We should not raise duplicate errors for U+000D |
297 |
|
in attribute values. In addition, we should support a mode where |
298 |
|
U+000D will be serialized as 
 (so that no round-trip-error |
299 |
|
will be raised).</span></li> |
300 |
</ol> |
</ol> |
301 |
|
|
302 |
<p>The algorithm |
<p>The algorithm |
378 |
<a href="#algorithm-to-check-a-node" title="check a node">check |
<a href="#algorithm-to-check-a-node" title="check a node">check |
379 |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
380 |
</ol></li> |
</ol></li> |
381 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
382 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
383 |
|
and <code>value</code> attribute of <var>n</var> is neither |
384 |
|
<code>default</code> nor <code>preserve</code>, then it is an |
385 |
|
<a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!-- |
386 |
|
Note that <!ATTLIST e xml:space (default|preserve) "a">... |
387 |
|
<e xml:space="default"/> is conforming and valid. --></li> |
388 |
|
<li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its |
389 |
|
successor] or an empty string, then xml-misc-warning |
390 |
|
(a "fact"-level error; not an XML error).</li> |
391 |
<li class=ed>@@ <code>specified</code>, |
<li class=ed>@@ <code>specified</code>, |
392 |
<code>manakaiAttributeType</code></li> |
<code>manakaiAttributeType</code></li> |
393 |
|
<!-- xml:space MUST be declared to be valid. --> |
394 |
</ol> |
</ol> |
395 |
</dd> |
</dd> |
396 |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
397 |
<dd> |
<dd> |
398 |
<ol> |
<ol> |
399 |
<li class=ed></li> |
<li class=ed></li> |
400 |
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
401 |
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
402 |
|
and <span class=ed>its declared type is different from (default|preserve), |
403 |
|
(default), or (preserve)</span>, then raise an |
404 |
|
<a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li> |
405 |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
406 |
<code>childNodes</code> list of <var>n</var>, |
<code>childNodes</code> list of <var>n</var>, |
407 |
<ol> |
<ol> |
505 |
<ol> |
<ol> |
506 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
507 |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
508 |
|
<li>Follow the following substeps: |
509 |
|
<ol> |
510 |
|
<li>If <code>ownerDocument</code> attribute of <var>n</var> is |
511 |
|
<code>null</code>, then abort these substeps.</li> |
512 |
|
<li>If <code>documentElement</code> attribute of the node |
513 |
|
set to <code>ownerDocument</code> attribute of <var>n</var> is |
514 |
|
<code>null</code>, then abort these substeps.</li> |
515 |
|
<li>If <code>nodeName</code> attribute of the node set to |
516 |
|
<code>documentElement</code> attribute of the node set to |
517 |
|
<code>ownerDocument</code> attribute of <var>n</var> is |
518 |
|
different from <code>nodeName</code> of <var>n</var>, |
519 |
|
then raise an |
520 |
|
<a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li> |
521 |
|
</ol> |
522 |
|
</li> |
523 |
<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 |
524 |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
525 |
<li>If the <code>systemId</code> attribute value contains |
<li>If the <code>systemId</code> attribute value contains |
649 |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
650 |
<dd> |
<dd> |
651 |
<ol> |
<ol> |
652 |
<li><a href="#algorithm-to-validate-a-ncname">Validate the |
<li>If the <code>target</code> attribute value matches to the string |
653 |
<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 |
|
654 |
<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> |
655 |
<li><a href="#algorithm-to-validate-an-xml-character-data">Validate the |
<li>Otherwise, <a href="#algorithm-to-validate-a-ncname">validate the |
656 |
<code>data</code> attribute value as an <abbr>XML</abbr> character |
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
657 |
|
<li>Then, |
658 |
|
<a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML character data">validate |
659 |
|
the <code>data</code> attribute value as an <abbr>XML</abbr> character |
660 |
data</a>.</li> |
data</a>.</li> |
661 |
<li>If the <code>data</code> attribute value contains |
<li>If the <code>data</code> attribute value contains a string |
662 |
a string <code>?></code>, or starts with either |
<code>?></code>, then raise a |
663 |
<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> |
664 |
<code class=char>U+000D</code>, or <code class=char>U+0020</code> |
<li>If the <code>data</code> attribute value starts with either |
665 |
character, then it is a |
<code class=char>U+0009</code> <code class=charname>CHARACTER |
666 |
<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 |
667 |
|
FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE |
668 |
|
RETURN</code>, or <code class=char>U+0020</code> |
669 |
|
<code class=charname>SPACE</code> character, then raise a |
670 |
|
<a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li> |
671 |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
<li>If the <code>childNodes</code> list of <var>n</var> contains |
672 |
any nodes, they are in |
any nodes, then raise an |
673 |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
674 |
</ol> |
</ol> |
675 |
</dd> |
</dd> |