UNPKG

node10-libxslt

Version:

[Fork] Node.js bindings for libxslt compatible with libxmljs

539 lines (506 loc) 211 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="EN"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Extensible Markup Language (XML) 1.0 (Second Edition) -- Review Version</title><style type="text/css"> code { font-family: monospace; } div.constraint, div.issue, div.note, div.notice { margin-left: 2em; } dt.label { display: run-in; } li p { margin-top: 0.3em; margin-bottom: 0.3em; } div.diff-add { background-color: yellow } div.diff-del { text-decoration: line-through } div.diff-chg { background-color: lime } div.diff-off { } span.diff-add { background-color: yellow } span.diff-del { text-decoration: line-through } span.diff-chg { background-color: lime } span.diff-off { } td.diff-add { background-color: yellow } td.diff-del { text-decoration: line-through } td.diff-chg { background-color: lime } td.diff-off { } </style><link rel="stylesheet" type="text/css" href="W3C-REC.css"></head><body> <div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a></p> <h1>Extensible Markup Language (XML) 1.0 (Second Edition)</h1> <h2>W3C Recommendation 6 October 2000</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2000/REC-xml-20001006">http://www.w3.org/TR/2000/REC-xml-20001006</a> (<a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XHTML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.xml">XML</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006.pdf">PDF</a>, <a href="http://www.w3.org/TR/2000/REC-xml-20001006-review.html">XHTML review version</a> with color-coded revision indicators)</dd><dt>Latest version:</dt><dd><a href="http://www.w3.org/TR/REC-xml">http://www.w3.org/TR/REC-xml</a></dd><dt>Previous versions:</dt><dd><a href="http://www.w3.org/TR/2000/WD-xml-2e-20000814"> http://www.w3.org/TR/2000/WD-xml-2e-20000814</a> <a href="http://www.w3.org/TR/1998/REC-xml-19980210"> http://www.w3.org/TR/1998/REC-xml-19980210</a> </dd><dt>Editors:</dt> <dd>Tim Bray, Textuality and Netscape <a href="mailto:tbray@textuality.com">&lt;tbray@textuality.com&gt;</a></dd> <dd>Jean Paoli, Microsoft <a href="mailto:jeanpa@microsoft.com">&lt;jeanpa@microsoft.com&gt;</a></dd> <dd><span class="diff-chg">C. M. Sperberg-McQueen, University of Illinois at Chicago and Text Encoding Initiative <a href="mailto:cmsmcq@uic.edu">&lt;cmsmcq@uic.edu&gt;</a></span></dd> <dd><span class="diff-add">Eve Maler, Sun Microsystems, Inc. <a href="mailto:elm@east.sun.com">&lt;eve.maler@east.sun.com&gt;</a> - Second Edition</span></dd> </dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>���2000�<a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>�</sup> (<a href="http://www.lcs.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.inria.fr/"><abbr lang="fr" title="Institut National de Recherche en Informatique et Automatique">INRIA</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a>, <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990405">document use</a>, and <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980720">software licensing</a> rules apply.</p></div><hr><div id="abstract"> <h2><a name="abstract">Abstract</a></h2> <p>The Extensible Markup Language (XML) is a subset of SGML that is completely described in this document. Its goal is to enable generic SGML to be served, received, and processed on the Web in the way that is now possible with HTML. XML has been designed for ease of implementation and for interoperability with both SGML and HTML.</p> </div><div id="status"> <h2><a name="status">Status of this Document</a></h2> <p>This document has been reviewed by W3C Members and other interested parties and has been endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited as a normative reference from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.</p> <p>This document specifies a syntax created by subsetting an existing, widely used international text processing standard (Standard Generalized Markup Language, ISO 8879:1986(E) as amended and corrected) for use on the World Wide Web. It is a product of the W3C XML Activity, details of which can be found at <a href="http://www.w3.org/XML/">http://www.w3.org/XML</a>. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E100">[E100]</a> The English version of this specification is the only normative version. However, for translations of this document, see <a href="http://www.w3.org/XML/#trans">http://www.w3.org/XML/#trans</a>. </span>A list of current W3C Recommendations and other technical documents can be found at <a href="http://www.w3.org/TR/">http://www.w3.org/TR</a>.</p> <div class="diff-del"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E66">[E66]</a>This specification uses the term URI, which is defined by <a href="#Berners-Lee">[Berners-Lee et al.]</a>, a work in progress expected to update <a href="#RFC1738">[IETF RFC1738]</a> and <a href="#RFC1808">[IETF RFC1808]</a>.</p></div> <div class="diff-add"><p>This second edition is <em>not</em> a new version of XML (first published 10 February 1998); it merely incorporates the changes dictated by the first-edition errata (available at <a href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</a>) as a convenience to readers. The errata list for this second edition is available at <a href="http://www.w3.org/XML/xml-V10-2e-errata">http://www.w3.org/XML/xml-V10-2e-errata</a>.</p></div> <p>Please report errors in this document to <a href="mailto:xml-editor@w3.org">xml-editor@w3.org</a><span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E101">[E101]</a>; <a href="http://lists.w3.org/Archives/Public/xml-editor">archives</a> are available</span>.</p> <div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p> <p>C. M. Sperberg-McQueen's affiliation has changed since the publication of the first edition. He is now at the World Wide Web Consortium, and can be contacted at <a href="mailto:cmsmcq@w3.org">cmsmcq@w3.org</a>.</p> </div></div> </div> <div class="toc"> <h2><a name="contents">Table of Contents</a></h2><p class="toc">1 <a href="#sec-intro">Introduction</a><br>����1.1 <a href="#sec-origin-goals">Origin and Goals</a><br>����1.2 <a href="#sec-terminology">Terminology</a><br>2 <a href="#sec-documents">Documents</a><br>����2.1 <a href="#sec-well-formed">Well-Formed XML Documents</a><br>����2.2 <a href="#charsets">Characters</a><br>����2.3 <a href="#sec-common-syn">Common Syntactic Constructs</a><br>����2.4 <a href="#syntax">Character Data and Markup</a><br>����2.5 <a href="#sec-comments">Comments</a><br>����2.6 <a href="#sec-pi">Processing Instructions</a><br>����2.7 <a href="#sec-cdata-sect">CDATA Sections</a><br>����2.8 <a href="#sec-prolog-dtd">Prolog and Document Type Declaration</a><br>����2.9 <a href="#sec-rmd">Standalone Document Declaration</a><br>����2.10 <a href="#sec-white-space">White Space Handling</a><br>����2.11 <a href="#sec-line-ends">End-of-Line Handling</a><br>����2.12 <a href="#sec-lang-tag">Language Identification</a><br>3 <a href="#sec-logical-struct">Logical Structures</a><br>����3.1 <a href="#sec-starttags">Start-Tags, End-Tags, and Empty-Element Tags</a><br>����3.2 <a href="#elemdecls">Element Type Declarations</a><br>��������3.2.1 <a href="#sec-element-content">Element Content</a><br>��������3.2.2 <a href="#sec-mixed-content">Mixed Content</a><br>����3.3 <a href="#attdecls">Attribute-List Declarations</a><br>��������3.3.1 <a href="#sec-attribute-types">Attribute Types</a><br>��������3.3.2 <a href="#sec-attr-defaults">Attribute Defaults</a><br>��������3.3.3 <a href="#AVNormalize">Attribute-Value Normalization</a><br>����3.4 <a href="#sec-condition-sect">Conditional Sections</a><br>4 <a href="#sec-physical-struct">Physical Structures</a><br>����4.1 <a href="#sec-references">Character and Entity References</a><br>����4.2 <a href="#sec-entity-decl">Entity Declarations</a><br>��������4.2.1 <a href="#sec-internal-ent">Internal Entities</a><br>��������4.2.2 <a href="#sec-external-ent">External Entities</a><br>����4.3 <a href="#TextEntities">Parsed Entities</a><br>��������4.3.1 <a href="#sec-TextDecl">The Text Declaration</a><br>��������4.3.2 <a href="#wf-entities">Well-Formed Parsed Entities</a><br>��������4.3.3 <a href="#charencoding">Character Encoding in Entities</a><br>����4.4 <a href="#entproc">XML Processor Treatment of Entities and References</a><br>��������4.4.1 <a href="#not-recognized">Not Recognized</a><br>��������4.4.2 <a href="#included">Included</a><br>��������4.4.3 <a href="#include-if-valid">Included If Validating</a><br>��������4.4.4 <a href="#forbidden">Forbidden</a><br>��������4.4.5 <a href="#inliteral">Included in Literal</a><br>��������4.4.6 <a href="#notify">Notify</a><br>��������4.4.7 <a href="#bypass">Bypassed</a><br>��������4.4.8 <a href="#as-PE">Included as PE</a><br>����4.5 <a href="#intern-replacement">Construction of Internal Entity Replacement Text</a><br>����4.6 <a href="#sec-predefined-ent">Predefined Entities</a><br>����4.7 <a href="#Notations">Notation Declarations</a><br>����4.8 <a href="#sec-doc-entity">Document Entity</a><br>5 <a href="#sec-conformance">Conformance</a><br>����5.1 <a href="#proc-types">Validating and Non-Validating Processors</a><br>����5.2 <a href="#safe-behavior">Using XML Processors</a><br>6 <a href="#sec-notation">Notation</a><br></p> <h3>Appendices</h3><p class="toc">A <a href="#sec-bibliography">References</a><br>����A.1 <a href="#sec-existing-stds">Normative References</a><br>����A.2 <a href="#null">Other References</a><br>B <a href="#CharClasses">Character Classes</a><br>C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br>D <a href="#sec-entexpand">Expansion of Entity and Character References</a> (Non-Normative)<br>E <a href="#determinism">Deterministic Content Models</a> (Non-Normative)<br>F <a href="#sec-guessing">Autodetection of Character Encodings</a> (Non-Normative)<br>����F.1 <a href="#sec-guessing-no-ext-info">Detection Without External Encoding Information</a><br>����F.2 <a href="#sec-guessing-with-ext-info">Priorities in the Presence of External Encoding Information</a><br>G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br>H <a href="#sec-core-wg">W3C XML Core Group</a> (Non-Normative)<br>I <a href="#id2683713">Production Notes</a> (Non-Normative)<br></p></div><hr><div class="body"> <div class="div1"> <h2><a name="sec-intro"></a>1 Introduction</h2> <p>Extensible Markup Language, abbreviated XML, describes a class of data objects called <a title="XML Document" href="#dt-xml-doc">XML documents</a> and partially describes the behavior of computer programs which process them. XML is an application profile or restricted form of SGML, the Standard Generalized Markup Language <a href="#ISO8879">[ISO 8879]</a>. By construction, XML documents are conforming SGML documents.</p> <p>XML documents are made up of storage units called <a title="Entity" href="#dt-entity">entities</a>, which contain either parsed or unparsed data. Parsed data is made up of <a title="Character" href="#dt-character">characters</a>, some of which form <a title="Character Data" href="#dt-chardata">character data</a>, and some of which form <a title="Markup" href="#dt-markup">markup</a>. Markup encodes a description of the document's storage layout and logical structure. XML provides a mechanism to impose constraints on the storage layout and logical structure.</p> <p>[<a name="dt-xml-proc" title="XML Processor">Definition</a>: A software module called an <b>XML processor</b> is used to read XML documents and provide access to their content and structure.] [<a name="dt-app" title="Application">Definition</a>: It is assumed that an XML processor is doing its work on behalf of another module, called the <b>application</b>.] This specification describes the required behavior of an XML processor in terms of how it must read XML data and the information it must provide to the application.</p> <div class="div2"> <h3><a name="sec-origin-goals"></a>1.1 Origin and Goals</h3> <p>XML was developed by an XML Working Group (originally known as the SGML Editorial Review Board) formed under the auspices of the World Wide Web Consortium (W3C) in 1996. It was chaired by Jon Bosak of Sun Microsystems with the active participation of an XML Special Interest Group (previously known as the SGML Working Group) also organized by the W3C. The membership of the XML Working Group is given in an appendix. Dan Connolly served as the WG's contact with the W3C.</p> <p>The design goals for XML are:</p> <ol> <li><p>XML shall be straightforwardly usable over the Internet.</p></li> <li><p>XML shall support a wide variety of applications.</p></li> <li><p>XML shall be compatible with SGML.</p></li> <li><p>It shall be easy to write programs which process XML documents.</p> </li> <li><p>The number of optional features in XML is to be kept to the absolute minimum, ideally zero.</p></li> <li><p>XML documents should be human-legible and reasonably clear.</p></li> <li><p>The XML design should be prepared quickly.</p></li> <li><p>The design of XML shall be formal and concise.</p></li> <li><p>XML documents shall be easy to create.</p></li> <li><p>Terseness in XML markup is of minimal importance.</p></li> </ol> <p>This specification, together with associated standards (Unicode and ISO/IEC 10646 for characters, Internet RFC 1766 for language identification tags, ISO 639 for language name codes, and ISO 3166 for country name codes), provides all the information necessary to understand XML Version 1.0 and construct computer programs to process it.</p> <p>This version of the XML specification may be distributed freely, as long as all text and legal notices remain intact.</p> </div> <div class="div2"> <h3><a name="sec-terminology"></a>1.2 Terminology</h3> <p>The terminology used to describe XML documents is defined in the body of this specification. The terms defined in the following list are used in building those definitions and in describing the actions of an XML processor: </p><dl> <dt class="label">may</dt> <dd> <p>[<a name="dt-may" title="May">Definition</a>: Conforming documents and XML processors are permitted to but need not behave as described.]</p> </dd> <dt class="label">must</dt> <dd> <p>[<a name="dt-must" title="Must">Definition</a>: Conforming documents and XML processors are required to behave as described; otherwise they are in error. ]</p> </dd> <dt class="label">error</dt> <dd> <p>[<a name="dt-error" title="Error">Definition</a>: A violation of the rules of this specification; results are undefined. Conforming software may detect and report an error and may recover from it.]</p> </dd> <dt class="label">fatal error</dt> <dd> <p>[<a name="dt-fatal" title="Fatal Error">Definition</a>: An error which a conforming <a title="XML Processor" href="#dt-xml-proc">XML processor</a> must detect and report to the application. After encountering a fatal error, the processor may continue processing the data to search for further errors and may report such errors to the application. In order to support correction of errors, the processor may make unprocessed data from the document (with intermingled character data and markup) available to the application. Once a fatal error is detected, however, the processor must not continue normal processing (i.e., it must not continue to pass character data and information about the document's logical structure to the application in the normal way).]</p> </dd> <dt class="label">at user option</dt> <dd> <p>[<a name="dt-atuseroption" title="At user option">Definition</a>: Conforming software may or must (depending on the modal verb in the sentence) behave as described; if it does, it must provide users a means to enable or disable the behavior described.]</p> </dd> <dt class="label">validity constraint</dt> <dd> <p>[<a name="dt-vc" title="Validity constraint">Definition</a>: A rule which applies to all <a title="Validity" href="#dt-valid">valid</a> XML documents. Violations of validity constraints are errors; they must, at user option, be reported by <a title="Validating Processor" href="#dt-validating">validating XML processors</a>.]</p> </dd> <dt class="label">well-formedness constraint</dt> <dd> <p>[<a name="dt-wfc" title="Well-formedness constraint">Definition</a>: A rule which applies to all <a title="Well-Formed" href="#dt-wellformed">well-formed</a> XML documents. Violations of well-formedness constraints are <a title="Fatal Error" href="#dt-fatal">fatal errors</a>.]</p> </dd> <dt class="label">match</dt> <dd> <p>[<a name="dt-match" title="match">Definition</a>: (Of strings or names:) Two strings or names being compared must be identical. Characters with multiple possible representations in ISO/IEC 10646 (e.g. characters with both precomposed and base+diacritic forms) match only if they have the same representation in both strings. <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E85">[E85]</a>At user option, processors may normalize such characters to some canonical form. </span>No case folding is performed. (Of strings and rules in the grammar:) A string matches a grammatical production if it belongs to the language generated by that production. (Of content and content models:) An element matches its declaration when it conforms in the fashion described in the constraint <a href="#elementvalid"><b>[VC: Element Valid]</b></a>.]</p> </dd> <dt class="label">for compatibility</dt> <dd> <p>[<a name="dt-compat" title="For Compatibility">Definition</a>: <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</a>Marks a sentence describing</span> a feature of XML included solely to ensure that XML remains compatible with SGML.]</p> </dd> <dt class="label">for interoperability</dt> <dd> <p>[<a name="dt-interop" title="For interoperability">Definition</a>: <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E87">[E87]</a>Marks a sentence describing</span> a non-binding recommendation included to increase the chances that XML documents can be processed by the existing installed base of SGML processors which predate the WebSGML Adaptations Annex to ISO 8879.]</p> </dd> </dl><p></p> </div> </div> <div class="div1"> <h2><a name="sec-documents"></a>2 Documents</h2> <p>[<a name="dt-xml-doc" title="XML Document">Definition</a>: A data object is an <b>XML document</b> if it is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>, as defined in this specification. A well-formed XML document may in addition be <a title="Validity" href="#dt-valid">valid</a> if it meets certain further constraints.]</p> <p>Each XML document has both a logical and a physical structure. Physically, the document is composed of units called <a title="Entity" href="#dt-entity">entities</a>. An entity may <a title="Entity Reference" href="#dt-entref">refer</a> to other entities to cause their inclusion in the document. A document begins in a "root" or <a title="Document Entity" href="#dt-docent">document entity</a>. Logically, the document is composed of declarations, elements, comments, character references, and processing instructions, all of which are indicated in the document by explicit markup. The logical and physical structures must nest properly, as described in <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a>.</p> <div class="div2"> <h3><a name="sec-well-formed"></a>2.1 Well-Formed XML Documents</h3> <p>[<a name="dt-wellformed" title="Well-Formed">Definition</a>: A textual object is a <b>well-formed</b> XML document if:]</p> <ol> <li><p>Taken as a whole, it matches the production labeled <a href="#NT-document">document</a>.</p> </li> <li><p>It meets all the well-formedness constraints given in this specification.</p> </li> <li><p>Each of the <a title="Text Entity" href="#dt-parsedent">parsed entities</a> which is referenced directly or indirectly within the document is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>.</p></li> </ol> <h5>Document</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-document"></a>[1]���</td><td><code>document</code></td><td>���::=���</td><td><code><a href="#NT-prolog">prolog</a> <a href="#NT-element">element</a> <a href="#NT-Misc">Misc</a>*</code></td><xsltdebug></xsltdebug></tr></tbody></table> <p>Matching the <a href="#NT-document">document</a> production implies that:</p> <ol> <li><p>It contains one or more <a title="Element" href="#dt-element">elements</a>.</p> </li> <li><p>[<a name="dt-root" title="Root Element">Definition</a>: There is exactly one element, called the <b>root</b>, or document element, no part of which appears in the <a title="Content" href="#dt-content">content</a> of any other element.] <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E17">[E17]</a>For all other elements, if the <a title="Start-Tag" href="#dt-stag">start-tag</a> is in the content of another element, the <a title="End Tag" href="#dt-etag">end-tag</a> is in the content of the same element.</span> More simply stated, the elements, delimited by start- and end-tags, nest properly within each other.</p></li> </ol> <p>[<a name="dt-parentchild" title="Parent/Child">Definition</a>: As a consequence of this, for each non-root element <code>C</code> in the document, there is one other element <code>P</code> in the document such that <code>C</code> is in the content of <code>P</code>, but is not in the content of any other element that is in the content of <code>P</code>. <code>P</code> is referred to as the <b>parent</b> of <code>C</code>, and <code>C</code> as a <b>child</b> of <code>P</code>.]</p> </div> <div class="div2"> <h3><a name="charsets"></a>2.2 Characters</h3> <p>[<a name="dt-text" title="Text">Definition</a>: A parsed entity contains <b>text</b>, a sequence of <a title="Character" href="#dt-character">characters</a>, which may represent markup or character data.] [<a name="dt-character" title="Character">Definition</a>: A <b>character</b> is an atomic unit of text as specified by ISO/IEC 10646 <a href="#ISO10646">[ISO/IEC 10646]</a> <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>(see also <a href="#ISO10646-2000">[ISO/IEC 10646-2000]</a>)</span>. Legal characters are tab, carriage return, line feed, and the legal <span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E35">[E35]</a>graphic </span>characters of Unicode and ISO/IEC 10646. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E69">[E69]</a>The versions of these standards cited in <a href="#sec-existing-stds"><b>A.1 Normative References</b></a> were current at the time this document was prepared. New characters may be added to these standards by amendments or new editions. Consequently, XML processors must accept any character in the range specified for <a href="#NT-Char">Char</a>.</span> The use of "compatibility characters", as defined in section 6.8 of <a href="#Unicode">[Unicode]</a> <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E67">[E67]</a>(see also D21 in section 3.6 of <a href="#Unicode3">[Unicode3]</a>)</span>, is discouraged.]</p> <h5>Character Range</h5><table class="scrap" summary="Scrap"><tbody> <tr valign="baseline"><td><a name="NT-Char"></a>[2]���</td><td><code>Char</code></td><td>���::=���</td><td><code>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]</code></td><xsltdebug></xsltdebug><td><i>/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */</i></td></tr> </tbody></table> <p>The mechanism for encoding character code points into bit patterns may vary from entity to entity. All XML processors must accept the UTF-8 and UTF-16 encodings of 10646; the mechanisms for signaling which of the two is in use, or for bringing other encodings into play, are discussed later, in <a href="#charencoding"><b>4.3.3 Character Encoding in Entities</b></a>.</p> </div> <div class="div2"> <h3><a name="sec-common-syn"></a>2.3 Common Syntactic Constructs</h3> <p>This section defines some symbols used widely in the grammar.</p> <p><a href="#NT-S">S</a> (white space) consists of one or more space (#x20) characters, carriage returns, line feeds, or tabs.</p> <h5>White Space</h5><table class="scrap" summary="Scrap"><tbody> <tr valign="baseline"><td><a name="NT-S"></a>[3]���</td><td><code>S</code></td><td>���::=���</td><td><code>(#x20 | #x9 | #xD | #xA)+</code></td><xsltdebug></xsltdebug></tr> </tbody></table> <p>Characters are classified for convenience as letters, digits, or other characters. <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E30">[E30]</a>A letter consists of an alphabetic or syllabic base character or an ideographic character.</span> Full definitions of the specific characters in each class are given in <a href="#CharClasses"><b>B Character Classes</b></a>.</p> <p>[<a name="dt-name" title="Name">Definition</a>: A <b>Name</b> is a token beginning with a letter or one of a few punctuation characters, and continuing with letters, digits, hyphens, underscores, colons, or full stops, together known as name characters.] Names beginning with the string "<code>xml</code>", or any string which would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>, are reserved for standardization in this or future versions of this specification.</p> <div class="note"><p class="prefix"><b>Note:</b></p> <div class="diff-chg"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E98">[E98]</a>The Namespaces in XML Recommendation <a href="#xml-names">[XML Names]</a> assigns a meaning to names containing colon characters. Therefore, authors should not use the colon in XML names except for namespace purposes, but XML processors must accept the colon as a name character.</p></div> </div> <p>An <a href="#NT-Nmtoken">Nmtoken</a> (name token) is any mixture of name characters.</p> <h5>Names and Tokens</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-NameChar"></a>[4]���</td><td><code>NameChar</code></td><td>���::=���</td><td><code><a href="#NT-Letter">Letter</a> | <a href="#NT-Digit">Digit</a> | '.' | '-' | '_' | ':' | <a href="#NT-CombiningChar">CombiningChar</a> | <a href="#NT-Extender">Extender</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Name"></a>[5]���</td><td><code>Name</code></td><td>���::=���</td><td><code>(<a href="#NT-Letter">Letter</a> | '_' | ':') (<a href="#NT-NameChar">NameChar</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Names"></a>[6]���</td><td><code>Names</code></td><td>���::=���</td><td><code><a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-Name">Name</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtoken"></a>[7]���</td><td><code>Nmtoken</code></td><td>���::=���</td><td><code>(<a href="#NT-NameChar">NameChar</a>)+</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-Nmtokens"></a>[8]���</td><td><code>Nmtokens</code></td><td>���::=���</td><td><code><a href="#NT-Nmtoken">Nmtoken</a> (<a href="#NT-S">S</a> <a href="#NT-Nmtoken">Nmtoken</a>)*</code></td><xsltdebug></xsltdebug></tr></tbody></table> <p>Literal data is any quoted string not containing the quotation mark used as a delimiter for that string. Literals are used for specifying the content of internal entities (<a href="#NT-EntityValue">EntityValue</a>), the values of attributes (<a href="#NT-AttValue">AttValue</a>), and external identifiers (<a href="#NT-SystemLiteral">SystemLiteral</a>). Note that a <a href="#NT-SystemLiteral">SystemLiteral</a> can be parsed without scanning for markup.</p> <h5>Literals</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-EntityValue"></a>[9]���</td><td><code>EntityValue</code></td><td>���::=���</td><td><code>'"' ([^%&amp;"] | <a href="#NT-PEReference">PEReference</a> | <a href="#NT-Reference">Reference</a>)* '"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|� "'" ([^%&amp;'] | <a href="#NT-PEReference">PEReference</a> | <a href="#NT-Reference">Reference</a>)* "'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-AttValue"></a>[10]���</td><td><code>AttValue</code></td><td>���::=���</td><td><code>'"' ([^&lt;&amp;"] | <a href="#NT-Reference">Reference</a>)* '"' </code></td><xsltdebug></xsltdebug></tr><tr valign="baseline"><td></td><td></td><td></td><td><code>|� "'" ([^&lt;&amp;'] | <a href="#NT-Reference">Reference</a>)* "'"</code></td></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-SystemLiteral"></a>[11]���</td><td><code>SystemLiteral</code></td><td>���::=���</td><td><code>('"' [^"]* '"') |�("'" [^']* "'") </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidLiteral"></a>[12]���</td><td><code>PubidLiteral</code></td><td>���::=���</td><td><code>'"' <a href="#NT-PubidChar">PubidChar</a>* '"' | "'" (<a href="#NT-PubidChar">PubidChar</a> - "'")* "'"</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PubidChar"></a>[13]���</td><td><code>PubidChar</code></td><td>���::=���</td><td><code>#x20 | #xD | #xA |�[a-zA-Z0-9] |�[-'()+,./:=?;!*#@$_%]</code></td><xsltdebug></xsltdebug></tr></tbody></table> <div class="diff-add"><div class="note"><p class="prefix"><b>Note:</b></p> <p><a href="http://www.w3.org/XML/xml-19980210-errata#E72">[E72]</a>Although the <a href="#NT-EntityValue">EntityValue</a> production allows the definition of an entity consisting of a single explicit <code>&lt;</code> in the literal (e.g., <code>&lt;!ENTITY mylt "&lt;"&gt;</code>), it is strongly advised to avoid this practice since any reference to that entity will cause a well-formedness error.</p> </div></div> </div> <div class="div2"> <h3><a name="syntax"></a>2.4 Character Data and Markup</h3> <p><a title="Text" href="#dt-text">Text</a> consists of intermingled <a title="Character Data" href="#dt-chardata">character data</a> and markup. [<a name="dt-markup" title="Markup">Definition</a>: <b>Markup</b> takes the form of <a title="Start-Tag" href="#dt-stag">start-tags</a>, <a title="End Tag" href="#dt-etag">end-tags</a>, <a title="Empty" href="#dt-empty">empty-element tags</a>, <a title="Entity Reference" href="#dt-entref">entity references</a>, <a title="Character Reference" href="#dt-charref">character references</a>, <a title="Comment" href="#dt-comment">comments</a>, <a title="CDATA Section" href="#dt-cdsection">CDATA section</a> delimiters, <a title="Document Type Declaration" href="#dt-doctype">document type declarations</a>, <a title="Processing instruction" href="#dt-pi">processing instructions</a>, <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E89">[E89]</a><a href="#NT-XMLDecl">XML declarations</a>, <a href="#NT-TextDecl">text declarations</a>, and any white space that is at the top level of the document entity (that is, outside the document element and not inside any other markup).</span>]</p> <p>[<a name="dt-chardata" title="Character Data">Definition</a>: All text that is not markup constitutes the <b>character data</b> of the document.]</p> <p>The ampersand character (&amp;) and the left angle bracket (&lt;) may appear in their literal form <em>only</em> when used as markup delimiters, or within a <a title="Comment" href="#dt-comment">comment</a>, a <a title="Processing instruction" href="#dt-pi">processing instruction</a>, or a <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>.<span class="diff-del"><a href="http://www.w3.org/XML/xml-19980210-errata#E18">[E18]</a>They are also legal within the <a title="Literal Entity Value" href="#dt-litentval">literal entity value</a> of an internal entity declaration; see <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a>.</span> If they are needed elsewhere, they must be <a title="escape" href="#dt-escape">escaped</a> using either <a title="Character Reference" href="#dt-charref">numeric character references</a> or the strings "<code>&amp;amp;</code>" and "<code>&amp;lt;</code>" respectively. The right angle bracket (&gt;) may be represented using the string "<code>&amp;gt;</code>", and must, <a title="For Compatibility" href="#dt-compat">for compatibility</a>, be escaped using "<code>&amp;gt;</code>" or a character reference when it appears in the string "<code>]]&gt;</code>" in content, when that string is not marking the end of a <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>.</p> <p>In the content of elements, character data is any string of characters which does not contain the start-delimiter of any markup. In a CDATA section, character data is any string of characters not including the CDATA-section-close delimiter, "<code>]]&gt;</code>".</p> <p>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character (') may be represented as "<code>&amp;apos;</code>", and the double-quote character (") as "<code>&amp;quot;</code>".</p> <h5>Character Data</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CharData"></a>[14]���</td><td><code>CharData</code></td><td>���::=���</td><td><code>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</code></td><xsltdebug></xsltdebug></tr></tbody></table> </div> <div class="div2"> <h3><a name="sec-comments"></a>2.5 Comments</h3> <p>[<a name="dt-comment" title="Comment">Definition</a>: <b>Comments</b> may appear anywhere in a document outside other <a title="Markup" href="#dt-markup">markup</a>; in addition, they may appear within the document type declaration at places allowed by the grammar. They are not part of the document's <a title="Character Data" href="#dt-chardata">character data</a>; an XML processor may, but need not, make it possible for an application to retrieve the text of comments. <a title="For Compatibility" href="#dt-compat">For compatibility</a>, the string "<code>--</code>" (double-hyphen) must not occur within comments.] <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</a>Parameter entity references are not recognized within comments.</span></p> <h5>Comments</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-Comment"></a>[15]���</td><td><code>Comment</code></td><td>���::=���</td><td><code>'&lt;!--' ((<a href="#NT-Char">Char</a> - '-') | ('-' (<a href="#NT-Char">Char</a> - '-')))* '--&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table> <p>An example of a comment:</p> <table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;!-- declarations for &lt;head&gt; &amp; &lt;body&gt; --&gt;</pre></td></tr></table> <div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E27">[E27]</a>Note that the grammar does not allow a comment ending in <code>---&gt;</code>. The following example is <em>not</em> well-formed.</p></div> <div class="diff-add"><table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td class="diff-add"><pre>&lt;!-- B+, B, or B---&gt;</pre></td></tr></table></div> </div> <div class="div2"> <h3><a name="sec-pi"></a>2.6 Processing Instructions</h3> <p>[<a name="dt-pi" title="Processing instruction">Definition</a>: <b>Processing instructions</b> (PIs) allow documents to contain instructions for applications.]</p> <h5>Processing Instructions</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-PI"></a>[16]���</td><td><code>PI</code></td><td>���::=���</td><td><code>'&lt;?' <a href="#NT-PITarget">PITarget</a> (<a href="#NT-S">S</a> (<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>* '?&gt;' <a href="#NT-Char">Char</a>*)))? '?&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-PITarget"></a>[17]���</td><td><code>PITarget</code></td><td>���::=���</td><td><code><a href="#NT-Name">Name</a> - (('X' | 'x') ('M' | 'm') ('L' | 'l'))</code></td><xsltdebug></xsltdebug></tr></tbody></table> <p>PIs are not part of the document's <a title="Character Data" href="#dt-chardata">character data</a>, but must be passed through to the application. The PI begins with a target (<a href="#NT-PITarget">PITarget</a>) used to identify the application to which the instruction is directed. The target names "<code>XML</code>", "<code>xml</code>", and so on are reserved for standardization in this or future versions of this specification. The XML <a title="Notation" href="#dt-notation">Notation</a> mechanism may be used for formal declaration of PI targets. <span class="diff-add"><a href="http://www.w3.org/XML/xml-19980210-errata#E63">[E63]</a>Parameter entity references are not recognized within processing instructions.</span></p> </div> <div class="div2"> <h3><a name="sec-cdata-sect"></a>2.7 CDATA Sections</h3> <p>[<a name="dt-cdsection" title="CDATA Section">Definition</a>: <b>CDATA sections</b> may occur anywhere character data may occur; they are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string "<code>&lt;![CDATA[</code>" and end with the string "<code>]]&gt;</code>":]</p> <h5>CDATA Sections</h5><table class="scrap" summary="Scrap"><tbody><tr valign="baseline"><td><a name="NT-CDSect"></a>[18]���</td><td><code>CDSect</code></td><td>���::=���</td><td><code><a href="#NT-CDStart">CDStart</a> <a href="#NT-CData">CData</a> <a href="#NT-CDEnd">CDEnd</a></code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDStart"></a>[19]���</td><td><code>CDStart</code></td><td>���::=���</td><td><code>'&lt;![CDATA['</code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CData"></a>[20]���</td><td><code>CData</code></td><td>���::=���</td><td><code>(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>* ']]&gt;' <a href="#NT-Char">Char</a>*)) </code></td><xsltdebug></xsltdebug></tr></tbody><tbody><tr valign="baseline"><td><a name="NT-CDEnd"></a>[21]���</td><td><code>CDEnd</code></td><td>���::=���</td><td><code>']]&gt;'</code></td><xsltdebug></xsltdebug></tr></tbody></table> <p>Within a CDATA section, only the <a href="#NT-CDEnd">CDEnd</a> string is recognized as markup, so that left angle brackets and ampersands may occur in their literal form; they need not (and cannot) be escaped using "<code>&amp;lt;</code>" and "<code>&amp;amp;</code>". CDATA sections cannot nest.</p> <p>An example of a CDATA section, in which "<code>&lt;greeting&gt;</code>" and "<code>&lt;/greeting&gt;</code>" are recognized as <a title="Character Data" href="#dt-chardata">character data</a>, not <a title="Markup" href="#dt-markup">markup</a>:</p> <table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt; </pre></td></tr></table> </div> <div class="div2"> <h3><a name="sec-prolog-dtd"></a>2.8 Prolog and Document Type Declaration</h3> <p>[<a name="dt-xmldecl" title="XML Declaration">Definition</a>: XML documents <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E107">[E107]</a>should</span> begin with an <b>XML declaration</b> which specifies the version of XML being used.] For example, the following is a complete XML document, <a title="Well-Formed" href="#dt-wellformed">well-formed</a> but not <a title="Validity" href="#dt-valid">valid</a>:</p> <table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;?xml version="1.0"?&gt; &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre></td></tr></table> <p>and so is this:</p> <table class="eg" cellpadding="5" border="1" bgcolor="#99ffff" width="100%" summary="Example"><tr><td><pre>&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre></td></tr></table> <p>The version number "<code>1.0</code>" should be used to indicate conformance to this version of this specification; it is an error for a document to use the value "<code>1.0</code>" if it does not conform to this version of this specification. It is the intent of the XML working group to give later versions of this specification numbers other than "<code>1.0</code>", but this intent does not indicate a commitment to produce any future versions of XML, nor if any are produced, to use any particular numbering scheme. Since future versions are not ruled out, this construct is provided as a means to allow the possibility of automatic version recognition, should it become necessary. Processors may signal an error if they receive documents labeled with versions they do not support.</p> <p>The function of the markup in an XML document is to describe its storage and logical structure and to associate attribute-value pairs with its logical structures. XML provides a mechanism, the <a title="Document Type Declaration" href="#dt-doctype">document type declaration</a>, to define constraints on the logical structure and to support the use of predefined storage units. [<a name="dt-valid" title="Validity">Definition</a>: An XML document is <b>valid</b> if it has an associated document type declaration and if the document complies with the constraints expressed in it.]</p> <p>The document type declaration must appear before the first <a title="Element" href="#dt-element">element</a> in the document.</p> <h5>Prolog</h5><table class="scrap" summary="Scrap"><tbody> <tr valign="baseline"><td><a name="NT-prolog"></a>[22]���</td><td><code>prolog</code></td><td>���::=���</td><td><code><a href="#NT-XMLDecl">XMLDecl</a>? <a href="#NT-Misc">Misc</a>* (<a href="#NT-doctypedecl">doctypedecl</a> <a href="#NT-Misc">Misc</a>*)?</code></td><xsltdebug></xsltdebug></tr> <tr valign="baseline"><td><a name="NT-XMLDecl"></a>[23]���</td><td><code>XMLDecl</code></td><td>���::=���</td><td><code>'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a> <a href="#NT-EncodingDecl">EncodingDecl</a>? <a href="#NT-SDDecl">SDDecl</a>? <a href="#NT-S">S</a>? '?&gt;'</code></td><xsltdebug></xsltdebug></tr> <tr valign="baseline"><td class="diff-chg"><a name="NT-VersionInfo"></a>[24]���</td><td class="diff-chg"><code>VersionInfo</code></td><td class="diff-chg">���::=���</td><td class="diff-chg"><code><a href="#NT-S">S</a> 'version' <a href="#NT-Eq">Eq</a> ("'" <a href="#NT-VersionNum">VersionNum</a> "'" | '"' <a href="#NT-VersionNum">VersionNum</a> '"')<i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E15">[E15]</a> */</i></code></td><xsltdebug></xsltdebug></tr> <tr valign="baseline"><td><a name="NT-Eq"></a>[25]���</td><td><code>Eq</code></td><td>���::=���</td><td><code><a href="#NT-S">S</a>? '=' <a href="#NT-S">S</a>?</code></td><xsltdebug></xsltdebug></tr> <tr valign="baseline"><td><a name="NT-VersionNum"></a>[26]���</td><td><code>VersionNum</code></td><td>���::=���</td><td><code>([a-zA-Z0-9_.:] | '-')+</code></td><xsltdebug></xsltdebug></tr> <tr valign="baseline"><td><a name="NT-Misc"></a>[27]���</td><td><code>Misc</code></td><td>���::=���</td><td><code><a href="#NT-Comment">Comment</a> | <a href="#NT-PI">PI</a> | <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug></tr> </tbody></table> <p>[<a name="dt-doctype" title="Document Type Declaration">Definition</a>: The XML <b>document type declaration</b> contains or points to <a title="markup declaration" href="#dt-markupdecl">markup declarations</a> that provide a grammar for a class of documents. This grammar is known as a document type definition, or <b>DTD</b>. The document type declaration can point to an external subset (a special kind of <a title="External Entity" href="#dt-extent">external entity</a>) containing markup declarations, or can contain the markup declarations directly in an internal subset, or can do both. The DTD for a document consists of both subsets taken together.]</p> <p>[<a name="dt-markupdecl" title="markup declaration">Definition</a>: A <b>markup declaration</b> is an <a title="Element Type declaration" href="#dt-eldecl">element type declaration</a>, an <a title="Attribute-List Declaration" href="#dt-attdecl">attribute-list declaration</a>, an <a title="entity declaration" href="#dt-entdecl">entity declaration</a>, or a <a title="Notation Declaration" href="#dt-notdecl">notation declaration</a>.] These declarations may be contained in whole or in part within <a title="Parameter entity" href="#dt-PE">parameter entities</a>, as described in the well-formedness and validity constraints below. For <span class="diff-chg"><a href="http://www.w3.org/XML/xml-19980210-errata#E14">[E14]</a>further</span> information, see <a href="#sec-physical-struct"><b>4 Physical Structures</b></a>.</p> <h5>Document Type Definition</h5><table class="scrap" summary="Scrap"><tbody> <tr valign="baseline"><td class="diff-chg"><a name="NT-doctypedecl"></a>[28]���</td><td class="diff-chg"><code>doctypedecl</code></td><td class="diff-chg">���::=���</td><td class="diff-chg"><code>'&lt;!DOCTYPE' <a href="#NT-S">S</a> <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a> <a href="#NT-ExternalID">ExternalID</a>)? <a href="#NT-S">S</a>? ('[' (<a href="#NT-markupdecl">markupdecl</a> | <a href="#NT-DeclSep">DeclSep</a>)* ']' <a href="#NT-S">S</a>?)? '&gt;'</code></td><xsltdebug></xsltdebug><td><a href="#vc-roottype">[VC: Root Element Type]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><a href="#ExtSubset">[WFC: External Subset]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-chg"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr> <tr valign="baseline"><td class="diff-add"><a name="NT-DeclSep"></a>[28a]���</td><td class="diff-add"><code>DeclSep</code></td><td class="diff-add">���::=���</td><td class="diff-add"><code><a href="#NT-PEReference">PEReference</a> | <a href="#NT-S">S</a></code></td><xsltdebug></xsltdebug><td class="diff-add"><a href="#PE-between-Decls">[WFC: PE Between Declarations]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td class="diff-add"><i>/* <a href="http://www.w3.org/XML/xml-19980210-errata#E109">[E109]</a> */</i></td></tr> <tr valign="baseline"><td><a name="NT-markupdecl"></a>[29]���</td><td><code>markupdecl</code></td><td>���::=���</td><td><code><a href="#NT-elementdecl">elementdecl</a> | <a href="#NT-AttlistDecl">AttlistDecl</a> | <a href="#NT-EntityDecl">EntityDecl</a> | <a href="#NT-NotationDecl">NotationDecl</a> | <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a> </code></td><xsltdebug></xsltdebug><td><a href="#vc-PEinMarkupDecl">[VC: Proper Declaration/PE Nesting]</a></td></tr><tr valign="baseline"><td></td><td></td><td></td><td></td><td><a href="#wfc-PEinInternalSubset">[WFC: PEs in Internal Subset]</a></td></tr> </tbody></table> <div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E82">[E82]</a>Note that it is possible to construct a well-formed document containing a <a href="#NT-doctypedecl">doctypedecl</a> that neither points to an external subset nor contains an internal subset.</p></div> <p>The markup declarations may be made up in whole or in part of the <a title="Replacement Text" href="#dt-repltext">replacement text</a> of <a title="Parameter entity" href="#dt-PE">parameter entities</a>. The productions later in this specification for individual nonterminals (<a href="#NT-elementdecl">elementdecl</a>, <a href="#NT-AttlistDecl">AttlistDecl</a>, and so on) describe the declarations <em>after</em> all the parameter entities have been <a title="Include" href="#dt-include">included</a>.</p> <div class="diff-add"><p><a href="http://www.w3.org/XML/xml-19980210-errata#E75">[E75]</a>Parameter entity references are recognized anywhere in the DTD (internal and external subsets and external parameter entities), except in literals, processing instructions, comments, and the contents of ignored conditional sections (see <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a>). They are also recognized in entity value literals. The use of parameter entities in the internal subset is restricted as described below.</p></div> <div class="constraint"><p class="prefix"><a name="vc-roottype"></a><b>Validity constraint: Root Element Type</b></p><p>The <a href="#NT-Name">Name</a> in the document type declaration must match the element type of the <a title="Root Element" href="#dt-root">root element</a>.</p> </div> <div class="constraint"><p class="prefix"><a name="vc-PEinMarkupDecl"></a><b>Validity constraint: Proper Declaration/PE Nesting</b></p> <p>Parameter-entity <a title="Replacement Text" href="#dt-repltext">replacement text</a> must be properly nested with markup declarations. That is to say, if either the first character or the last character of a markup declaration (<a href="#NT-markupdecl">markupdecl</a> above) is contained in the replacement text for a