1 |
<!DOCTYPE html> |
<!DOCTYPE html> |
2 |
<html lang="en" class="formal-specification status-work-in-progress"> |
<html lang="en" class="formal-specification status-work-in-progress"> |
3 |
<head> |
<head> |
4 |
<title>manakai's XML Conformance Checking</title> |
<title>DOM Document Type Definition Module</title> |
5 |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
<link rel="stylesheet" href="http://suika.fam.cx/www/style/html/spec"> |
6 |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
<link rel="license" href="http://suika.fam.cx/c/gnu/fdl"> |
|
<style> |
|
|
a[id]::before { |
|
|
content: "[" attr(id) "]"; |
|
|
color: gray; |
|
|
font-size: 70%; |
|
|
font-family: Courier New, monospace; |
|
|
vertical-align: 60%; |
|
|
} |
|
|
</style> |
|
7 |
</head> |
</head> |
8 |
<body class="has-abstract"> |
<body class="has-abstract"> |
9 |
|
|
10 |
<div class="header"> |
<div class="header"> |
11 |
<h1>manakai's <abbr>XML</abbr> Conformance Checking</h1> |
<h1>DOM Document Type Definition Module</h1> |
12 |
<h2>Working Draft <time datetime=2007-12-01>1 December 2007</time></h2> |
<h2>Working Draft <time datetime=2007-12-01>1 December 2007</time></h2> |
13 |
|
|
14 |
<dl class="versions-uri"> |
<dl class="versions-uri"> |
15 |
<dt>This Version</dt> |
<dt>This Version</dt> |
16 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work" |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work" |
17 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>></code></dd> |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work</a>></code></dd> |
18 |
<dt>Latest Version</dt> |
<dt>Latest Version</dt> |
19 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc" |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef" |
20 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc</a>></code></dd> |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef</a>></code></dd> |
21 |
<dt>Latest Working Draft</dt> |
<dt>Latest Working Draft</dt> |
22 |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work" |
<dd><code class="URI"><<a href="http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work" |
23 |
>http://suika.fam.cx/www/markup/xml/xmlcc/xmlcc-work</a>></code></dd> |
>http://suika.fam.cx/www/markup/xml/domdtdef/domdtdef-work</a>></code></dd> |
24 |
<!-- <dt>Previous Version</dt> --> |
<!-- <dt>Previous Version</dt> --> |
25 |
<dt>Version History</dt> |
<dt>Version History</dt> |
26 |
<dd><code class=URI><<a href="http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html">http://suika.fam.cx/gate/cvs/markup/xml/xmlcc/xmlcc-work.en.html</a>></code></dd> |
<dd><code class=URI><<a href="http://suika.fam.cx/gate/cvs/markup/xml/domdtdef/domdtdef-work.en.html">http://suika.fam.cx/gate/cvs/markup/xml/domdtdef/domdtdef-work.en.html</a>></code></dd> |
27 |
</dl> |
<dt id=author>Author</dt> |
|
<dl class="authors" id="author"> |
|
|
<dt>Author</dt> |
|
28 |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
<dd><a href="http://suika.fam.cx/~wakaba/who?" rel="author" |
29 |
lang=ja>Wakaba</a> |
lang=ja>Wakaba</a> |
30 |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
<code class="mail"><<a href="mailto:w@suika.fam.cx" rel="author" |
61 |
might supersede this document.</em></p> |
might supersede this document.</em></p> |
62 |
|
|
63 |
<p>This document is a working draft, produced as part of the |
<p>This document is a working draft, produced as part of the |
|
<a href="http://suika.fam.cx/www/markup/html/whatpm/readme">Whatpm</a> |
|
|
subproject of the |
|
64 |
<a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a> |
<a href="http://suika.fam.cx/www/manakai-core/doc/web/">manakai</a> |
65 |
project. It might be updated, replaced, or obsoleted by |
project. It might be updated, replaced, or obsoleted by |
66 |
other documents at any time. It is inappropriate to |
other documents at any time. It is inappropriate to |
79 |
|
|
80 |
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
<p class=section-info>This section is <em>non$B!>(Bnormative</em>.</p> |
81 |
|
|
82 |
<div class="issue ed">...</div> |
<div class="issue ed"> |
83 |
|
<p>This is a work-in-progress specification for DOM Document Type |
84 |
|
Definition module, as implemented by manakai and |
85 |
|
<a href="http://suika.fam.cx/gate/2005/sw/DOM%20XML%20Document%20Type%20Definition">partially documented in the SuikaWiki</a>.</p> |
86 |
|
|
87 |
|
<p>...</p> |
88 |
|
</div> |
89 |
|
|
90 |
</div> |
</div> |
91 |
|
|
113 |
</div> |
</div> |
114 |
|
|
115 |
|
|
|
<div class=section id=error-categories> |
|
|
<h2>Error Classification</h2> |
|
|
|
|
|
<p class=ed>If a <code>Document</code> node has no |
|
|
xml-well-formedness-error, entity-error, and unknown-error, |
|
|
then it is well-formed. If a well-formed <code>Document</code> |
|
|
node has no xml-validity-error, it is valid.</p> |
|
|
|
|
|
<div class="note memo"> |
|
|
<p>A well$B!>(Bformed <code>Document</code> can be safely serialized |
|
|
into a well$B!>(Bformed XML document. A valid <code>Document</code> |
|
|
can be easily serialized into a valid XML document.</p> |
|
|
</div> |
|
|
|
|
|
<p class=ed>To be a conforming <a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-validating">validating XML processor</a>, |
|
|
...</p> |
|
|
|
|
|
<p>Errors are classified into these |
|
|
<dfn id=error-category title="error category">error categories</dfn>:</p> |
|
|
|
|
|
<dl id=errors> |
|
|
<dt><dfn id=entity-error><code>entity-error</code></dfn></dt> |
|
|
<dd> |
|
|
<p class=ed>@@</p> |
|
|
<div class="note memo"> |
|
|
<p>This <span class=ed>algorithm</span> does not support |
|
|
<abbr>DOM</abbr> tree with one or more <code>EntityReference</code> |
|
|
nodes. It is expected that any entity references are expanded |
|
|
at the parse time and any unexpandable entity references |
|
|
make parse time errors raised so that never result in |
|
|
<abbr>DOM</abbr> tree with <code>EntityReference</code> nodes.</p> |
|
|
</div> |
|
|
</dd> |
|
|
<dt><dfn id=round-trip-error><code>round-trip-error</code></dfn></dt> |
|
|
<dd class=ed>@@</dd> |
|
|
<dt><dfn id=round-trip-warning><code>round-trip-warning</code></dfn></dt> |
|
|
<dd> |
|
|
<p>A <a href="#round-trip-warning"><code>round-trip-warning</code></a> |
|
|
will be raised when a construct, which might not be restored to the same |
|
|
construct when it is serialized and then re-parsed by a conforming |
|
|
processor, is encountered.</p> |
|
|
<div class="example memo"> |
|
|
<p>For a <code>Comment</code> node a |
|
|
<a href="#round-trip-warning"><code>round-trip-warning</code></a> will |
|
|
be raised, since <abbr>XML</abbr> processors are not required to |
|
|
report texts of comments for applications.</p> |
|
|
</div> |
|
|
</dd> |
|
|
<dt class=ed><dfn id=unknown-error><code>unknown-error</code></dfn>?</dt> |
|
|
<dd class=ed>@@</dd> |
|
|
<dt><dfn id=xml-misc-error><code>xml-misc-error</code></dt> |
|
|
<dd>An <abbr>XML</abbr> <i>error</i> (<abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-error">error</a> / |
|
|
<abbr>XML</abbr> 1.1 |
|
|
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
|
|
<a href="@@/#dt-error">error</a>) |
|
|
that is not classified to any other <a href="#error-category">error |
|
|
category</a>.</dd> |
|
|
<dt><dfn id=xml-misc-fatal-error><code>xml-misc-fatal-error</code></dt> |
|
|
<dd>An <abbr>XML</abbr> <i>fatal error</i> (<abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite> |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#dt-fatal">fatal |
|
|
error</a> / <abbr>XML</abbr> 1.1 |
|
|
<cite class="bibref normative">[<a href="#ref-XML11">XML11</a>]</cite> |
|
|
<a href="@@/#dt-fatal">fatal error</a>) |
|
|
that is not classified to any other <a href="#error-category">error |
|
|
category</a>. <span class=ed>@@ What errors fall into this category?</span></dd> |
|
|
<dt><dfn id=xml-misc-recommendation><code>xml-misc-recommendation</code></dfn></dt> |
|
|
<dd> |
|
|
<p>An |
|
|
<a href="#xml-misc-recommendation"><code>xml-misc-recommendation</code></a> |
|
|
will be raised if a <em class=rfc2119>SHOULD</em>$B!>(Blevel requirement |
|
|
in <abbr>XML</abbr> specification is not met.</p> |
|
|
</dd> |
|
|
<dt><dfn id=xml-validity-error><code>xml-validity-error</code></dfn></dt> |
|
|
<dd>A violation of validity constraint in XML document.</dd> |
|
|
<dt><dfn id=xml-well-formedness-error><code>xml-well-formedness-error</code></dfn></dt> |
|
|
<dd><p>If an <code>xml-well-formedness-error</code> is raised, |
|
|
it would not be possible to generate an XML serialization that |
|
|
would match to the appropriate production rule and that would not |
|
|
violate to any well$B!>(Bformedness constraint in XML |
|
|
specification <cite class="bibref normative">[<a href="#ref-XML10">XML10</a>, |
|
|
<a href="#ref-XML11">XML11</a>]</cite>.</p></dd> |
|
|
</dl> |
|
|
|
|
|
<div class=ed><p>@@ TODO: #dt-atuseroption at user option |
|
|
(MAY or MUST), #dt-compat for compatibility, |
|
|
#dt-interop for interoperability</p></div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class=section id=parsing-xml> |
|
|
<h2>Parsing <abbr>XML</abbr> Document</h2> |
|
|
|
|
|
<ul> |
|
|
<li>If the <abbr>XML</abbr> document does not begin with an |
|
|
<abbr>XML</abbr> declaration, then raise an |
|
|
<a href="#xml-misc-recommentation" id=xmr-xml-decl><code>xml-misc-recommendation</code></a>.</li> |
|
|
<li>If the replacement text of an entity declaration is |
|
|
<code><</code>, then raise an |
|
|
<a href="#xml-misc-warning" id=xmw-entity-value-lt><code>xml-misc-warning</code></a>.<!-- |
|
|
"strongly advised to avoid" in a Note in Section 2.3 of [XML10], [XML11]. |
|
|
--></li> |
|
|
<li>If there is an element type declaration whose <code>Name</code> |
|
|
value is already declared, then raise an |
|
|
<a href="#xml-validity-error" id=vc-edunique><code>xml-validity-error</code></a>.</li> |
|
|
<li>If attribute definition whose <code>Name</code> is |
|
|
<code>xml:space</code> has <span class=ed>declared type different from |
|
|
(default|preserve), (default), or (preserve)</span>, then raise an |
|
|
<a href="#xml-misc-error" id=xme-ad-xml-space><code>xml-misc-error</code></a>. |
|
|
<span class=ed>@@ duplication with |
|
|
<a href="#xml-at-xml-space">#xml-at-xml-space</a>.<!-- |
|
|
<!ATTLIST e xml:space CDATA #IMPLIED xml:space CDATA #IMPLIED> --></span></li> |
|
|
<li>If an empty-element tag is used for an element which is <em>not</em> |
|
|
declared <code>EMPTY</code>, then raise an |
|
|
<a href="#xml-misc-recommentation" id=xmr-emptyelemtag-not-empty><code>xml-misc-recommendation</code></a>.</li> |
|
|
<li>If an empty-element tag is <em>not</em> used for an element which is |
|
|
declared <code>EMPTY</code>, then raise an |
|
|
<a href="#xml-misc-recommentation" id=xmr-empty-not-emptyelemtag><code>xml-misc-recommendation</code></a>.</li> |
|
|
<!-- |
|
|
|
|
|
#vc-PEinMarkupDecl Validity constraint: Proper Declaration/PE Nesting |
|
|
#wfc-PEinInternalSubset Well-formedness constraint: PEs in Internal Subset |
|
|
#ExtSubset Well-formedness constraint: External Subset |
|
|
#PE-between-Decls Well-formedness constraint: PE Between Declarations |
|
|
#GIMatch Well-formedness constraint: Element Type Match |
|
|
#uniqattspec Well-formedness constraint: Unique Att Spec |
|
|
#NoExternalRefs Well-formedness constraint: No External Entity References |
|
|
#CleanAttrVals Well-formedness constraint: No < in Attribute Values |
|
|
#vc-PEinGroup Validity constraint: Proper Group/PE Nesting |
|
|
"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 ,)." |
|
|
"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." |
|
|
#condsec-nesting Validity constraint: Proper Conditional Section/PE Nesting |
|
|
#wf-Legalchar Well-formedness constraint: Legal Character |
|
|
#textent Well-formedness constraint: Parsed Entity |
|
|
#norecursion Well-formedness constraint: No Recursion |
|
|
#indtd Well-formedness constraint: In DTD |
|
|
"External parsed entities SHOULD each begin with a text declaration." |
|
|
"It is an error for a reference to an unparsed entity to appear in the EntityValue in an entity declaration." |
|
|
#UniqueNotationName Validity constraint: Unique Notation Name |
|
|
|
|
|
@@ Need detailed review, but maybe should be in parsing phase |
|
|
|
|
|
#vc-check-rmd Validity constraint: Standalone Document Declaration |
|
|
|
|
|
@@ Need dtailed review |
|
|
|
|
|
#wf-entdeclared Well-formedness constraint: Entity Declared |
|
|
#vc-entdeclared Validity constraint: Entity Declared |
|
|
"For interoperability, valid documents SHOULD declare the entities amp, lt, gt, apos, quot, in the form specified in 4.6 Predefined Entities." |
|
|
"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)." |
|
|
|
|
|
@@ flaged and then reported in DOM check phase |
|
|
|
|
|
"Entities encoded in UTF-16 MUST and entities encoded in UTF-8 MAY begin with the Byte Order Mark" |
|
|
"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" |
|
|
"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." |
|
|
|
|
|
@@ in parsing phase |
|
|
|
|
|
"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." |
|
|
|
|
|
--> |
|
|
</ul> |
|
|
</div> |
|
|
|
|
|
<div class="section" id=checking-dom> |
|
|
<h2>Checking <abbr>DOM</abbr></h2> |
|
|
|
|
|
<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> |
|
|
|
|
|
<div class=section id=definitions> |
|
|
<h3>Definitions</h3> |
|
|
|
|
|
<p>The <dfn id=xml-version><abbr>XML</abbr> version</dfn> of a node is |
|
|
the <abbr>XML</abbr> version of the document to which the node belongs. |
|
|
For a <code>Documemt</code> node, the <abbr>XML</abbr> version |
|
|
of the document is the value of the <code>xmlVersion</code> |
|
|
attribute of the node. For a <code>DocumentType</code> node whose |
|
|
<code>ownerDocument</code> attribute is set to <code>null</code>, |
|
|
the <abbr>XML</abbr> version of the document is <code>1.0</code><!-- |
|
|
since createDocumentType [DOM3CORE] assumes XML 1.0 [XML10TE] -->. |
|
|
For any other node, the <abbr>XML</abbr> version of the document |
|
|
is that of the <code>Document</code> node contained in the |
|
|
<code>ownerDocument</code> attribute of the node.</p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<div class=section id=checking-components> |
|
|
<h3>Conformance Checking Algorithms for Components</h3> |
|
|
|
|
|
<p>To |
|
|
<dfn id=algorithm-to-validate-an-xml-character-data title="validate an XML string">to |
|
|
validate an <abbr>XML</abbr> string (<dfn id=var-s><var>s</var></dfn>)</dfn>, |
|
|
the following algorithm <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li>If <var>s</var> contains a character that is <em>not</em> in |
|
|
the character class <a href="#class-Char10"><code>Char10</code></a>, |
|
|
then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-illegal-char><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If <var>s</var> contains a character that is in the character |
|
|
class <a href="#class-CompatChar10"><code>CompatChar10</code></a>, |
|
|
then raise an |
|
|
<a href="#xml-misc-warning" id=xmw-compat-char><code>xml-misc-warning</code></a>.</li> |
|
|
<li>If <var>s</var> contains a character that is in the character |
|
|
class <a href="#class-ControlChar10"><code>ControlChar10</code></a>, |
|
|
then raise an |
|
|
<a href="#xml-misc-warning" id=xmw-control-char><code>xml-misc-warning</code></a>.</li> |
|
|
<li class=ed>@@ XML 1.1 support</li> |
|
|
<li>If <var>s</var> contains a <code class=char>U+000D</code> |
|
|
<code class=charname>CARRIAGE RETURN</code> character, then |
|
|
raise a |
|
|
<a href="#round-trip-error" id=rte-cr><code>round-trip-error</code></a>. |
|
|
<span class=ed>@@ We should not raise duplicate errors for U+000D |
|
|
in attribute values. In addition, we should support a mode where |
|
|
U+000D will be serialized as 
 (so that no round-trip-error |
|
|
will be raised).</span></li> |
|
|
</ol> |
|
|
|
|
|
<p>To |
|
|
<dfn id=algorithm-to-validate-a-name title="validate a Name">validate a |
|
|
<code>Name</code> (<dfn id=var-name-s><var>s</var></dfn>)</dfn>, the following |
|
|
algorithm <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li>If <var>s</var> is an empty string, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-name-empty><code>xml-well-formedness-error</code></a>. |
|
|
Abort these steps.</li> |
|
|
<li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate |
|
|
<var>s</var> as an <abbr>XML</abbr> string</a>.</li> |
|
|
<li>If the first character in <var>s</var> is a character that is |
|
|
<em>not</em> in the character class |
|
|
<a href="#class-NameStartChar10"><code>NameStartChar10</code></a>, then raise |
|
|
an |
|
|
<a href="#xml-well-formedness-error" id=wfe-name-startchar><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If a character other than the first character in <var>s</var> is a |
|
|
character that is <em>not</em> in the character class |
|
|
<a href="#class-NameChar10"><code>NameChar10</code></a>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-name-char><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If <var>s</var> begins with the string <code>xml</code> (in any |
|
|
case combination), then raise an |
|
|
<a href="#xml-misc-warning" id=xmw-reserved-name><code>xml-misc-warning</code></a>. |
|
|
<span class=ed>@@ except for attribute names <code>xml:lang</code>, |
|
|
<code>xml:space</code>, <code>xml:base</code>, <code>xml:id</code>, |
|
|
<code>xmlns</code>, <code>xmlns:<var>*</var></code>, |
|
|
pi name <code>xml-stylesheet</code>.</span><!-- |
|
|
"names beginning with a match to (('X'|'x')('M'|'m')('L'|'l')) are reserved for standardization in this or future versions of this specification.": |
|
|
xmlns, xml-stylesheet, xml:base and xml:id specifications violate to this sentense! |
|
|
--></li> |
|
|
<!-- COLON in Name is a lowercase "should not" in a Note of [XML10], |
|
|
[XML11]. --> |
|
|
<li class=ed>@@ XML 1.1 support</li> |
|
|
</ol> |
|
|
|
|
|
<p>To |
|
|
<dfn id=algorithm-to-validate-an-ncname title="validate an NCName">validate |
|
|
an <code>NCName</code> (<dfn id=var-ncname-s><var>s</var></dfn>)</dfn>, the |
|
|
following algorithm <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-a-name" title="validate a Name">Validate |
|
|
<var>s</var> as a <code>Name</code></a>.</li> |
|
|
<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 |
|
|
following algorithm <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li>If <var>pid</var> is <code>null</code>, abort these steps.</li> |
|
|
<li>If <var>pid</var> contains a character that is <em>not</em> in the |
|
|
character class <a href="#class-PubidChar"><code>PubidChar</code></a>, then |
|
|
raise 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>. |
|
|
<span class=ed>Is this really a roundtripness problem? XML spec |
|
|
does only define the way to match public identifiers in fact, no |
|
|
canonical form.</span></li> |
|
|
</ol> |
|
|
|
|
|
<p>To |
|
|
<dfn id=algorithm-to-validate-a-system-identifier title="validate a system identifier">validate |
|
|
a system identifier (<dfn id=var-sid><var>sid</var></dfn>)</dfn>, the |
|
|
following algorithm <em class=rfc2119>MUST</em> be used:</p> |
|
|
<ol> |
|
|
<li>If <var>sid</var> is <code>null</code>, abort these steps.</li> |
|
|
<li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate |
|
|
<var>sid</var> as an <abbr>XML</abbr> string</a>.</li> |
|
|
<li>If <var>sid</var> contains both <code class=char>U+0022</code> |
|
|
<code class=charname>QUOTATION MARK</code> (<code class=char>"</code>) and |
|
|
<code class=char>U+0027</code> <code class=charname>APOSTROPHE</code> |
|
|
(<code class=char>'</code>) characters, raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-sid-lit><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If <var>sid</var> contains at least one <code class=char>U+0023</code> |
|
|
<code class=charname>NUMBER SIGN</code> (<code class=char>#</code>) |
|
|
character, then raise an |
|
|
<a href="#xml-misc-error" id=xme-sid-fragment><code>xml-misc-error</code></a>.</li> |
|
|
<li class=ed>@@ If <var>sid</var> cannot be converted to a URI |
|
|
reference, then raise a fact-level error (xml-misc-warning?).<!-- |
|
|
XML 1.0 has no conformance language for system identifier being |
|
|
a URI reference. --></li> |
|
|
</ol> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class=section id=checking-node> |
|
|
<h3>Checking <code>Node</code></h3> |
|
|
|
|
|
<p>The algorithm <dfn title="to check a node" id=algorithm-to-check-a-node>to |
|
|
check a node (<dfn id=var-n><var>n</var></dfn>)</dfn> is defined as |
|
|
following:</p> |
|
|
<dl class=switch> |
|
|
<dt>If <var>n</var> is an <code>Attr</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>If the <code>prefix</code> attribute value is different from |
|
|
<code>null</code>, then <a href="#algorithm-to-validate-an-ncname">validate |
|
|
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>For each node <dfn id=var-attr-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
|
|
<code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
|
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-attr-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-attr-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
|
|
</ol></li> |
|
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
|
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
|
|
and <code>value</code> attribute of <var>n</var> is neither |
|
|
<code>default</code> nor <code>preserve</code>, then it is an |
|
|
<a href="#xml-misc-error" id=xme-attr-xml-space><code>xml-misc-error</code></a>.<!-- |
|
|
Note that <!ATTLIST e xml:space (default|preserve) "a">... |
|
|
<e xml:space="default"/> is conforming and valid. --></li> |
|
|
<li class=ed>@@ xml:lang value is not a language tag [RFC 3066 or its |
|
|
successor] or an empty string, then xml-misc-warning |
|
|
(a "fact"-level error; not an XML error).</li> |
|
|
<li class=ed>@@ <code>specified</code>, |
|
|
<code>manakaiAttributeType</code> (#ValueType Validity constraint: Attribute Value Type)</li> |
|
|
<!-- xml:space MUST be declared to be valid. --> |
|
|
<li>Let <dfn id=var-v><var>v</var></dfn> be the value of the |
|
|
attribute <code>value</code> of <var>n</var>.</li> |
|
|
<li>Validate the <var>n</var> against the <span class=ed>declared |
|
|
type</span> as following: |
|
|
<dl class=switch> |
|
|
<dt class=ed><code>ID_ATTR</code></dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><span class=ed>Validate <var>v</var> as an |
|
|
<code>Name</code>.</span> If it fails, then raise an |
|
|
<a href="#xml-validity-error" id=vc-id-name><code>xml-validity-error</code></a>.</li> |
|
|
<li><span class=ed>If <code>ID</code> <var>v</var> is defined,</span> |
|
|
then raise an |
|
|
<a href="#xml-validity-error" id=vc-id-duplication><code>xml-validity-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt class=ed>IDREF_ATTR</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><span class=ed>Validate <var>v</var> as an |
|
|
<code>Name</code>.</span> If it fails, then raise an |
|
|
<a href="#xml-validity-error" id=vc-idref-name><code>xml-validity-error</code></a>.</li> |
|
|
<li><span class=ed>If <code>ID</code> <var>v</var> is NOT |
|
|
defined,</span> then raise an |
|
|
<a href="#xml-validity-error" id=vc-idref-match><code>xml-validity-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt class=ed>IDREFS_ATTR</dt> |
|
|
<dd class=ed>@@</dd> |
|
|
<dt class=ed>ENTITY_ATTR</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><span class=ed>Validate <var>v</var> as an |
|
|
<code>Name</code>.</span> If it fails, then raise an |
|
|
<a href="#xml-validity-error" id=vc-entname-name><code>xml-validity-error</code></a>.</li> |
|
|
<li><span class=ed>If <code>Entity</code> <var>v</var> is NOT |
|
|
defined,</span> then raise an |
|
|
<a href="#xml-validity-error" id=vc-entname-match><code>xml-validity-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt class=ed>ENTITIES_ATTR</dt> |
|
|
<dd class=ed>@@</dd> |
|
|
<dt class=ed>NMTOKEN_ATTR</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><span class=ed>Validate <var>v</var> as an |
|
|
<code>Nmtoken</code>.</span> If it fails, then raise an |
|
|
<a href="#xml-validity-error" id=vc-nmtok-name><code>xml-validity-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt class=ed>NMTOKENS_ATTR</dt> |
|
|
<dd class=ed>@@</dd> |
|
|
<dt class=ed>NOTATION_ATTR</dt> |
|
|
<dd class=ed><var>v</var> must be one of enumerated values. |
|
|
If not, then raise an |
|
|
<a href="#xml-validity-error" id=vc-notatn-match><code>xml-validity-error</code></a>.</dd> |
|
|
<dt class=ed>ENUMERATED_ATTR</dt> |
|
|
<dd class=ed><var>v</var> must be one of enumerated values. |
|
|
If not, then raise an |
|
|
<a href="#xml-validity-error" id=vc-enum><code>xml-validity-error</code></a>.</dd> |
|
|
<dt class=ed>@@</dt> |
|
|
</dl> |
|
|
</li> |
|
|
<li>If <span class=ed>type ID and default is NOT #IMPLIED or #REQUIRED</span>, then |
|
|
raise an |
|
|
<a href="#xml-validity-error" id=vc-id-default><code>xml-validity-error</code></a>.</li> |
|
|
<li class=ed>@@ #FixedAttr Validity constraint: Fixed Attribute Default</li> |
|
|
<li class=ed>@@ strict serialization error for U+000D, U+000A, and |
|
|
U+0009 characters, leading/trailing U+0020, and U+0020{2,} string?</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>AttributeDefinition</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li class=ed></li> |
|
|
<li>If <code>nodeName</code> attribute of <var>n</var> is |
|
|
<code>xml:space</code> <span class=ed>@@ or {xml namespace}:space ?</span> |
|
|
and <span class=ed>its declared type is different from (default|preserve), |
|
|
(default), or (preserve)</span>, then raise an |
|
|
<a href="#xml-misc-error" id=xme-at-xml-space><code>xml-misc-error</code></a>.</li> |
|
|
<li>For each node <dfn id=var-ad-nc><var>n<sub><var>c</var></sub></var></dfn> in the |
|
|
<code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
|
|
<code>Text</code> or <code>EntityReference</code> node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-at-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-at-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
|
|
</ol></li> |
|
|
<li class=ed>If <code>NOTATION_ATTR</code>, enumerated values MUST |
|
|
be declared. If not, then raise an |
|
|
<a href="#xml-validity-error" id=vc-notatn-declared><code>xml-validity-error</code></a>.</li> |
|
|
<li class=ed>If <code>NOTATION_ATTR</code> or <code>ENUMERATED_ATTR</code>, |
|
|
values MUST all be distinct. If not, then raise an |
|
|
<a href="#xml-validity-error" id=vc-no-duplicate-tokens><code>xml-validity-error</code></a>.</li> |
|
|
<li class=ed>If <code>NOTATION_ATTR</code> on an <code>EMPTY</code> |
|
|
element, then raise an |
|
|
<a href="#xml-validity-error" id=vc-no-notation-empty><code>xml-validity-error</code></a>.</li> |
|
|
<li class=ed>@@ #defattrvalid Validity constraint: Attribute Default Value Syntactically Correct</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>CDATASection</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the |
|
|
<code>data</code> attribute value as an <abbr>XML</abbr> character |
|
|
data</a>.</li> |
|
|
<li>If the <code>data</code> attribute value contains |
|
|
a string <code>]]></code>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-cs-mse><code>xml-well-formedness-error</code></a>.<!-- "for compatibility" --></li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-cs-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>Comment</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>Raise an |
|
|
<a href="#round-trip-warning" id=rtw-comment><code>round-trip-warning</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the |
|
|
<code>data</code> attribute value as an <abbr>XML</abbr> character |
|
|
data</a>.</li> |
|
|
<li>If the <code>data</code> attribute value contains |
|
|
a string <code>--</code>, or if it ends with a character |
|
|
<code>-</code>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-comment-com><code>xml-well-formedness-error</code></a>.<!-- |
|
|
"for compatibility" --></li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-comment-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>Document</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>If <a href="#xml-version"><abbr>XML</abbr> version</a> of <var>n</var> |
|
|
is different from <code>1.0</code> or <code>1.1</code>, |
|
|
then it is an <code class=ed>unknown-error?</code>.</li> |
|
|
<li>If the <code>xmlEncoding</code> attribute value does <em>not</em> |
|
|
match to <code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code> |
|
|
<span class=ed>@@ formal def</span>, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-encoding><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>The <code>childNodes</code> list of <var>n</var> have to |
|
|
consist of zero or more <code>Comment</code> and/or |
|
|
<code>ProcessingInstruction</code> nodes, followed by |
|
|
an optional <code>DocumentType</code> node, followed |
|
|
by zero or more <code>Comment</code> and/or |
|
|
<code>ProcessingInstruction</code> nodes, followed by |
|
|
an <code>Element</code> node, followed |
|
|
by zero or more <code>Comment</code> and/or |
|
|
<code>ProcessingInstruction</code> nodes. Any violation to this is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-document-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>For each node <dfn id=var-document-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>EntityReference</code> node, then |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
|
|
</ol></li> |
|
|
<li class=ed>@@ <code>allDeclarationsProcessed</code></li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>DocumentFragment</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>For each node <dfn id=var-df-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>Element</code>, <code>Text</code>, <code>CDATASection</code>, |
|
|
<code>Comment</code>, <code>ProcessingInstruction</code>, or |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-df-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-df-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
|
|
</ol></li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>DocumentType</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>Follow the following substeps: |
|
|
<ol> |
|
|
<li>If <code>ownerDocument</code> attribute of <var>n</var> is |
|
|
<code>null</code>, then abort these substeps.</li> |
|
|
<li>If <code>documentElement</code> attribute of the node |
|
|
set to <code>ownerDocument</code> attribute of <var>n</var> is |
|
|
<code>null</code>, then abort these substeps.</li> |
|
|
<li>If <code>nodeName</code> attribute of the node set to |
|
|
<code>documentElement</code> attribute of the node set to |
|
|
<code>ownerDocument</code> attribute of <var>n</var> is |
|
|
different from <code>nodeName</code> of <var>n</var>, |
|
|
then raise an |
|
|
<a href="#xml-validity-error" id=vc-roottype><code>xml-validity-error</code></a>.</li></li> |
|
|
</ol> |
|
|
</li> |
|
|
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
|
|
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate |
|
|
the <code>systemId</code> attribute value as a system identifier</a>.</li> |
|
|
<li>If the <code>publicId</code> attribute value of <var>n</var> is |
|
|
<em>not</em> <code>null</code> and the <code>systemId</code> attribute |
|
|
value of <var>n</var> is <code>null</code>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-dt-sid><code>xml-well-formedness-error</code></a>. |
|
|
<span class=ed>@@ publicId == null? Or, publicId == ""</span></li> |
|
|
<li>For each node <dfn id=var-dt-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> a |
|
|
<code>ProcessingInstruction</code> node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-dt-child><code>xml-well-formedness-error</code></a>. |
|
|
<span class=ed>@@ ref to manakai's extensions</span></li> |
|
|
<li>Otherwise, <!-- if n_c is not an EntityReference node, --> |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recusrively.</li> |
|
|
</ol></li> |
|
|
<li>For each node in the <code>entities</code>, <code>notations</code>, |
|
|
and <code>elementTypes</code> lists of <var>n</var>, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check the |
|
|
node</a> recursively.</li> |
|
|
<li class=ed>@@ externally declared?</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>Element</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>localName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>If the <code>prefix</code> attribute value is different from |
|
|
<code>null</code>, then <a href="#algorithm-to-validate-an-ncname">validate |
|
|
the <code>prefix</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>For each node <dfn id=var-element-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>Element</code>, |
|
|
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
|
|
<code>ProcessingInstruction</code>, or |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-element-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-element-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
|
|
</ol></li> |
|
|
<li class=ed>@@ #elementvalid Validity constraint: Element Valid</li> |
|
|
<li>Let <var>attrs</var> be the value of the <code>attribute</code> |
|
|
attribute of <var>n</var>. Check conformance of <var>attrs</var> |
|
|
as following: |
|
|
<ol> |
|
|
<li>If <var>attrs</var> contains an <code>Attr</code> node whose |
|
|
<code>nodeName</code> attribute value is equal to that of another |
|
|
<code>Attr</code> node in <var>attrs</var>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-uniqattspec><code>xml-well-formedness-error</code></a>.<!-- |
|
|
#uniqattspec Well-formedness constraint: Unique Att Spec --></li> |
|
|
<li class=ed>@@ #RequiredAttr Validity constraint: Required Attribute</li> |
|
|
</ol> |
|
|
</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>ElementTypeDefinition</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li class=ed></li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-et-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#elemdecls">At user option, an XML processor MAY issue a warning when a declaration mentions an element type for which no declaration is provided, but this is not an error.</q></li> |
|
|
<li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#sec-element-content">For compatibility, it is an error if the content model allows an element to match more than one occurrence of an element type in the content model. </q></li> |
|
|
<li class=ed>@@ #vc-MixedChildrenUnique |
|
|
Validity constraint: No Duplicate Types</li> |
|
|
<li class=ed>@@ <q cite="http://www.w3.org/TR/2006/REC-xml-20060816/#attdecls">At user option, an XML processor MAY issue a warning if attributes are declared for an element type not itself declared, but this is not an error.</q></li> |
|
|
<li>If there is more than one <code>AttributeDefinition</code> node |
|
|
with <span class=ed>attribute type <code>ID</code></span> in the |
|
|
<code>NamedNodeMap</code> list contained in the |
|
|
<code>attributeDefinitions</code> attribute of <var>n</var>, then raise an |
|
|
<a href="#xml-validity-error" id=vc-one-id-per-el><code>xml-validity-error</code></a>.</li> |
|
|
<li>If there is more than one <code>AttributeDefinition</code> node |
|
|
with <span class=ed>attribute type <code>NOTATION</code></span> in the |
|
|
<code>NamedNodeMap</code> list contained in the |
|
|
<code>attributeDefinitions</code> attribute of <var>n</var>, then raise an |
|
|
<a href="#xml-validity-error" id=vc-one-notation-per><code>xml-validity-error</code></a>.</li> |
|
|
<li class=ed>"For interoperability, the same Nmtoken SHOULD NOT occur more than once in the enumerated attribute types of a single element type."</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>Entity</code> node whose |
|
|
<code>notationName</code> attribute value is <code>null</code> (i.e. a |
|
|
parsed entity)</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>Raise an |
|
|
<a href="#entity-error" id=ee-entity-node><code>entity-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
|
|
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate |
|
|
the <code>systemId</code> attribute value as a system identifier</a>.</li> |
|
|
<li>If the <code>publicId</code> attribute value of <var>n</var> is |
|
|
<em>not</em> <code>null</code> and the <code>systemId</code> attribute |
|
|
value of <var>n</var> is <code>null</code>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-entity-sid><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>For each node <dfn id=var-entity-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>Element</code>, |
|
|
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
|
|
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
|
|
node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-entity-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-er-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
|
|
</ol></li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>Entity</code> node whose |
|
|
<code>notationName</code> attribute value is <em>not</em> <code>null</code> |
|
|
(i.e. an unparsed entity)</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
|
|
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate |
|
|
the <code>systemId</code> attribute value as a system identifier</a>.</li> |
|
|
<li>If the <code>systemId</code> attribute value of <var>n</var> is |
|
|
<code>null</code>, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-uentity-sid><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>notationName</code> attribute value of <var>n</var> as an |
|
|
<code>NCName</code></a>.</li> |
|
|
<li class=ed>@@ #not-declared Validity constraint: Notation Declared</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-uentity-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is an <code>EntityReference</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>An <a href="#entity-error" id=ee-er-node><code>entity-error</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>For each node <dfn id=var-er-nc><var>n<sub><var>c</var></sub></var></dfn> |
|
|
in the <code>childNodes</code> list of <var>n</var>, |
|
|
<ol> |
|
|
<li>If <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>Element</code>, |
|
|
<code>Text</code>, <code>CDATASection</code>, <code>Comment</code>, |
|
|
<code>ProcessingInstruction</code>, or <code>EntityReference</code> |
|
|
node, then it is an |
|
|
<a href="#xml-well-formedness-error" id=wfe-er-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, if <var>n<sub><var>c</var></sub></var> is <em>not</em> an |
|
|
<code>EntityReference</code> node, then it is an |
|
|
<a href="#entity-error" id=ee-entity-er><code>entity-error</code></a>.</li> |
|
|
<li>Otherwise, |
|
|
<a href="#algorithm-to-check-a-node" title="check a node">check |
|
|
<var>n<sub><var>c</var></sub></var></a> recursively.</li> |
|
|
</ol></li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>Notation</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-ncname">Validate the |
|
|
<code>nodeName</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-public-identifier" title="validate a public identifier">Validate |
|
|
the <code>publicId</code> attribute value as a public identifier</a>.</li> |
|
|
<li><a href="#algorithm-to-validate-a-system-identifier" title="validate a system identifier">Validate |
|
|
the <code>systemId</code> attribute value as a system identifier</a>.</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-notation-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>ProcessingInstruction</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li>If the <code>target</code> attribute value matches to the string |
|
|
<code>xml</code> in any case combination, then raise a |
|
|
<a href="#xml-well-formedness-error" id=wfe-pi-xml><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>Otherwise, <a href="#algorithm-to-validate-an-ncname">validate the |
|
|
<code>target</code> attribute value as an <code>NCName</code></a>.</li> |
|
|
<li>Then, |
|
|
<a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">validate |
|
|
the <code>data</code> attribute value as an <abbr>XML</abbr> character |
|
|
data</a>.</li> |
|
|
<li>If the <code>data</code> attribute value contains a string |
|
|
<code>?></code>, then raise a |
|
|
<a href="#xml-well-formedness-error" id=wfe-pi-pic><code>xml-well-formedness-error</code></a>.</li> |
|
|
<li>If the <code>data</code> attribute value starts with either |
|
|
<code class=char>U+0009</code> <code class=charname>CHARACTER |
|
|
TABULATION</code>, <code class=char>U+000A</code> <code class=charname>LINE |
|
|
FEED</code>, <code class=char>U+000D</code> <code class=charname>CARRIAGE |
|
|
RETURN</code>, or <code class=char>U+0020</code> |
|
|
<code class=charname>SPACE</code> character, then raise a |
|
|
<a href="#round-trip-error" id=rte-pi-s><code>round-trip-error</code></a>.</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, then raise an |
|
|
<a href="#xml-well-formedness-error" id=wfe-pi-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>If <var>n</var> is a <code>Text</code> node</dt> |
|
|
<dd> |
|
|
<ol> |
|
|
<li><a href="#algorithm-to-validate-an-xml-character-data" title="validate an XML string">Validate the |
|
|
<code>data</code> attribute value as an <abbr>XML</abbr> character |
|
|
data</a>.</li> |
|
|
<li>If the <code>childNodes</code> list of <var>n</var> contains |
|
|
any nodes, they are in |
|
|
<a href="#xml-well-formedness-error" id=wfe-text-child><code>xml-well-formedness-error</code></a>.</li> |
|
|
</ol> |
|
|
</dd> |
|
|
<dt>Otherwise</dt> |
|
|
<dd><span class=ed>xml-well-formedness-error? unknown-error?</span></dd> |
|
|
</dl> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div id=classes class=section> |
|
|
<h2>Character Classes</h2> |
|
|
|
|
|
<p>This section defines a couple of character classes. |
|
|
These classes are referred to by algorithms specified above.</p> |
|
|
|
|
|
<p>Character class <dfn id=class-Char10><code>Char10</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul> |
|
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
|
|
TABULATION</code></li> |
|
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
|
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
|
|
RETURN</code></li> |
|
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code> |
|
|
.. <code class=char>U+D7FF</code></li> |
|
|
<li><code class=char>U+E000</code> .. <code class=char>U+FFFD</code> |
|
|
<code class=charname>REPLACEMENT CHARACTER</code></li> |
|
|
<li><code class=char>U+10000</code> .. <code class=char>U+10FFFF</code></li> |
|
|
</ul> |
|
|
<div class="note memo"> |
|
|
<p>This character class contains all characters allowed in the production rule |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Char"><code>Char</code></a> |
|
|
of <abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
|
|
</div> |
|
|
|
|
|
<p>Character class <dfn id=class-CompatChar10><code>CompatChar10</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul> |
|
|
<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> |
|
|
</ul> |
|
|
|
|
|
<p>Character class <dfn id=class-ControlChar10><code>ControlChar10</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul> |
|
|
<li><code class=char>U+007F</code> <code class=charname>DELETE</code> .. |
|
|
<code class=char>U+0084</code> <code class=charname>INDEX</code></li> |
|
|
<li><code class=char>U+0086</code> <code class=charname>START OF SELECTED |
|
|
AREA</code> .. <code class=char>U+009F</code> <code class=charname>APPLICATION |
|
|
PROGRAM COMMAND</code></li> |
|
|
<li><code class=char>U+FDD0</code> .. <code class=char>U+FDEF</code></li> |
|
|
<li><code class=char>U+1FFFE</code> .. <code class=char>U+1FFFF</code></li> |
|
|
<li><code class=char>U+2FFFE</code> .. <code class=char>U+2FFFF</code></li> |
|
|
<li><code class=char>U+3FFFE</code> .. <code class=char>U+3FFFF</code></li> |
|
|
<li><code class=char>U+4FFFE</code> .. <code class=char>U+4FFFF</code></li> |
|
|
<li><code class=char>U+5FFFE</code> .. <code class=char>U+5FFFF</code></li> |
|
|
<li><code class=char>U+6FFFE</code> .. <code class=char>U+6FFFF</code></li> |
|
|
<li><code class=char>U+7FFFE</code> .. <code class=char>U+7FFFF</code></li> |
|
|
<li><code class=char>U+8FFFE</code> .. <code class=char>U+8FFFF</code></li> |
|
|
<li><code class=char>U+9FFFE</code> .. <code class=char>U+9FFFF</code></li> |
|
|
<li><code class=char>U+AFFFE</code> .. <code class=char>U+AFFFF</code></li> |
|
|
<li><code class=char>U+BFFFE</code> .. <code class=char>U+BFFFF</code></li> |
|
|
<li><code class=char>U+CFFFE</code> .. <code class=char>U+CFFFF</code></li> |
|
|
<li><code class=char>U+DFFFE</code> .. <code class=char>U+DFFFF</code></li> |
|
|
<li><code class=char>U+EFFFE</code> .. <code class=char>U+EFFFF</code></li> |
|
|
<li><code class=char>U+FFFFE</code> .. <code class=char>U+FFFFF</code></li> |
|
|
<li><code class=char>U+10FFFE</code> .. <code class=char>U+10FFFF</code></li> |
|
|
</ul> |
|
|
<div class="note memo"> |
|
|
<p>This character class contains the characters listed in the Note in |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#charsets">Section 2.2</a> |
|
|
of <abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>, |
|
|
as amended by |
|
|
<a href="http://www.w3.org/XML/xml-V10-4e-errata#E02">errata</a>.</p> |
|
|
</div> |
|
|
|
|
|
<p>The character class <dfn id=class-NameStartChar10><code>NameStartChar10</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul class=ed> |
|
|
</ul> |
|
|
<div class="note memo"> |
|
|
<p>This character class contains all characters allowed as the first character |
|
|
of a string matching to the production rule |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name"><code>Name</code></a> |
|
|
of <abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
|
|
</div> |
|
|
|
|
|
<p>The character class <dfn id=class-NameChar10><code>NameChar10</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul> |
|
|
<li>The characters in the character class |
|
|
<a href="#class-NameStartChar10">NameStartChar10</a>.</li> |
|
|
<li class=ed></li> |
|
|
</ul> |
|
|
<div class="note memo"> |
|
|
<p>This character class contains all characters allowed as the second |
|
|
character of a string matching to the production rule |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name"><code>Name</code></a> |
|
|
of <abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
|
|
</div> |
|
|
|
|
|
<p>The character class <dfn id=class-PubidChar><code>PubidChar</code></dfn> |
|
|
contains the following characters:</p> |
|
|
<ul> |
|
|
<li><code class=char>U+0009</code> <code class=charname>CHARACTER |
|
|
TABULATION</code></li> |
|
|
<li><code class=char>U+000A</code> <code class=charname>LINE FEED</code></li> |
|
|
<li><code class=char>U+000D</code> <code class=charname>CARRIAGE |
|
|
RETURN</code></li> |
|
|
<li><code class=char>U+0020</code> <code class=charname>SPACE</code></li> |
|
|
<li><code class=char>U+0021</code> <code class=charname>EXCLAMATION MARK</code> |
|
|
(<code class=char>!</code>)</li> |
|
|
<li><code class=char>U+0023</code> <code class=charname>DOLLAR SIGN</code> |
|
|
(<code class=char>$</code>)</li> |
|
|
<li><code class=char>U+0024</code> <code class=charname>NUMBER SIGN</code> |
|
|
(<code class=char>#</code>)</li> |
|
|
<li><code class=char>U+0025</code> <code class=charname>PERCENT SIGN</code> |
|
|
(<code class=char>%</code>)</li> |
|
|
<li><code class=char>U+0027</code> <code class=charname>APOSTROPHE</code> |
|
|
(<code class=char>'</code>)</li> |
|
|
<li><code class=char>U+0028</code> <code class=charname>LEFT PARENTHESIS</code> |
|
|
(<code class=char>(</code>)</li> |
|
|
<li><code class=char>U+0029</code> <code class=charname>RIGHT |
|
|
PARENTHESIS</code> (<code class=char>)</code>)</li> |
|
|
<li><code class=char>U+002A</code> <code class=charname>ASTERISK</code> |
|
|
(<code class=char>*</code>)</li> |
|
|
<li><code class=char>U+002B</code> <code class=charname>PLUS SIGN</code> |
|
|
(<code class=char>+</code>)</li> |
|
|
<li><code class=char>U+002C</code> <code class=charname>COMMA</code> |
|
|
(<code class=char>,</code>)</li> |
|
|
<li><code class=char>U+002D</code> <code class=charname>HYPHEN-MINUS</code> |
|
|
(<code class=char>-</code>)</li> |
|
|
<li><code class=char>U+002E</code> <code class=charname>FULL STOP</code> |
|
|
(<code class=char>.</code>)</li> |
|
|
<li><code class=char>U+002F</code> <code class=charname>SOLIDUS</code> |
|
|
(<code class=char>/</code>)</li> |
|
|
<li><code class=char>U+0030</code> <code class=charname>DIGIT ZERO</code> |
|
|
(<code class=char>0</code>) .. <code class=char>U+0039</code> |
|
|
<code class=charname>DIGIT NINE</code> (<code class=char>9</code>)</li> |
|
|
<li><code class=char>U+003A</code> <code class=charname>COLON</code> |
|
|
(<code class=char>:</code>)</li> |
|
|
<li><code class=char>U+003B</code> <code class=charname>SEMICOLON</code> |
|
|
(<code class=char>;</code>)</li> |
|
|
<li><code class=char>U+003D</code> <code class=charname>EQUAL SIGN</code> |
|
|
(<code class=char>=</code>)</li> |
|
|
<li><code class=char>U+003F</code> <code class=charname>QUESTION MARK</code> |
|
|
(<code class=char>?</code>)</li> |
|
|
<li><code class=char>U+0040</code> <code class=charname>COMMERCIAL AT</code> |
|
|
(<code class=char>@</code>)</li> |
|
|
<li><code class=char>U+0041</code> <code class=charname>LATIN CAPITAL LETTER |
|
|
A</code> (<code class=char>A</code>) .. <code class=char>U+005A</code> |
|
|
<code class=charname>LATIN CAPITAL LETTER Z</code> |
|
|
(<code class=char>Z</code>)</li> |
|
|
<li><code class=char>U+005F</code> <code class=charname>LOW LINE</code> |
|
|
(<code class=char>_</code>)</li> |
|
|
<li><code class=char>U+0061</code> <code class=charname>LATIN CAPITAL LETTER |
|
|
A</code> (<code class=char>A</code>) .. <code class=char>U+007A</code> |
|
|
<code class=charname>LATIN CAPITAL LETTER Z</code> |
|
|
(<code class=char>Z</code>)</li> |
|
|
</ul> |
|
|
<div class="note memo"> |
|
|
<p>This character class contains all characters allowed in the production rule |
|
|
<a href="http://www.w3.org/TR/2006/REC-xml-20060816/#NT-PubidChar"><code>PubidChar</code></a> |
|
|
of <abbr>XML</abbr> 1.0 |
|
|
<cite class="bibref normative">[<a href="#ref-XML10">XML10</a>]</cite>.</p> |
|
|
</div> |
|
|
|
|
|
</div> |
|
116 |
|
|
117 |
<div id="references" class="section reference"> |
<div id="references" class="section reference"> |
118 |
<h2>References</h2> |
<h2>References</h2> |