File: REC.xml

package info (click to toggle)
libooc-xml 3.0-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 10,880 kB
  • ctags: 360
  • sloc: xml: 10,312; ansic: 1,681; sh: 798; makefile: 301; perl: 17
file content (1 line) | stat: -rw-r--r-- 171,685 bytes parent folder | download | duplicates (2)
1
<?VERBATIM "eg" ?><spec>&#10;<header>&#10;<title>Extensible Markup Language (XML) 1.0</title>&#10;<version></version>&#10;<w3c-designation>REC-xml-19980210</w3c-designation>&#10;<w3c-doctype>W3C Recommendation</w3c-doctype>&#10;<pubdate><day>10</day><month>February</month><year>1998</year></pubdate>&#10;&#10;<publoc>&#10;<loc href="http://www.w3.org/TR/1998/REC-xml-19980210">&#10;http://www.w3.org/TR/1998/REC-xml-19980210</loc>&#10;<loc href="http://www.w3.org/TR/1998/REC-xml-19980210.xml">&#10;http://www.w3.org/TR/1998/REC-xml-19980210.xml</loc>&#10;<loc href="http://www.w3.org/TR/1998/REC-xml-19980210.html">&#10;http://www.w3.org/TR/1998/REC-xml-19980210.html</loc>&#10;<loc href="http://www.w3.org/TR/1998/REC-xml-19980210.pdf">&#10;http://www.w3.org/TR/1998/REC-xml-19980210.pdf</loc>&#10;<loc href="http://www.w3.org/TR/1998/REC-xml-19980210.ps">&#10;http://www.w3.org/TR/1998/REC-xml-19980210.ps</loc>&#10;</publoc>&#10;<latestloc>&#10;<loc href="http://www.w3.org/TR/REC-xml">&#10;http://www.w3.org/TR/REC-xml</loc>&#10;</latestloc>&#10;<prevlocs>&#10;<loc href="http://www.w3.org/TR/PR-xml-971208">&#10;http://www.w3.org/TR/PR-xml-971208</loc>&#10;&#10;</prevlocs>&#10;<authlist>&#10;<author><name>Tim Bray</name>&#10;<affiliation>Textuality and Netscape</affiliation>&#10;<email href="mailto:tbray@textuality.com">tbray@textuality.com</email></author>&#10;<author><name>Jean Paoli</name>&#10;<affiliation>Microsoft</affiliation>&#10;<email href="mailto:jeanpa@microsoft.com">jeanpa@microsoft.com</email></author>&#10;<author><name>C. M. Sperberg-McQueen</name>&#10;<affiliation>University of Illinois at Chicago</affiliation>&#10;<email href="mailto:cmsmcq@uic.edu">cmsmcq@uic.edu</email></author>&#10;</authlist>&#10;<abstract>&#10;<p>The Extensible Markup Language (XML) is a subset of&#10;SGML that is completely described in this document. Its goal is to&#10;enable generic SGML to be served, received, and processed on the Web&#10;in the way that is now possible with HTML. XML has been designed for&#10;ease of implementation and for interoperability with both SGML and&#10;HTML.</p>&#10;</abstract>&#10;<status>&#10;<p>This document has been reviewed by W3C Members and&#10;other interested parties and has been endorsed by the&#10;Director as a W3C Recommendation. It is a stable&#10;document and may be used as reference material or cited&#10;as a normative reference from another document. W3C's&#10;role in making the Recommendation is to draw attention&#10;to the specification and to promote its widespread&#10;deployment. This enhances the functionality and&#10;interoperability of the Web.</p>&#10;<p>&#10;This document specifies a syntax created by subsetting an existing,&#10;widely used international text processing standard (Standard&#10;Generalized Markup Language, ISO 8879:1986(E) as amended and&#10;corrected) for use on the World Wide Web.  It is a product of the W3C&#10;XML Activity, details of which can be found at <loc href="http://www.w3.org/XML">http://www.w3.org/XML</loc>.  A list of&#10;current W3C Recommendations and other technical documents can be found&#10;at <loc href="http://www.w3.org/TR">http://www.w3.org/TR</loc>.&#10;</p>&#10;<p>This specification uses the term URI, which is defined by <bibref ref="Berners-Lee"></bibref>, a work in progress expected to update <bibref ref="RFC1738"></bibref> and <bibref ref="RFC1808"></bibref>. &#10;</p>&#10;<p>The list of known errors in this specification is &#10;available at &#10;<loc href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</loc>.</p>&#10;<p>Please report errors in this document to &#10;<loc href="mailto:xml-editor@w3.org">xml-editor@w3.org</loc>.&#10;</p>&#10;</status>&#10;&#10;&#10;<pubstmt>&#10;<p>Chicago, Vancouver, Mountain View, et al.:&#10;World-Wide Web Consortium, XML Working Group, 1996, 1997.</p>&#10;</pubstmt>&#10;<sourcedesc>&#10;<p>Created in electronic form.</p>&#10;</sourcedesc>&#10;<langusage>&#10;<language id="EN">English</language>&#10;<language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>&#10;</langusage>&#10;<revisiondesc>&#10;<slist>&#10;<sitem>1997-12-03 : CMSMcQ : yet further changes</sitem>&#10;<sitem>1997-12-02 : TB : further changes (see TB to XML WG,&#10;2 December 1997)</sitem>&#10;<sitem>1997-12-02 : CMSMcQ : deal with as many corrections and&#10;comments from the proofreaders as possible:&#10;entify hard-coded document date in pubdate element,&#10;change expansion of entity WebSGML,&#10;update status description as per Dan Connolly (am not sure&#10;about refernece to Berners-Lee et al.),&#10;add 'The' to abstract as per WG decision,&#10;move Relationship to Existing Standards to back matter and&#10;combine with References,&#10;re-order back matter so normative appendices come first,&#10;re-tag back matter so informative appendices are tagged informdiv1,&#10;remove XXX XXX from list of 'normative' specs in prose,&#10;move some references from Other References to Normative References,&#10;add RFC 1738, 1808, and 2141 to Other References (they are not&#10;normative since we do not require the processor to enforce any &#10;rules based on them),&#10;add reference to 'Fielding draft' (Berners-Lee et al.),&#10;move notation section to end of body,&#10;drop URIchar non-terminal and use SkipLit instead,&#10;lose stray reference to defunct nonterminal 'markupdecls',&#10;move reference to Aho et al. into appendix (Tim's right),&#10;add prose note saying that hash marks and fragment identifiers are&#10;NOT part of the URI formally speaking, and are NOT legal in &#10;system identifiers (processor 'may' signal an error).&#10;Work through:&#10;Tim Bray reacting to James Clark,&#10;Tim Bray on his own,&#10;Eve Maler,&#10;&#10;NOT DONE YET:&#10;change binary / text to unparsed / parsed.&#10;handle James's suggestion about &lt; in attriubte values&#10;uppercase hex characters,&#10;namechar list,&#10;</sitem>&#10;<sitem>1997-12-01 : JB : add some column-width parameters</sitem>&#10;<sitem>1997-12-01 : CMSMcQ : begin round of changes to incorporate&#10;recent WG decisions and other corrections:&#10;binding sources of character encoding info (27 Aug / 3 Sept),&#10;correct wording of Faust quotation (restore dropped line),&#10;drop SDD from EncodingDecl,&#10;change text at version number 1.0,&#10;drop misleading (wrong!) sentence about ignorables and extenders,&#10;modify definition of PCData to make bar on msc grammatical,&#10;change grammar's handling of internal subset (drop non-terminal markupdecls),&#10;change definition of includeSect to allow conditional sections,&#10;add integral-declaration constraint on internal subset,&#10;drop misleading / dangerous sentence about relationship of&#10;entities with system storage objects,&#10;change table body tag to htbody as per EM change to DTD,&#10;add rule about space normalization in public identifiers,&#10;add description of how to generate our name-space rules from &#10;Unicode character database (needs further work!).&#10;</sitem>&#10;<sitem>1997-10-08 : TB : Removed %-constructs again, new rules&#10;for PE appearance.</sitem>&#10;<sitem>1997-10-01 : TB : Case-sensitive markup; cleaned up&#10;element-type defs, lotsa little edits for style</sitem>&#10;<sitem>1997-09-25 : TB : Change to elm's new DTD, with&#10;substantial detail cleanup as a side-effect</sitem>&#10;<sitem>1997-07-24 : CMSMcQ : correct error (lost *) in definition &#10;of ignoreSectContents (thanks to Makoto Murata)</sitem>&#10;<sitem>Allow all empty elements to have end-tags, consistent with&#10;SGML TC (as per JJC).</sitem>&#10;<sitem>1997-07-23 : CMSMcQ : pre-emptive strike on pending corrections:&#10;introduce the term 'empty-element tag', note that all empty elements&#10;may use it, and elements declared EMPTY must use it.&#10;Add WFC requiring encoding decl to come first in an entity.&#10;Redefine notations to point to PIs as well as binary entities.&#10;Change autodetection table by removing bytes 3 and 4 from &#10;examples with Byte Order Mark.&#10;Add content model as a term and clarify that it applies to both&#10;mixed and element content.&#10;</sitem>&#10;<sitem>1997-06-30 : CMSMcQ : change date, some cosmetic changes,&#10;changes to productions for choice, seq, Mixed, NotationType,&#10;Enumeration.  Follow James Clark's suggestion and prohibit &#10;conditional sections in internal subset.  TO DO:  simplify&#10;production for ignored sections as a result, since we don't &#10;need to worry about parsers which don't expand PErefs finding&#10;a conditional section.</sitem>&#10;<sitem>1997-06-29 : TB : various edits</sitem>&#10;<sitem>1997-06-29 : CMSMcQ : further changes:&#10;Suppress old FINAL EDIT comments and some dead material.&#10;Revise occurrences of % in grammar to exploit Henry Thompson's pun,&#10;especially markupdecl and attdef.&#10;Remove RMD requirement relating to element content (?).&#10;</sitem>&#10;<sitem>1997-06-28 : CMSMcQ : Various changes for 1 July draft:&#10;Add text for draconian error handling (introduce&#10;the term Fatal Error).&#10;RE deleta est (changing wording from &#10;original announcement to restrict the requirement to validating&#10;parsers).&#10;Tag definition of validating processor and link to it.&#10;Add colon as name character.&#10;Change def of %operator.&#10;Change standard definitions of lt, gt, amp.&#10;Strip leading zeros from #x00nn forms.</sitem>&#10;<sitem>1997-04-02 : CMSMcQ : final corrections of editorial errors&#10;found in last night's proofreading.  Reverse course once more on&#10;well-formed:   Webster's Second hyphenates it, and that's enough&#10;for me.</sitem>&#10;<sitem>1997-04-01 : CMSMcQ : corrections from JJC, EM, HT, and self</sitem>&#10;<sitem>1997-03-31 : Tim Bray : many changes</sitem>&#10;<sitem>1997-03-29 : CMSMcQ : some Henry Thompson (on entity handling),&#10;some Charles Goldfarb, some ERB decisions (PE handling in miscellaneous&#10;declarations.  Changed Ident element to accept def attribute.&#10;Allow normalization of Unicode characters.  move def of systemliteral&#10;into section on literals.</sitem>&#10;<sitem>1997-03-28 : CMSMcQ : make as many corrections as possible, from&#10;Terry Allen, Norbert Mikula, James Clark, Jon Bosak, Henry Thompson,&#10;Paul Grosso, and self.  Among other things:  give in on &quot;well formed&quot;&#10;(Terry is right), tentatively rename QuotedCData as AttValue&#10;and Literal as EntityValue to be more informative, since attribute&#10;values are the <emph>only</emph> place QuotedCData was used, and&#10;vice versa for entity text and Literal. (I'd call it Entity Text, &#10;but 8879 uses that name for both internal and external entities.)</sitem>&#10;<sitem>1997-03-26 : CMSMcQ : resynch the two forks of this draft, reapply&#10;my changes dated 03-20 and 03-21.  Normalize old 'may not' to 'must not'&#10;except in the one case where it meant 'may or may not'.</sitem>&#10;<sitem>1997-03-21 : TB : massive changes on plane flight from Chicago&#10;to Vancouver</sitem>&#10;<sitem>1997-03-21 : CMSMcQ : correct as many reported errors as possible.&#10;</sitem>&#10;<sitem>1997-03-20 : CMSMcQ : correct typos listed in CMSMcQ hand copy of spec.</sitem>&#10;<sitem>1997-03-20 : CMSMcQ : cosmetic changes preparatory to revision for&#10;WWW conference April 1997:  restore some of the internal entity &#10;references (e.g. to docdate, etc.), change character xA0 to &amp;nbsp;&#10;and define nbsp as &amp;#160;, and refill a lot of paragraphs for&#10;legibility.</sitem>&#10;<sitem>1996-11-12 : CMSMcQ : revise using Tim's edits:&#10;Add list type of NUMBERED and change most lists either to&#10;BULLETS or to NUMBERED.&#10;Suppress QuotedNames, Names (not used).&#10;Correct trivial-grammar doc type decl.&#10;Rename 'marked section' as 'CDATA section' passim.&#10;Also edits from James Clark:&#10;Define the set of characters from which [^abc] subtracts.&#10;Charref should use just [0-9] not Digit.&#10;Location info needs cleaner treatment:  remove?  (ERB&#10;question).&#10;One example of a PI has wrong pic.&#10;Clarify discussion of encoding names.&#10;Encoding failure should lead to unspecified results; don't&#10;prescribe error recovery.&#10;Don't require exposure of entity boundaries.&#10;Ignore white space in element content.&#10;Reserve entity names of the form u-NNNN.&#10;Clarify relative URLs.&#10;And some of my own:&#10;Correct productions for content model:  model cannot&#10;consist of a name, so &quot;elements ::= cp&quot; is no good.&#10;</sitem>&#10;<sitem>1996-11-11 : CMSMcQ : revise for style.&#10;Add new rhs to entity declaration, for parameter entities.</sitem>&#10;<sitem>1996-11-10 : CMSMcQ : revise for style.&#10;Fix / complete section on names, characters.&#10;Add sections on parameter entities, conditional sections.&#10;Still to do:  Add compatibility note on deterministic content models.&#10;Finish stylistic revision.</sitem>&#10;<sitem>1996-10-31 : TB : Add Entity Handling section</sitem>&#10;<sitem>1996-10-30 : TB : Clean up term &amp; termdef.  Slip in&#10;ERB decision re EMPTY.</sitem>&#10;<sitem>1996-10-28 : TB : Change DTD.  Implement some of Michael's&#10;suggestions.  Change comments back to //.  Introduce language for&#10;XML namespace reservation.  Add section on white-space handling.&#10;Lots more cleanup.</sitem>&#10;<sitem>1996-10-24 : CMSMcQ : quick tweaks, implement some ERB&#10;decisions.  Characters are not integers.  Comments are /* */ not //.&#10;Add bibliographic refs to 10646, HyTime, Unicode.&#10;Rename old Cdata as MsData since it's <emph>only</emph> seen&#10;in marked sections.  Call them attribute-value pairs not&#10;name-value pairs, except once.  Internal subset is optional, needs&#10;'?'.  Implied attributes should be signaled to the app, not&#10;have values supplied by processor.</sitem>&#10;<sitem>1996-10-16 : TB : track down &amp; excise all DSD references;&#10;introduce some EBNF for entity declarations.</sitem>&#10;<sitem>1996-10-?? : TB : consistency check, fix up scraps so&#10;they all parse, get formatter working, correct a few productions.</sitem>&#10;<sitem>1996-10-10/11 : CMSMcQ : various maintenance, stylistic, and&#10;organizational changes:&#10;Replace a few literals with xmlpio and&#10;pic entities, to make them consistent and ensure we can change pic&#10;reliably when the ERB votes.&#10;Drop paragraph on recognizers from notation section.&#10;Add match, exact match to terminology.&#10;Move old 2.2 XML Processors and Apps into intro.&#10;Mention comments, PIs, and marked sections in discussion of&#10;delimiter escaping.&#10;Streamline discussion of doctype decl syntax.&#10;Drop old section of 'PI syntax' for doctype decl, and add&#10;section on partial-DTD summary PIs to end of Logical Structures&#10;section.&#10;Revise DSD syntax section to use Tim's subset-in-a-PI&#10;mechanism.</sitem>&#10;<sitem>1996-10-10 : TB : eliminate name recognizers (and more?)</sitem>&#10;<sitem>1996-10-09 : CMSMcQ : revise for style, consistency through 2.3&#10;(Characters)</sitem>&#10;<sitem>1996-10-09 : CMSMcQ : re-unite everything for convenience,&#10;at least temporarily, and revise quickly</sitem>&#10;<sitem>1996-10-08 : TB : first major homogenization pass</sitem>&#10;<sitem>1996-10-08 : TB : turn &quot;current&quot; attribute on div type into &#10;CDATA</sitem>&#10;<sitem>1996-10-02 : TB : remould into skeleton + entities</sitem>&#10;<sitem>1996-09-30 : CMSMcQ : add a few more sections prior to exchange&#10;                            with Tim.</sitem>&#10;<sitem>1996-09-20 : CMSMcQ : finish transcribing notes.</sitem>&#10;<sitem>1996-09-19 : CMSMcQ : begin transcribing notes for draft.</sitem>&#10;<sitem>1996-09-13 : CMSMcQ : made outline from notes of 09-06,&#10;do some housekeeping</sitem>&#10;</slist>&#10;</revisiondesc>&#10;</header>&#10;<body> &#10;<div1 id="sec-intro">&#10;<head>Introduction</head>&#10;<p>Extensible Markup Language, abbreviated XML, describes a class of&#10;data objects called <termref def="dt-xml-doc">XML documents</termref> and&#10;partially describes the behavior of &#10;computer programs which process them. XML is an application profile or&#10;restricted form of SGML, the Standard Generalized Markup &#10;Language <bibref ref="ISO8879"></bibref>.&#10;By construction, XML documents &#10;are conforming SGML documents.&#10;</p>&#10;<p>XML documents are made up of storage units called <termref def="dt-entity">entities</termref>, which contain either parsed&#10;or unparsed data.&#10;Parsed data is made up of <termref def="dt-character">characters</termref>,&#10;some &#10;of which form <termref def="dt-chardata">character data</termref>, &#10;and some of which form <termref def="dt-markup">markup</termref>.&#10;Markup encodes a description of the document's storage layout and&#10;logical structure. XML provides a mechanism to impose constraints on&#10;the storage layout and logical structure.</p>&#10;<p><termdef id="dt-xml-proc" term="XML Processor">A software module&#10;called an <term>XML processor</term> is used to read XML documents&#10;and provide access to their content and structure.</termdef> <termdef id="dt-app" term="Application">It is assumed that an XML processor is&#10;doing its work on behalf of another module, called the&#10;<term>application</term>.</termdef> This specification describes the&#10;required behavior of an XML processor in terms of how it must read XML&#10;data and the information it must provide to the application.</p>&#10; &#10;<div2 id="sec-origin-goals">&#10;<head>Origin and Goals</head>&#10;<p>XML was developed by an XML Working Group (originally known as the&#10;SGML Editorial Review Board) formed under the auspices of the World&#10;Wide Web Consortium (W3C) in 1996.&#10;It was chaired by Jon Bosak of Sun&#10;Microsystems with the active participation of an XML Special&#10;Interest Group (previously known as the SGML Working Group) also&#10;organized by the W3C. The membership of the XML Working Group is given&#10;in an appendix. Dan Connolly served as the WG's contact with the W3C.&#10;</p>&#10;<p>The design goals for XML are:<olist>&#10;<item><p>XML shall be straightforwardly usable over the&#10;Internet.</p></item>&#10;<item><p>XML shall support a wide variety of applications.</p></item>&#10;<item><p>XML shall be compatible with SGML.</p></item>&#10;<item><p>It shall be easy to write programs which process XML&#10;documents.</p></item>&#10;<item><p>The number of optional features in XML is to be kept to the&#10;absolute minimum, ideally zero.</p></item>&#10;<item><p>XML documents should be human-legible and reasonably&#10;clear.</p></item>&#10;<item><p>The XML design should be prepared quickly.</p></item>&#10;<item><p>The design of XML shall be formal and concise.</p></item>&#10;<item><p>XML documents shall be easy to create.</p></item>&#10;<item><p>Terseness in XML markup is of minimal importance.</p></item></olist>&#10;</p>&#10;<p>This specification, &#10;together with associated standards&#10;(Unicode and ISO/IEC 10646 for characters,&#10;Internet RFC 1766 for language identification tags, &#10;ISO 639 for language name codes, and &#10;ISO 3166 for country name codes),&#10;provides all the information necessary to understand &#10;XML Version 1.0&#10;and construct computer programs to process it.</p>&#10;<p>This version of the XML specification&#10;&#10;may be distributed freely, as long as&#10;all text and legal notices remain intact.</p>&#10;&#10;</div2>&#10; &#10;&#10;&#10; &#10;<div2 id="sec-terminology">&#10;<head>Terminology</head>&#10; &#10;<p>The terminology used to describe XML documents is defined in the body of&#10;this specification.&#10;The terms defined in the following list are used in building those&#10;definitions and in describing the actions of an XML processor:&#10;<glist>&#10;<gitem>&#10;<label>may</label>&#10;<def><p><termdef id="dt-may" term="May">Conforming documents and XML&#10;processors are permitted to but need not behave as&#10;described.</termdef></p></def>&#10;</gitem>&#10;<gitem>&#10;<label>must</label>&#10;<def><p>Conforming documents and XML processors &#10;are required to behave as described; otherwise they are in error.&#10;&#10;</p></def>&#10;</gitem>&#10;<gitem>&#10;<label>error</label>&#10;<def><p><termdef id="dt-error" term="Error">A violation of the rules of this&#10;specification; results are&#10;undefined.  Conforming software may detect and report an error and may&#10;recover from it.</termdef></p></def>&#10;</gitem>&#10;<gitem>&#10;<label>fatal error</label>&#10;<def><p><termdef id="dt-fatal" term="Fatal Error">An error&#10;which a conforming <termref def="dt-xml-proc">XML processor</termref>&#10;must detect and report to the application.&#10;After encountering a fatal error, the&#10;processor may continue&#10;processing the data to search for further errors and may report such&#10;errors to the application.  In order to support correction of errors,&#10;the processor may make unprocessed data from the document (with&#10;intermingled character data and markup) available to the application.&#10;Once a fatal error is detected, however, the processor must not&#10;continue normal processing (i.e., it must not&#10;continue to pass character data and information about the document's&#10;logical structure to the application in the normal way).&#10;</termdef></p></def>&#10;</gitem>&#10;<gitem>&#10;<label>at user option</label>&#10;<def><p>Conforming software may or must (depending on the modal verb in the&#10;sentence) behave as described; if it does, it must&#10;provide users a means to enable or disable the behavior&#10;described.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label>validity constraint</label>&#10;<def><p>A rule which applies to all &#10;<termref def="dt-valid">valid</termref> XML documents.&#10;Violations of validity constraints are errors; they must, at user option, &#10;be reported by &#10;<termref def="dt-validating">validating XML processors</termref>.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label>well-formedness constraint</label>&#10;<def><p>A rule which applies to all <termref def="dt-wellformed">well-formed</termref> XML documents.&#10;Violations of well-formedness constraints are &#10;<termref def="dt-fatal">fatal errors</termref>.</p></def>&#10;</gitem>&#10;&#10;<gitem>&#10;<label>match</label>&#10;<def><p><termdef id="dt-match" term="match">(Of strings or names:) &#10;Two strings or names being compared must be identical.&#10;Characters with multiple possible representations in ISO/IEC 10646 (e.g.&#10;characters with &#10;both precomposed and base+diacritic forms) match only if they have the&#10;same representation in both strings.&#10;At user option, processors may normalize such characters to&#10;some canonical form.&#10;No case folding is performed. &#10;(Of strings and rules in the grammar:)  &#10;A string matches a grammatical production if it belongs to the&#10;language generated by that production.&#10;(Of content and content models:)&#10;An element matches its declaration when it conforms&#10;in the fashion described in the constraint&#10;<specref ref="elementvalid"></specref>.&#10;</termdef>&#10;</p></def>&#10;</gitem>&#10;<gitem>&#10;<label>for compatibility</label>&#10;<def><p><termdef id="dt-compat" term="For Compatibility">A feature of&#10;XML included solely to ensure that XML remains compatible with SGML.&#10;</termdef></p></def>&#10;</gitem>&#10;<gitem>&#10;<label>for interoperability</label>&#10;<def><p><termdef id="dt-interop" term="For interoperability">A&#10;non-binding recommendation included to increase the chances that XML&#10;documents can be processed by the existing installed base of SGML&#10;processors which predate the&#10;WebSGML Adaptations Annex to ISO 8879.</termdef></p></def>&#10;</gitem>&#10;</glist>&#10;</p>&#10;</div2>&#10;&#10; &#10;</div1>&#10;&#10; &#10;<div1 id="sec-documents">&#10;<head>Documents</head>&#10; &#10;<p><termdef id="dt-xml-doc" term="XML Document">&#10;A data object is an&#10;<term>XML document</term> if it is&#10;<termref def="dt-wellformed">well-formed</termref>, as&#10;defined in this specification.&#10;A well-formed XML document may in addition be&#10;<termref def="dt-valid">valid</termref> if it meets certain further &#10;constraints.</termdef></p>&#10; &#10;<p>Each XML document has both a logical and a physical structure.&#10;Physically, the document is composed of units called <termref def="dt-entity">entities</termref>.  An entity may <termref def="dt-entref">refer</termref> to other entities to cause their&#10;inclusion in the document. A document begins in a &quot;root&quot;  or <termref def="dt-docent">document entity</termref>.&#10;Logically, the document is composed of declarations, elements, &#10;comments,&#10;character references, and&#10;processing&#10;instructions, all of which are indicated in the document by explicit&#10;markup.&#10;The logical and physical structures must nest properly, as described  &#10;in <specref ref="wf-entities"></specref>.&#10;</p>&#10; &#10;<div2 id="sec-well-formed">&#10;<head>Well-Formed XML Documents</head>&#10; &#10;<p><termdef id="dt-wellformed" term="Well-Formed">&#10;A textual object is &#10;a well-formed XML document if:</termdef>&#10;<olist>&#10;<item><p>Taken as a whole, it&#10;matches the production labeled <nt def="NT-document">document</nt>.</p></item>&#10;<item><p>It&#10;meets all the well-formedness constraints given in this specification.</p>&#10;</item>&#10;<item><p>Each of the <termref def="dt-parsedent">parsed entities</termref> &#10;which is referenced directly or indirectly within the document is&#10;<titleref href="wf-entities">well-formed</titleref>.</p></item>&#10;</olist></p>&#10;<p>&#10;<scrap id="document" lang="ebnf">&#10;<head>Document</head>&#10;<prod id="NT-document"><lhs>document</lhs>&#10;<rhs><nt def="NT-prolog">prolog</nt> &#10;<nt def="NT-element">element</nt> &#10;<nt def="NT-Misc">Misc</nt>*</rhs></prod>&#10;</scrap>&#10;</p>&#10;<p>Matching the <nt def="NT-document">document</nt> production &#10;implies that:&#10;<olist>&#10;<item><p>It contains one or more&#10;<termref def="dt-element">elements</termref>.</p>&#10;</item>&#10;&#10;<item><p><termdef id="dt-root" term="Root Element">There is  exactly&#10;one element, called the <term>root</term>, or document element,  no&#10;part of which appears in the <termref def="dt-content">content</termref> of any other element.</termdef>&#10;For all other elements, if the start-tag is in the content of another&#10;element, the end-tag is in the content of the same element.  More&#10;simply stated, the elements, delimited by start- and end-tags, nest&#10;properly within each other.&#10;</p></item>&#10;</olist>&#10;</p>&#10;<p><termdef id="dt-parentchild" term="Parent/Child">As a consequence &#10;of this,&#10;for each non-root element&#10;<code>C</code> in the document, there is one other element <code>P</code>&#10;in the document such that &#10;<code>C</code> is in the content of <code>P</code>, but is not in&#10;the content of any other element that is in the content of&#10;<code>P</code>.  &#10;<code>P</code> is referred to as the&#10;<term>parent</term> of <code>C</code>, and <code>C</code> as a&#10;<term>child</term> of <code>P</code>.</termdef></p></div2>&#10; &#10;<div2 id="charsets">&#10;<head>Characters</head>&#10; &#10;<p><termdef id="dt-text" term="Text">A parsed entity contains&#10;<term>text</term>, a sequence of &#10;<termref def="dt-character">characters</termref>, &#10;which may represent markup or character data.</termdef> &#10;<termdef id="dt-character" term="Character">A <term>character</term> &#10;is an atomic unit of text as specified by&#10;ISO/IEC 10646 <bibref ref="ISO10646"></bibref>.&#10;Legal characters are tab, carriage return, line feed, and the legal&#10;graphic characters of Unicode and ISO/IEC 10646.&#10;The use of &quot;compatibility characters&quot;, as defined in section 6.8&#10;of <bibref ref="Unicode"></bibref>, is discouraged.&#10;</termdef> &#10;<scrap id="char32" lang="ebnf">&#10;<head>Character Range</head>&#10;<prodgroup pcw2="4" pcw4="17.5" pcw5="11">&#10;<prod id="NT-Char"><lhs>Char</lhs> &#10;<rhs>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] &#10;| [#x10000-#x10FFFF]</rhs> &#10;<com>any Unicode character, excluding the&#10;surrogate blocks, FFFE, and FFFF.</com> </prod>&#10;</prodgroup>&#10;</scrap>&#10;</p>&#10;&#10;<p>The mechanism for encoding character code points into bit patterns may&#10;vary from entity to entity. All XML processors must accept the UTF-8&#10;and UTF-16 encodings of 10646; the mechanisms for signaling which of&#10;the two is in use, or for bringing other encodings into play, are&#10;discussed later, in <specref ref="charencoding"></specref>.&#10;</p>&#10;&#10;</div2>&#10; &#10;<div2 id="sec-common-syn">&#10;<head>Common Syntactic Constructs</head>&#10; &#10;<p>This section defines some symbols used widely in the grammar.</p>&#10;<p><nt def="NT-S">S</nt> (white space) consists of one or more space (#x20)&#10;characters, carriage returns, line feeds, or tabs.&#10;&#10;<scrap id="white" lang="ebnf">&#10;<head>White Space</head>&#10;<prodgroup pcw2="4" pcw4="17.5" pcw5="11">&#10;<prod id="NT-S"><lhs>S</lhs>&#10;<rhs>(#x20 | #x9 | #xD | #xA)+</rhs>&#10;</prod>&#10;</prodgroup>&#10;</scrap></p>&#10;<p>Characters are classified for convenience as letters, digits, or other&#10;characters.  Letters consist of an alphabetic or syllabic &#10;base character possibly&#10;followed by one or more combining characters, or of an ideographic&#10;character.  &#10;Full definitions of the specific characters in each class&#10;are given in <specref ref="CharClasses"></specref>.</p>&#10;<p><termdef id="dt-name" term="Name">A <term>Name</term> is a token&#10;beginning with a letter or one of a few punctuation characters, and continuing&#10;with letters, digits, hyphens, underscores, colons, or full stops, together&#10;known as name characters.</termdef>&#10;Names beginning with the string &quot;<code>xml</code>&quot;, or any string&#10;which would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>, are&#10;reserved for standardization in this or future versions of this&#10;specification.&#10;</p>&#10;<note>&#10;<p>The colon character within XML names is reserved for experimentation with&#10;name spaces.  &#10;Its meaning is expected to be&#10;standardized at some future point, at which point those documents &#10;using the colon for experimental purposes may need to be updated.&#10;(There is no guarantee that any name-space mechanism&#10;adopted for XML will in fact use the colon as a name-space delimiter.)&#10;In practice, this means that authors should not use the colon in XML&#10;names except as part of name-space experiments, but that XML processors&#10;should accept the colon as a name character.</p>&#10;</note>&#10;<p>An&#10;<nt def="NT-Nmtoken">Nmtoken</nt> (name token) is any mixture of&#10;name characters.&#10;<scrap lang="ebnf">&#10;<head>Names and Tokens</head>&#10;<prod id="NT-NameChar"><lhs>NameChar</lhs>&#10;<rhs><nt def="NT-Letter">Letter</nt> &#10;| <nt def="NT-Digit">Digit</nt> &#10;| '.' | '-' | '_' | ':'&#10;| <nt def="NT-CombiningChar">CombiningChar</nt> &#10;| <nt def="NT-Extender">Extender</nt></rhs>&#10;</prod>&#10;<prod id="NT-Name"><lhs>Name</lhs>&#10;<rhs>(<nt def="NT-Letter">Letter</nt> | '_' | ':')&#10;(<nt def="NT-NameChar">NameChar</nt>)*</rhs></prod>&#10;<prod id="NT-Names"><lhs>Names</lhs>&#10;<rhs><nt def="NT-Name">Name</nt> &#10;(<nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>)*</rhs></prod>&#10;<prod id="NT-Nmtoken"><lhs>Nmtoken</lhs>&#10;<rhs>(<nt def="NT-NameChar">NameChar</nt>)+</rhs></prod>&#10;<prod id="NT-Nmtokens"><lhs>Nmtokens</lhs>&#10;<rhs><nt def="NT-Nmtoken">Nmtoken</nt> (<nt def="NT-S">S</nt> <nt def="NT-Nmtoken">Nmtoken</nt>)*</rhs></prod>&#10;</scrap>&#10;</p>&#10;<p>Literal data is any quoted string not containing&#10;the quotation mark used as a delimiter for that string.&#10;Literals are used&#10;for specifying the content of internal entities&#10;(<nt def="NT-EntityValue">EntityValue</nt>),&#10;the values of attributes (<nt def="NT-AttValue">AttValue</nt>), &#10;and external identifiers &#10;(<nt def="NT-SystemLiteral">SystemLiteral</nt>).  &#10;Note that a <nt def="NT-SystemLiteral">SystemLiteral</nt>&#10;can be parsed without scanning for markup.&#10;<scrap lang="ebnf">&#10;<head>Literals</head>&#10;<prod id="NT-EntityValue"><lhs>EntityValue</lhs>&#10;<rhs>'&quot;' &#10;([^%&amp;&quot;] &#10;| <nt def="NT-PEReference">PEReference</nt> &#10;| <nt def="NT-Reference">Reference</nt>)*&#10;'&quot;' &#10;</rhs>&#10;<rhs>|  &#10;&quot;'&quot; &#10;([^%&amp;'] &#10;| <nt def="NT-PEReference">PEReference</nt> &#10;| <nt def="NT-Reference">Reference</nt>)* &#10;&quot;'&quot;</rhs>&#10;</prod>&#10;<prod id="NT-AttValue"><lhs>AttValue</lhs>&#10;<rhs>'&quot;' &#10;([^&lt;&amp;&quot;] &#10;| <nt def="NT-Reference">Reference</nt>)* &#10;'&quot;' &#10;</rhs>&#10;<rhs>|  &#10;&quot;'&quot; &#10;([^&lt;&amp;'] &#10;| <nt def="NT-Reference">Reference</nt>)* &#10;&quot;'&quot;</rhs>&#10;</prod>&#10;<prod id="NT-SystemLiteral"><lhs>SystemLiteral</lhs>&#10;<rhs>('&quot;' [^&quot;]* '&quot;') | (&quot;'&quot; [^']* &quot;'&quot;)&#10;</rhs>&#10;</prod>&#10;<prod id="NT-PubidLiteral"><lhs>PubidLiteral</lhs>&#10;<rhs>'&quot;' <nt def="NT-PubidChar">PubidChar</nt>* &#10;'&quot;' &#10;| &quot;'&quot; (<nt def="NT-PubidChar">PubidChar</nt> - &quot;'&quot;)* &quot;'&quot;</rhs>&#10;</prod>&#10;<prod id="NT-PubidChar"><lhs>PubidChar</lhs>&#10;<rhs>#x20 | #xD | #xA &#10;| [a-zA-Z0-9]&#10;| [-'()+,./:=?;!*#@$_%]</rhs>&#10;</prod>&#10;</scrap>&#10;</p>&#10;&#10;</div2>&#10;&#10;<div2 id="syntax">&#10;<head>Character Data and Markup</head>&#10; &#10;<p><termref def="dt-text">Text</termref> consists of intermingled &#10;<termref def="dt-chardata">character&#10;data</termref> and markup.&#10;<termdef id="dt-markup" term="Markup"><term>Markup</term> takes the form of&#10;<termref def="dt-stag">start-tags</termref>,&#10;<termref def="dt-etag">end-tags</termref>,&#10;<termref def="dt-empty">empty-element tags</termref>,&#10;<termref def="dt-entref">entity references</termref>,&#10;<termref def="dt-charref">character references</termref>,&#10;<termref def="dt-comment">comments</termref>,&#10;<termref def="dt-cdsection">CDATA section</termref> delimiters,&#10;<termref def="dt-doctype">document type declarations</termref>, and&#10;<termref def="dt-pi">processing instructions</termref>.&#10;</termdef>&#10;</p>&#10;<p><termdef id="dt-chardata" term="Character Data">All text that is not markup&#10;constitutes the <term>character data</term> of&#10;the document.</termdef></p>&#10;<p>The ampersand character (&amp;) and the left angle bracket (&lt;)&#10;may appear in their literal form <emph>only</emph> when used as markup&#10;delimiters, or within a <termref def="dt-comment">comment</termref>, a&#10;<termref def="dt-pi">processing instruction</termref>, &#10;or a <termref def="dt-cdsection">CDATA section</termref>.  &#10;&#10;They are also legal within the <termref def="dt-litentval">literal entity&#10;value</termref> of an internal entity declaration; see&#10;<specref ref="wf-entities"></specref>.&#10;&#10;If they are needed elsewhere,&#10;they must be <termref def="dt-escape">escaped</termref>&#10;using either <termref def="dt-charref">numeric character references</termref>&#10;or the strings&#10;&quot;<code>&amp;amp;</code>&quot; and &quot;<code>&amp;lt;</code>&quot; respectively. &#10;The right angle&#10;bracket (&gt;) may be represented using the string&#10;&quot;<code>&amp;gt;</code>&quot;, and must, <termref def="dt-compat">for&#10;compatibility</termref>, &#10;be escaped using&#10;&quot;<code>&amp;gt;</code>&quot; or a character reference &#10;when it appears in the string&#10;&quot;<code>]]&gt;</code>&quot;&#10;in content, &#10;when that string is not marking the end of &#10;a <termref def="dt-cdsection">CDATA section</termref>. &#10;</p>&#10;<p>&#10;In the content of elements, character data &#10;is any string of characters which does&#10;not contain the start-delimiter of any markup.  &#10;In a CDATA section, character data&#10;is any string of characters not including the CDATA-section-close&#10;delimiter, &quot;<code>]]&gt;</code>&quot;.</p>&#10;<p>&#10;To allow attribute values to contain both single and double quotes, the&#10;apostrophe or single-quote character (') may be represented as&#10;&quot;<code>&amp;apos;</code>&quot;, and the double-quote character (&quot;) as&#10;&quot;<code>&amp;quot;</code>&quot;.&#10;<scrap lang="ebnf">&#10;<head>Character Data</head>&#10;<prod id="NT-CharData">&#10;<lhs>CharData</lhs>&#10;<rhs>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</rhs>&#10;</prod>&#10;</scrap>&#10;</p>&#10;</div2>&#10; &#10;<div2 id="sec-comments">&#10;<head>Comments</head>&#10; &#10;<p><termdef id="dt-comment" term="Comment"><term>Comments</term> may &#10;appear anywhere in a document outside other &#10;<termref def="dt-markup">markup</termref>; in addition,&#10;they may appear within the document type declaration&#10;at places allowed by the grammar.&#10;They are not part of the document's <termref def="dt-chardata">character&#10;data</termref>; an XML&#10;processor may, but need not, make it possible for an application to&#10;retrieve the text of comments.&#10;<termref def="dt-compat">For compatibility</termref>, the string&#10;&quot;<code>--</code>&quot; (double-hyphen) must not occur within&#10;comments.&#10;<scrap lang="ebnf">&#10;<head>Comments</head>&#10;<prod id="NT-Comment"><lhs>Comment</lhs>&#10;<rhs>'&lt;!--'&#10;((<nt def="NT-Char">Char</nt> - '-') &#10;| ('-' (<nt def="NT-Char">Char</nt> - '-')))* &#10;'--&gt;'</rhs>&#10;</prod>&#10;</scrap>&#10;</termdef></p>&#10;<p>An example of a comment:&#10;<eg>&lt;!-- declarations for &lt;head&gt; &amp; &lt;body&gt; --&gt;</eg>&#10;</p>&#10;</div2>&#10; &#10;<div2 id="sec-pi">&#10;<head>Processing Instructions</head>&#10; &#10;<p><termdef id="dt-pi" term="Processing instruction"><term>Processing&#10;instructions</term> (PIs) allow documents to contain instructions&#10;for applications.&#10; &#10;<scrap lang="ebnf">&#10;<head>Processing Instructions</head>&#10;<prod id="NT-PI"><lhs>PI</lhs>&#10;<rhs>'&lt;?' <nt def="NT-PITarget">PITarget</nt> &#10;(<nt def="NT-S">S</nt> &#10;(<nt def="NT-Char">Char</nt>* - &#10;(<nt def="NT-Char">Char</nt>* '?&gt;' <nt def="NT-Char">Char</nt>*)))?&#10;'?&gt;'</rhs></prod>&#10;<prod id="NT-PITarget"><lhs>PITarget</lhs>&#10;<rhs><nt def="NT-Name">Name</nt> - &#10;(('X' | 'x') ('M' | 'm') ('L' | 'l'))</rhs>&#10;</prod>&#10;</scrap></termdef>&#10;PIs are not part of the document's <termref def="dt-chardata">character&#10;data</termref>, but must be passed through to the application. The&#10;PI begins with a target (<nt def="NT-PITarget">PITarget</nt>) used&#10;to identify the application to which the instruction is directed.  &#10;The target names &quot;<code>XML</code>&quot;, &quot;<code>xml</code>&quot;, and so on are&#10;reserved for standardization in this or future versions of this&#10;specification.&#10;The &#10;XML <termref def="dt-notation">Notation</termref> mechanism&#10;may be used for&#10;formal declaration of PI targets.&#10;</p>&#10;</div2>&#10; &#10;<div2 id="sec-cdata-sect">&#10;<head>CDATA Sections</head>&#10; &#10;<p><termdef id="dt-cdsection" term="CDATA Section"><term>CDATA sections</term>&#10;may occur &#10;anywhere character data may occur; they are&#10;used to escape blocks of text containing characters which would&#10;otherwise be recognized as markup.  CDATA sections begin with the&#10;string &quot;<code>&lt;![CDATA[</code>&quot; and end with the string&#10;&quot;<code>]]&gt;</code>&quot;:&#10;<scrap lang="ebnf">&#10;<head>CDATA Sections</head>&#10;<prod id="NT-CDSect"><lhs>CDSect</lhs>&#10;<rhs><nt def="NT-CDStart">CDStart</nt> &#10;<nt def="NT-CData">CData</nt> &#10;<nt def="NT-CDEnd">CDEnd</nt></rhs></prod>&#10;<prod id="NT-CDStart"><lhs>CDStart</lhs>&#10;<rhs>'&lt;![CDATA['</rhs>&#10;</prod>&#10;<prod id="NT-CData"><lhs>CData</lhs>&#10;<rhs>(<nt def="NT-Char">Char</nt>* - &#10;(<nt def="NT-Char">Char</nt>* ']]&gt;' <nt def="NT-Char">Char</nt>*))&#10;</rhs>&#10;</prod>&#10;<prod id="NT-CDEnd"><lhs>CDEnd</lhs>&#10;<rhs>']]&gt;'</rhs>&#10;</prod>&#10;</scrap>&#10;&#10;Within a CDATA section, only the <nt def="NT-CDEnd">CDEnd</nt> string is&#10;recognized as markup, so that left angle brackets and ampersands may occur in&#10;their literal form; they need not (and cannot) be escaped using&#10;&quot;<code>&amp;lt;</code>&quot; and &quot;<code>&amp;amp;</code>&quot;.  CDATA sections&#10;cannot nest.</termdef>&#10;</p>&#10;&#10;<p>An example of a CDATA section, in which &quot;<code>&lt;greeting&gt;</code>&quot; and &#10;&quot;<code>&lt;/greeting&gt;</code>&quot;&#10;are recognized as <termref def="dt-chardata">character data</termref>, not&#10;<termref def="dt-markup">markup</termref>:&#10;<eg>&lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt;</eg>&#10;</p>&#10;</div2>&#10; &#10;<div2 id="sec-prolog-dtd">&#10;<head>Prolog and Document Type Declaration</head>&#10; &#10;<p><termdef id="dt-xmldecl" term="XML Declaration">XML documents &#10;may, and should, &#10;begin with an <term>XML declaration</term> which specifies&#10;the version of&#10;XML being used.</termdef>&#10;For example, the following is a complete XML document, <termref def="dt-wellformed">well-formed</termref> but not&#10;<termref def="dt-valid">valid</termref>:&#10;<eg>&lt;?xml version=&quot;1.0&quot;?&gt;&#10;&lt;greeting&gt;Hello, world!&lt;/greeting&gt;&#10;</eg>&#10;and so is this:&#10;<eg>&lt;greeting&gt;Hello, world!&lt;/greeting&gt;&#10;</eg>&#10;</p>&#10;&#10;<p>The version number &quot;<code>1.0</code>&quot; should be used to indicate&#10;conformance to this version of this specification; it is an error&#10;for a document to use the value &quot;<code>1.0</code>&quot; &#10;if it does not conform to this version of this specification.&#10;It is the intent&#10;of the XML working group to give later versions of this specification&#10;numbers other than &quot;<code>1.0</code>&quot;, but this intent does not&#10;indicate a&#10;commitment to produce any future versions of XML, nor if any are produced, to&#10;use any particular numbering scheme.&#10;Since future versions are not ruled out, this construct is provided &#10;as a means to allow the possibility of automatic version recognition, should&#10;it become necessary.&#10;Processors may signal an error if they receive documents labeled with &#10;versions they do not support. &#10;</p>&#10;<p>The function of the markup in an XML document is to describe its&#10;storage and logical structure and to associate attribute-value pairs&#10;with its logical structures.  XML provides a mechanism, the <termref def="dt-doctype">document type declaration</termref>, to define&#10;constraints on the logical structure and to support the use of&#10;predefined storage units.&#10;&#10;<termdef id="dt-valid" term="Validity">An XML document is &#10;<term>valid</term> if it has an associated document type&#10;declaration and if the document&#10;complies with the constraints expressed in it.</termdef></p>&#10;<p>The document type declaration must appear before&#10;the first <termref def="dt-element">element</termref> in the document.&#10;<scrap id="xmldoc" lang="ebnf">&#10;<head>Prolog</head>&#10;<prodgroup pcw2="6" pcw4="17.5" pcw5="9">&#10;<prod id="NT-prolog"><lhs>prolog</lhs>&#10;<rhs><nt def="NT-XMLDecl">XMLDecl</nt>? &#10;<nt def="NT-Misc">Misc</nt>* &#10;(<nt def="NT-doctypedecl">doctypedecl</nt> &#10;<nt def="NT-Misc">Misc</nt>*)?</rhs></prod>&#10;<prod id="NT-XMLDecl"><lhs>XMLDecl</lhs>&#10;<rhs>'&lt;?xml' &#10;<nt def="NT-VersionInfo">VersionInfo</nt> &#10;<nt def="NT-EncodingDecl">EncodingDecl</nt>? &#10;<nt def="NT-SDDecl">SDDecl</nt>? &#10;<nt def="NT-S">S</nt>? &#10;'?&gt;'</rhs>&#10;</prod>&#10;<prod id="NT-VersionInfo"><lhs>VersionInfo</lhs>&#10;<rhs><nt def="NT-S">S</nt> 'version' <nt def="NT-Eq">Eq</nt> &#10;(' <nt def="NT-VersionNum">VersionNum</nt> ' &#10;| &quot; <nt def="NT-VersionNum">VersionNum</nt> &quot;)</rhs>&#10;</prod>&#10;<prod id="NT-Eq"><lhs>Eq</lhs>&#10;<rhs><nt def="NT-S">S</nt>? '=' <nt def="NT-S">S</nt>?</rhs></prod>&#10;<prod id="NT-VersionNum">&#10;<lhs>VersionNum</lhs>&#10;<rhs>([a-zA-Z0-9_.:] | '-')+</rhs>&#10;</prod>&#10;<prod id="NT-Misc"><lhs>Misc</lhs>&#10;<rhs><nt def="NT-Comment">Comment</nt> | <nt def="NT-PI">PI</nt> | &#10;<nt def="NT-S">S</nt></rhs></prod>&#10;</prodgroup>&#10;</scrap></p>&#10;&#10;<p><termdef id="dt-doctype" term="Document Type Declaration">The XML&#10;<term>document type declaration</term> &#10;contains or points to &#10;<termref def="dt-markupdecl">markup declarations</termref> &#10;that provide a grammar for a&#10;class of documents.  &#10;This grammar is known as a document type definition,&#10;or <term>DTD</term>.  &#10;The document type declaration can point to an external subset (a&#10;special kind of &#10;<termref def="dt-extent">external entity</termref>) containing markup&#10;declarations, or can &#10;contain the markup declarations directly in an internal subset, or can do&#10;both.   &#10;The DTD for a document consists of both subsets taken&#10;together.</termdef>&#10;</p>&#10;<p><termdef id="dt-markupdecl" term="markup declaration">&#10;A <term>markup declaration</term> is &#10;an <termref def="dt-eldecl">element type declaration</termref>, &#10;an <termref def="dt-attdecl">attribute-list declaration</termref>, &#10;an <termref def="dt-entdecl">entity declaration</termref>, or&#10;a <termref def="dt-notdecl">notation declaration</termref>.&#10;</termdef>&#10;These declarations may be contained in whole or in part&#10;within <termref def="dt-PE">parameter entities</termref>,&#10;as described in the well-formedness and validity constraints below.&#10;For fuller information, see&#10;<specref ref="sec-physical-struct"></specref>.</p>&#10;<scrap id="dtd" lang="ebnf">&#10;<head>Document Type Definition</head>&#10;<prodgroup pcw2="6" pcw4="17.5" pcw5="9">&#10;<prod id="NT-doctypedecl"><lhs>doctypedecl</lhs>&#10;<rhs>'&lt;!DOCTYPE' <nt def="NT-S">S</nt> &#10;<nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt> &#10;<nt def="NT-ExternalID">ExternalID</nt>)? &#10;<nt def="NT-S">S</nt>? ('[' &#10;(<nt def="NT-markupdecl">markupdecl</nt> &#10;| <nt def="NT-PEReference">PEReference</nt> &#10;| <nt def="NT-S">S</nt>)*&#10;']' &#10;<nt def="NT-S">S</nt>?)? '&gt;'</rhs>&#10;<vc def="vc-roottype"></vc>&#10;</prod>&#10;<prod id="NT-markupdecl"><lhs>markupdecl</lhs>&#10;<rhs><nt def="NT-elementdecl">elementdecl</nt> &#10;| <nt def="NT-AttlistDecl">AttlistDecl</nt> &#10;| <nt def="NT-EntityDecl">EntityDecl</nt> &#10;| <nt def="NT-NotationDecl">NotationDecl</nt> &#10;| <nt def="NT-PI">PI</nt> &#10;| <nt def="NT-Comment">Comment</nt>&#10;</rhs>&#10;<vc def="vc-PEinMarkupDecl"></vc>&#10;<wfc def="wfc-PEinInternalSubset"></wfc>&#10;</prod>&#10;&#10;</prodgroup>&#10;</scrap>&#10;&#10;<p>The markup declarations may be made up in whole or in part of&#10;the <termref def="dt-repltext">replacement text</termref> of &#10;<termref def="dt-PE">parameter entities</termref>.&#10;The productions later in this specification for&#10;individual nonterminals (<nt def="NT-elementdecl">elementdecl</nt>,&#10;<nt def="NT-AttlistDecl">AttlistDecl</nt>, and so on) describe &#10;the declarations <emph>after</emph> all the parameter entities have been &#10;<termref def="dt-include">included</termref>.</p>&#10;&#10;<vcnote id="vc-roottype">&#10;<head>Root Element Type</head>&#10;<p>&#10;The <nt def="NT-Name">Name</nt> in the document type declaration must&#10;match the element type of the <termref def="dt-root">root element</termref>.&#10;</p>&#10;</vcnote>&#10;&#10;<vcnote id="vc-PEinMarkupDecl">&#10;<head>Proper Declaration/PE Nesting</head>&#10;<p>Parameter-entity &#10;<termref def="dt-repltext">replacement text</termref> must be properly nested&#10;with markup declarations. &#10;That is to say, if either the first character&#10;or the last character of a markup&#10;declaration (<nt def="NT-markupdecl">markupdecl</nt> above)&#10;is contained in the replacement text for a &#10;<termref def="dt-PERef">parameter-entity reference</termref>,&#10;both must be contained in the same replacement text.</p>&#10;</vcnote>&#10;<wfcnote id="wfc-PEinInternalSubset">&#10;<head>PEs in Internal Subset</head>&#10;<p>In the internal DTD subset, &#10;<termref def="dt-PERef">parameter-entity references</termref>&#10;can occur only where markup declarations can occur, not&#10;within markup declarations.  (This does not apply to&#10;references that occur in&#10;external parameter entities or to the external subset.)&#10;</p>&#10;</wfcnote>&#10;<p>&#10;Like the internal subset, the external subset and &#10;any external parameter entities referred to in the DTD &#10;must consist of a series of complete markup declarations of the types &#10;allowed by the non-terminal symbol&#10;<nt def="NT-markupdecl">markupdecl</nt>, interspersed with white space&#10;or <termref def="dt-PERef">parameter-entity references</termref>.&#10;However, portions of the contents&#10;of the &#10;external subset or of external parameter entities may conditionally be ignored&#10;by using &#10;the <termref def="dt-cond-section">conditional section</termref>&#10;construct; this is not allowed in the internal subset.&#10;&#10;<scrap id="ext-Subset">&#10;<head>External Subset</head>&#10;<prodgroup pcw2="6" pcw4="17.5" pcw5="9">&#10;<prod id="NT-extSubset"><lhs>extSubset</lhs>&#10;<rhs><nt def="NT-TextDecl">TextDecl</nt>?&#10;<nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs></prod>&#10;<prod id="NT-extSubsetDecl"><lhs>extSubsetDecl</lhs>&#10;<rhs>(&#10;<nt def="NT-markupdecl">markupdecl</nt> &#10;| <nt def="NT-conditionalSect">conditionalSect</nt> &#10;| <nt def="NT-PEReference">PEReference</nt> &#10;| <nt def="NT-S">S</nt>&#10;)*</rhs>&#10;</prod>&#10;</prodgroup>&#10;</scrap></p>&#10;<p>The external subset and external parameter entities also differ &#10;from the internal subset in that in them,&#10;<termref def="dt-PERef">parameter-entity references</termref>&#10;are permitted <emph>within</emph> markup declarations,&#10;not only <emph>between</emph> markup declarations.</p>&#10;<p>An example of an XML document with a document type declaration:&#10;<eg>&lt;?xml version=&quot;1.0&quot;?&gt;&#10;&lt;!DOCTYPE greeting SYSTEM &quot;hello.dtd&quot;&gt;&#10;&lt;greeting&gt;Hello, world!&lt;/greeting&gt;&#10;</eg>&#10;The <termref def="dt-sysid">system identifier</termref> &#10;&quot;<code>hello.dtd</code>&quot; gives the URI of a DTD for the document.</p>&#10;<p>The declarations can also be given locally, as in this &#10;example:&#10;<eg>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;&#10;&lt;!DOCTYPE greeting [&#10;  &lt;!ELEMENT greeting (#PCDATA)&gt;&#10;]&gt;&#10;&lt;greeting&gt;Hello, world!&lt;/greeting&gt;&#10;</eg>&#10;If both the external and internal subsets are used, the &#10;internal subset is considered to occur before the external subset.&#10;&#10;This has the effect that entity and attribute-list declarations in the&#10;internal subset take precedence over those in the external subset.&#10;</p>&#10;</div2>&#10; &#10;<div2 id="sec-rmd">&#10;<head>Standalone Document Declaration</head>&#10;<p>Markup declarations can affect the content of the document,&#10;as passed from an <termref def="dt-xml-proc">XML processor</termref> &#10;to an application; examples are attribute defaults and entity&#10;declarations.&#10;The standalone document declaration,&#10;which may appear as a component of the XML declaration, signals&#10;whether or not there are such declarations which appear external to &#10;the <termref def="dt-docent">document entity</termref>.&#10;<scrap id="fulldtd" lang="ebnf">&#10;<head>Standalone Document Declaration</head>&#10;<prodgroup pcw2="4" pcw4="19.5" pcw5="9">&#10;<prod id="NT-SDDecl"><lhs>SDDecl</lhs>&#10;<rhs>&#10;<nt def="NT-S">S</nt> &#10;'standalone' <nt def="NT-Eq">Eq</nt> &#10;((&quot;'&quot; ('yes' | 'no') &quot;'&quot;) | ('&quot;' ('yes' | 'no') '&quot;'))&#10;</rhs>&#10;<vc def="vc-check-rmd"></vc></prod>&#10;</prodgroup>&#10;</scrap></p>&#10;<p>&#10;In a standalone document declaration, the value &quot;<code>yes</code>&quot; indicates&#10;that there &#10;are no markup declarations external to the <termref def="dt-docent">document&#10;entity</termref> (either in the DTD external subset, or in an&#10;external parameter entity referenced from the internal subset)&#10;which affect the information passed from the XML processor to&#10;the application.  &#10;The value &quot;<code>no</code>&quot; indicates that there are or may be such&#10;external markup declarations.&#10;Note that the standalone document declaration only &#10;denotes the presence of external <emph>declarations</emph>; the presence, in a&#10;document, of &#10;references to external <emph>entities</emph>, when those entities are&#10;internally declared, &#10;does not change its standalone status.</p>&#10;<p>If there are no external markup declarations, the standalone document&#10;declaration has no meaning. &#10;If there are external markup declarations but there is no standalone&#10;document declaration, the value &quot;<code>no</code>&quot; is assumed.</p>&#10;<p>Any XML document for which <code>standalone=&quot;no&quot;</code> holds can &#10;be converted algorithmically to a standalone document, &#10;which may be desirable for some network delivery applications.</p>&#10;<vcnote id="vc-check-rmd">&#10;<head>Standalone Document Declaration</head>&#10;<p>The standalone document declaration must have&#10;the value &quot;<code>no</code>&quot; if any external markup declarations&#10;contain declarations of:</p><ulist>&#10;<item><p>attributes with <termref def="dt-default">default</termref> values, if&#10;elements to which&#10;these attributes apply appear in the document without&#10;specifications of values for these attributes, or</p></item>&#10;<item><p>entities (other than <code>amp</code>,&#10;<code>lt</code>,&#10;<code>gt</code>,&#10;<code>apos</code>,&#10;<code>quot</code>), &#10;if <termref def="dt-entref">references</termref> to those&#10;entities appear in the document, or</p>&#10;</item>&#10;<item><p>attributes with values subject to&#10;<titleref href="AVNormalize">normalization</titleref>, where the&#10;attribute appears in the document with a value which will&#10;change as a result of normalization, or</p>&#10;</item>&#10;<item>&#10;<p>element types with <termref def="dt-elemcontent">element content</termref>, &#10;if white space occurs&#10;directly within any instance of those types.&#10;</p></item>&#10;</ulist>&#10;&#10;</vcnote>&#10;<p>An example XML declaration with a standalone document declaration:<eg>&lt;?xml version=&quot;1.0&quot; standalone='yes'?&gt;</eg></p>&#10;</div2>&#10;<div2 id="sec-white-space">&#10;<head>White Space Handling</head>&#10;&#10;<p>In editing XML documents, it is often convenient to use &quot;white space&quot;&#10;(spaces, tabs, and blank lines, denoted by the nonterminal &#10;<nt def="NT-S">S</nt> in this specification) to&#10;set apart the markup for greater readability.  Such white space is typically&#10;not intended for inclusion in the delivered version of the document.&#10;On the other hand, &quot;significant&quot; white space that should be preserved in the&#10;delivered version is common, for example in poetry and&#10;source code.</p>&#10;<p>An <termref def="dt-xml-proc">XML processor</termref> &#10;must always pass all characters in a document that are not&#10;markup through to the application.   A <termref def="dt-validating">&#10;validating XML processor</termref> must also inform the application&#10;which  of these characters constitute white space appearing&#10;in <termref def="dt-elemcontent">element content</termref>.&#10;</p>&#10;<p>A special <termref def="dt-attr">attribute</termref> &#10;named <kw>xml:space</kw> may be attached to an element&#10;to signal an intention that in that element,&#10;white space should be preserved by applications.&#10;In valid documents, this attribute, like any other, must be &#10;<termref def="dt-attdecl">declared</termref> if it is used.&#10;When declared, it must be given as an &#10;<termref def="dt-enumerated">enumerated type</termref> whose only&#10;possible values are &quot;<code>default</code>&quot; and &quot;<code>preserve</code>&quot;.&#10;For example:<eg>    &lt;!ATTLIST poem   xml:space (default|preserve) 'preserve'&gt;</eg></p>&#10;<p>The value &quot;<code>default</code>&quot; signals that applications'&#10;default white-space processing modes are acceptable for this element; the&#10;value &quot;<code>preserve</code>&quot; indicates the intent that applications preserve&#10;all the white space.&#10;This declared intent is considered to apply to all elements within the content&#10;of the element where it is specified, unless overriden with another instance&#10;of the <kw>xml:space</kw> attribute.&#10;</p>&#10;<p>The <termref def="dt-root">root element</termref> of any document&#10;is considered to have signaled no intentions as regards application space&#10;handling, unless it provides a value for &#10;this attribute or the attribute is declared with a default value.&#10;</p>&#10;&#10;</div2>&#10;<div2 id="sec-line-ends">&#10;<head>End-of-Line Handling</head>&#10;<p>XML <termref def="dt-parsedent">parsed entities</termref> are often stored in&#10;computer files which, for editing convenience, are organized into lines.&#10;These lines are typically separated by some combination of the characters&#10;carriage-return (#xD) and line-feed (#xA).</p>&#10;<p>To simplify the tasks of <termref def="dt-app">applications</termref>,&#10;wherever an external parsed entity or the literal entity value&#10;of an internal parsed entity contains either the literal &#10;two-character sequence &quot;#xD#xA&quot; or a standalone literal&#10;#xD, an <termref def="dt-xml-proc">XML processor</termref> must &#10;pass to the application the single character #xA.&#10;(This behavior can &#10;conveniently be produced by normalizing all &#10;line breaks to #xA on input, before parsing.)&#10;</p>&#10;</div2>&#10;<div2 id="sec-lang-tag">&#10;<head>Language Identification</head>&#10;<p>In document processing, it is often useful to&#10;identify the natural or formal language &#10;in which the content is &#10;written.&#10;A special <termref def="dt-attr">attribute</termref> named&#10;<kw>xml:lang</kw> may be inserted in&#10;documents to specify the &#10;language used in the contents and attribute values &#10;of any element in an XML document.&#10;In valid documents, this attribute, like any other, must be &#10;<termref def="dt-attdecl">declared</termref> if it is used.&#10;The values of the attribute are language identifiers as defined&#10;by <bibref ref="RFC1766"></bibref>, &quot;Tags for the Identification of Languages&quot;:&#10;<scrap lang="ebnf">&#10;<head>Language Identification</head>&#10;<prod id="NT-LanguageID"><lhs>LanguageID</lhs>&#10;<rhs><nt def="NT-Langcode">Langcode</nt> &#10;('-' <nt def="NT-Subcode">Subcode</nt>)*</rhs></prod>&#10;<prod id="NT-Langcode"><lhs>Langcode</lhs>&#10;<rhs><nt def="NT-ISO639Code">ISO639Code</nt> | &#10;<nt def="NT-IanaCode">IanaCode</nt> | &#10;<nt def="NT-UserCode">UserCode</nt></rhs>&#10;</prod>&#10;<prod id="NT-ISO639Code"><lhs>ISO639Code</lhs>&#10;<rhs>([a-z] | [A-Z]) ([a-z] | [A-Z])</rhs></prod>&#10;<prod id="NT-IanaCode"><lhs>IanaCode</lhs>&#10;<rhs>('i' | 'I') '-' ([a-z] | [A-Z])+</rhs></prod>&#10;<prod id="NT-UserCode"><lhs>UserCode</lhs>&#10;<rhs>('x' | 'X') '-' ([a-z] | [A-Z])+</rhs></prod>&#10;<prod id="NT-Subcode"><lhs>Subcode</lhs>&#10;<rhs>([a-z] | [A-Z])+</rhs></prod>&#10;</scrap>&#10;The <nt def="NT-Langcode">Langcode</nt> may be any of the following:&#10;<ulist>&#10;<item><p>a two-letter language code as defined by &#10;<bibref ref="ISO639"></bibref>, &quot;Codes&#10;for the representation of names of languages&quot;</p></item>&#10;<item><p>a language identifier registered with the Internet&#10;Assigned Numbers Authority <bibref ref="IANA"></bibref>; these begin with the &#10;prefix &quot;<code>i-</code>&quot; (or &quot;<code>I-</code>&quot;)</p></item>&#10;<item><p>a language identifier assigned by the user, or agreed on&#10;between parties in private use; these must begin with the&#10;prefix &quot;<code>x-</code>&quot; or &quot;<code>X-</code>&quot; in order to ensure that they do not conflict &#10;with names later standardized or registered with IANA</p></item>&#10;</ulist></p>&#10;<p>There may be any number of <nt def="NT-Subcode">Subcode</nt> segments; if&#10;the first &#10;subcode segment exists and the Subcode consists of two &#10;letters, then it must be a country code from &#10;<bibref ref="ISO3166"></bibref>, &quot;Codes &#10;for the representation of names of countries.&quot;&#10;If the first &#10;subcode consists of more than two letters, it must be&#10;a subcode for the language in question registered with IANA,&#10;unless the <nt def="NT-Langcode">Langcode</nt> begins with the prefix &#10;&quot;<code>x-</code>&quot; or&#10;&quot;<code>X-</code>&quot;. </p>&#10;<p>It is customary to give the language code in lower case, and&#10;the country code (if any) in upper case.&#10;Note that these values, unlike other names in XML documents,&#10;are case insensitive.</p>&#10;<p>For example:&#10;<eg>&lt;p xml:lang=&quot;en&quot;&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;&#10;&lt;p xml:lang=&quot;en-GB&quot;&gt;What colour is it?&lt;/p&gt;&#10;&lt;p xml:lang=&quot;en-US&quot;&gt;What color is it?&lt;/p&gt;&#10;&lt;sp who=&quot;Faust&quot; desc='leise' xml:lang=&quot;de&quot;&gt;&#10;  &lt;l&gt;Habe nun, ach! Philosophie,&lt;/l&gt;&#10;  &lt;l&gt;Juristerei, und Medizin&lt;/l&gt;&#10;  &lt;l&gt;und leider auch Theologie&lt;/l&gt;&#10;  &lt;l&gt;durchaus studiert mit heißem Bemüh'n.&lt;/l&gt;&#10;  &lt;/sp&gt;</eg></p>&#10;&#10;<p>The intent declared with <kw>xml:lang</kw> is considered to apply to&#10;all attributes and content of the element where it is specified,&#10;unless overridden with an instance of <kw>xml:lang</kw>&#10;on another element within that content.</p>&#10;&#10;<p>A simple declaration for <kw>xml:lang</kw> might take&#10;the form&#10;<eg>xml:lang  NMTOKEN  #IMPLIED</eg>&#10;but specific default values may also be given, if appropriate.  In a&#10;collection of French poems for English students, with glosses and&#10;notes in English, the xml:lang attribute might be declared this way:&#10;<eg>    &lt;!ATTLIST poem   xml:lang NMTOKEN 'fr'&gt;&#10;    &lt;!ATTLIST gloss  xml:lang NMTOKEN 'en'&gt;&#10;    &lt;!ATTLIST note   xml:lang NMTOKEN 'en'&gt;</eg>&#10;</p>&#10;&#10;</div2>&#10;</div1>&#10;&#10; &#10;<div1 id="sec-logical-struct">&#10;<head>Logical Structures</head>&#10; &#10;<p><termdef id="dt-element" term="Element">Each <termref def="dt-xml-doc">XML document</termref> contains one or more&#10;<term>elements</term>, the boundaries of which are &#10;either delimited by <termref def="dt-stag">start-tags</termref> &#10;and <termref def="dt-etag">end-tags</termref>, or, for <termref def="dt-empty">empty</termref> elements, by an <termref def="dt-eetag">empty-element tag</termref>. Each element has a type,&#10;identified by name, sometimes called its &quot;generic&#10;identifier&quot; (GI), and may have a set of&#10;attribute specifications.</termdef>  Each attribute specification &#10;has a <termref def="dt-attrname">name</termref> and a <termref def="dt-attrval">value</termref>.&#10;</p>&#10;<scrap lang="ebnf"><head>Element</head>&#10;<prod id="NT-element"><lhs>element</lhs>&#10;<rhs><nt def="NT-EmptyElemTag">EmptyElemTag</nt></rhs>&#10;<rhs>| <nt def="NT-STag">STag</nt> <nt def="NT-content">content</nt> &#10;<nt def="NT-ETag">ETag</nt></rhs>&#10;<wfc def="GIMatch"></wfc>&#10;<vc def="elementvalid"></vc>&#10;</prod>&#10;</scrap>&#10;<p>This specification does not constrain the semantics, use, or (beyond&#10;syntax) names of the element types and attributes, except that names&#10;beginning with a match to <code>(('X'|'x')('M'|'m')('L'|'l'))</code>&#10;are reserved for standardization in this or future versions of this&#10;specification.&#10;</p>&#10;<wfcnote id="GIMatch">&#10;<head>Element Type Match</head>&#10;<p>&#10;The <nt def="NT-Name">Name</nt> in an element's end-tag must match &#10;the element type in&#10;the start-tag.&#10;</p>&#10;</wfcnote>&#10;<vcnote id="elementvalid">&#10;<head>Element Valid</head>&#10;<p>An element is&#10;valid if&#10;there is a declaration matching &#10;<nt def="NT-elementdecl">elementdecl</nt> where the&#10;<nt def="NT-Name">Name</nt> matches the element type, and&#10;one of the following holds:</p>&#10;<olist>&#10;<item><p>The declaration matches <kw>EMPTY</kw> and the element has no &#10;<termref def="dt-content">content</termref>.</p></item>&#10;<item><p>The declaration matches <nt def="NT-children">children</nt> and&#10;the sequence of &#10;<termref def="dt-parentchild">child elements</termref>&#10;belongs to the language generated by the regular expression in&#10;the content model, with optional white space (characters &#10;matching the nonterminal <nt def="NT-S">S</nt>) between each pair&#10;of child elements.</p></item>&#10;<item><p>The declaration matches <nt def="NT-Mixed">Mixed</nt> and &#10;the content consists of <termref def="dt-chardata">character &#10;data</termref> and <termref def="dt-parentchild">child elements</termref>&#10;whose types match names in the content model.</p></item>&#10;<item><p>The declaration matches <kw>ANY</kw>, and the types&#10;of any <termref def="dt-parentchild">child elements</termref> have&#10;been declared.</p></item>&#10;</olist>&#10;</vcnote>&#10;&#10;<div2 id="sec-starttags">&#10;<head>Start-Tags, End-Tags, and Empty-Element Tags</head>&#10; &#10;<p><termdef id="dt-stag" term="Start-Tag">The beginning of every&#10;non-empty XML element is marked by a <term>start-tag</term>.&#10;<scrap lang="ebnf">&#10;<head>Start-tag</head>&#10;<prodgroup pcw2="6" pcw4="15" pcw5="11.5">&#10;<prod id="NT-STag"><lhs>STag</lhs>&#10;<rhs>'&lt;' <nt def="NT-Name">Name</nt> &#10;(<nt def="NT-S">S</nt> <nt def="NT-Attribute">Attribute</nt>)* &#10;<nt def="NT-S">S</nt>? '&gt;'</rhs>&#10;<wfc def="uniqattspec"></wfc>&#10;</prod>&#10;<prod id="NT-Attribute"><lhs>Attribute</lhs>&#10;<rhs><nt def="NT-Name">Name</nt> <nt def="NT-Eq">Eq</nt> &#10;<nt def="NT-AttValue">AttValue</nt></rhs>&#10;<vc def="ValueType"></vc>&#10;<wfc def="NoExternalRefs"></wfc>&#10;<wfc def="CleanAttrVals"></wfc></prod>&#10;</prodgroup>&#10;</scrap>&#10;The <nt def="NT-Name">Name</nt> in&#10;the start- and end-tags gives the &#10;element's <term>type</term>.</termdef>&#10;<termdef id="dt-attr" term="Attribute">&#10;The <nt def="NT-Name">Name</nt>-<nt def="NT-AttValue">AttValue</nt> pairs are&#10;referred to as &#10;the <term>attribute specifications</term> of the element</termdef>,&#10;<termdef id="dt-attrname" term="Attribute Name">with the &#10;<nt def="NT-Name">Name</nt> in each pair&#10;referred to as the <term>attribute name</term></termdef> and&#10;<termdef id="dt-attrval" term="Attribute Value">the content of the&#10;<nt def="NT-AttValue">AttValue</nt> (the text between the&#10;<code>'</code> or <code>&quot;</code> delimiters)&#10;as the <term>attribute value</term>.</termdef>&#10;</p>&#10;<wfcnote id="uniqattspec">&#10;<head>Unique Att Spec</head>&#10;<p>&#10;No attribute name may appear more than once in the same start-tag&#10;or empty-element tag.&#10;</p>&#10;</wfcnote>&#10;<vcnote id="ValueType">&#10;<head>Attribute Value Type</head>&#10;<p>&#10;The attribute must have been declared; the value must be of the type &#10;declared for it.&#10;(For attribute types, see <specref ref="attdecls"></specref>.)&#10;</p>&#10;</vcnote>&#10;<wfcnote id="NoExternalRefs">&#10;<head>No External Entity References</head>&#10;<p>&#10;Attribute values cannot contain direct or indirect entity references &#10;to external entities.&#10;</p>&#10;</wfcnote>&#10;<wfcnote id="CleanAttrVals">&#10;<head>No <code>&lt;</code> in Attribute Values</head>&#10;<p>The <termref def="dt-repltext">replacement text</termref> of any entity&#10;referred to directly or indirectly in an attribute&#10;value (other than &quot;<code>&amp;lt;</code>&quot;) must not contain&#10;a <code>&lt;</code>.&#10;</p></wfcnote>&#10;<p>An example of a start-tag:&#10;<eg>&lt;termdef id=&quot;dt-dog&quot; term=&quot;dog&quot;&gt;</eg></p>&#10;<p><termdef id="dt-etag" term="End Tag">The end of every element &#10;that begins with a start-tag must&#10;be marked by an <term>end-tag</term>&#10;containing a name that echoes the element's type as given in the&#10;start-tag:&#10;<scrap lang="ebnf">&#10;<head>End-tag</head>&#10;<prodgroup pcw2="6" pcw4="15" pcw5="11.5">&#10;<prod id="NT-ETag"><lhs>ETag</lhs>&#10;<rhs>'&lt;/' <nt def="NT-Name">Name</nt> &#10;<nt def="NT-S">S</nt>? '&gt;'</rhs></prod>&#10;</prodgroup>&#10;</scrap>&#10;</termdef></p>&#10;<p>An example of an end-tag:<eg>&lt;/termdef&gt;</eg></p>&#10;<p><termdef id="dt-content" term="Content">The &#10;<termref def="dt-text">text</termref> between the start-tag and&#10;end-tag is called the element's&#10;<term>content</term>:&#10;<scrap lang="ebnf">&#10;<head>Content of Elements</head>&#10;<prodgroup pcw2="6" pcw4="15" pcw5="11.5">&#10;<prod id="NT-content"><lhs>content</lhs>&#10;<rhs>(<nt def="NT-element">element</nt> | <nt def="NT-CharData">CharData</nt> &#10;| <nt def="NT-Reference">Reference</nt> | <nt def="NT-CDSect">CDSect</nt> &#10;| <nt def="NT-PI">PI</nt> | <nt def="NT-Comment">Comment</nt>)*</rhs>&#10;</prod>&#10;</prodgroup>&#10;</scrap>&#10;</termdef></p>&#10;<p><termdef id="dt-empty" term="Empty">If an element is <term>empty</term>,&#10;it must be represented either by a start-tag immediately followed&#10;by an end-tag or by an empty-element tag.</termdef>&#10;<termdef id="dt-eetag" term="empty-element tag">An &#10;<term>empty-element tag</term> takes a special form:&#10;<scrap lang="ebnf">&#10;<head>Tags for Empty Elements</head>&#10;<prodgroup pcw2="6" pcw4="15" pcw5="11.5">&#10;<prod id="NT-EmptyElemTag"><lhs>EmptyElemTag</lhs>&#10;<rhs>'&lt;' <nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt> &#10;<nt def="NT-Attribute">Attribute</nt>)* <nt def="NT-S">S</nt>? &#10;'/&gt;'</rhs>&#10;<wfc def="uniqattspec"></wfc>&#10;</prod>&#10;</prodgroup>&#10;</scrap>&#10;</termdef></p>&#10;<p>Empty-element tags may be used for any element which has no&#10;content, whether or not it is declared using the keyword&#10;<kw>EMPTY</kw>.&#10;<termref def="dt-interop">For interoperability</termref>, the empty-element&#10;tag must be used, and can only be used, for elements which are&#10;<termref def="dt-eldecl">declared</termref> <kw>EMPTY</kw>.</p>&#10;<p>Examples of empty elements:&#10;<eg>&lt;IMG align=&quot;left&quot;&#10; src=&quot;http://www.w3.org/Icons/WWW/w3c_home&quot; /&gt;&#10;&lt;br&gt;&lt;/br&gt;&#10;&lt;br/&gt;</eg></p>&#10;</div2>&#10; &#10;<div2 id="elemdecls">&#10;<head>Element Type Declarations</head>&#10; &#10;<p>The <termref def="dt-element">element</termref> structure of an&#10;<termref def="dt-xml-doc">XML document</termref> may, for &#10;<termref def="dt-valid">validation</termref> purposes, &#10;be constrained&#10;using element type and attribute-list declarations.&#10;An element type declaration constrains the element's&#10;<termref def="dt-content">content</termref>.&#10;</p>&#10;&#10;<p>Element type declarations often constrain which element types can&#10;appear as <termref def="dt-parentchild">children</termref> of the element.&#10;At user option, an XML processor may issue a warning&#10;when a declaration mentions an element type for which no declaration&#10;is provided, but this is not an error.</p>&#10;<p><termdef id="dt-eldecl" term="Element Type declaration">An <term>element&#10;type declaration</term> takes the form:&#10;<scrap lang="ebnf">&#10;<head>Element Type Declaration</head>&#10;<prodgroup pcw2="5.5" pcw4="18" pcw5="9">&#10;<prod id="NT-elementdecl"><lhs>elementdecl</lhs>&#10;<rhs>'&lt;!ELEMENT' <nt def="NT-S">S</nt> &#10;<nt def="NT-Name">Name</nt> &#10;<nt def="NT-S">S</nt> &#10;<nt def="NT-contentspec">contentspec</nt>&#10;<nt def="NT-S">S</nt>? '&gt;'</rhs>&#10;<vc def="EDUnique"></vc></prod>&#10;<prod id="NT-contentspec"><lhs>contentspec</lhs>&#10;<rhs>'EMPTY' &#10;| 'ANY' &#10;| <nt def="NT-Mixed">Mixed</nt> &#10;| <nt def="NT-children">children</nt>&#10;</rhs>&#10;</prod>&#10;</prodgroup>&#10;</scrap>&#10;where the <nt def="NT-Name">Name</nt> gives the element type &#10;being declared.</termdef>&#10;</p>&#10;&#10;<vcnote id="EDUnique">&#10;<head>Unique Element Type Declaration</head>&#10;<p>&#10;No element type may be declared more than once.&#10;</p>&#10;</vcnote>&#10;&#10;<p>Examples of element type declarations:&#10;<eg>&lt;!ELEMENT br EMPTY&gt;&#10;&lt;!ELEMENT p (#PCDATA|emph)* &gt;&#10;&lt;!ELEMENT %name.para; %content.para; &gt;&#10;&lt;!ELEMENT container ANY&gt;</eg></p>&#10; &#10;<div3 id="sec-element-content">&#10;<head>Element Content</head>&#10; &#10;<p><termdef id="dt-elemcontent" term="Element content">An element <termref def="dt-stag">type</termref> has&#10;<term>element content</term> when elements of that&#10;type must contain only <termref def="dt-parentchild">child</termref> &#10;elements (no character data), optionally separated by &#10;white space (characters matching the nonterminal &#10;<nt def="NT-S">S</nt>).&#10;</termdef>&#10;In this case, the&#10;constraint includes a content model, a simple grammar governing&#10;the allowed types of the child&#10;elements and the order in which they are allowed to appear.  &#10;The grammar is built on&#10;content particles (<nt def="NT-cp">cp</nt>s), which consist of names, &#10;choice lists of content particles, or&#10;sequence lists of content particles:&#10;<scrap lang="ebnf">&#10;<head>Element-content Models</head>&#10;<prodgroup pcw2="5.5" pcw4="16" pcw5="11">&#10;<prod id="NT-children"><lhs>children</lhs>&#10;<rhs>(<nt def="NT-choice">choice</nt> &#10;| <nt def="NT-seq">seq</nt>) &#10;('?' | '*' | '+')?</rhs></prod>&#10;<prod id="NT-cp"><lhs>cp</lhs>&#10;<rhs>(<nt def="NT-Name">Name</nt> &#10;| <nt def="NT-choice">choice</nt> &#10;| <nt def="NT-seq">seq</nt>) &#10;('?' | '*' | '+')?</rhs></prod>&#10;<prod id="NT-choice"><lhs>choice</lhs>&#10;<rhs>'(' <nt def="NT-S">S</nt>? cp &#10;( <nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )*&#10;<nt def="NT-S">S</nt>? ')'</rhs>&#10;<vc def="vc-PEinGroup"></vc></prod>&#10;<prod id="NT-seq"><lhs>seq</lhs>&#10;<rhs>'(' <nt def="NT-S">S</nt>? cp &#10;( <nt def="NT-S">S</nt>? ',' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )*&#10;<nt def="NT-S">S</nt>? ')'</rhs>&#10;<vc def="vc-PEinGroup"></vc></prod>&#10;&#10;</prodgroup>&#10;</scrap>&#10;where each <nt def="NT-Name">Name</nt> is the type of an element which may&#10;appear as a <termref def="dt-parentchild">child</termref>.  &#10;Any content&#10;particle in a choice list may appear in the <termref def="dt-elemcontent">element content</termref> at the location where&#10;the choice list appears in the grammar;&#10;content particles occurring in a sequence list must each&#10;appear in the <termref def="dt-elemcontent">element content</termref> in the&#10;order given in the list.  &#10;The optional character following a name or list governs&#10;whether the element or the content particles in the list may occur one&#10;or more (<code>+</code>), zero or more (<code>*</code>), or zero or &#10;one times (<code>?</code>).  &#10;The absence of such an operator means that the element or content particle&#10;must appear exactly once.&#10;This syntax&#10;and meaning are identical to those used in the productions in this&#10;specification.</p>&#10;<p>&#10;The content of an element matches a content model if and only if it is&#10;possible to trace out a path through the content model, obeying the&#10;sequence, choice, and repetition operators and matching each element in&#10;the content against an element type in the content model.  <termref def="dt-compat">For compatibility</termref>, it is an error&#10;if an element in the document can&#10;match more than one occurrence of an element type in the content model.&#10;For more information, see <specref ref="determinism"></specref>.&#10;&#10;&#10;</p>&#10;<vcnote id="vc-PEinGroup">&#10;<head>Proper Group/PE Nesting</head>&#10;<p>Parameter-entity &#10;<termref def="dt-repltext">replacement text</termref> must be properly nested&#10;with parenthetized groups.&#10;That is to say, if either of the opening or closing parentheses&#10;in a <nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or&#10;<nt def="NT-Mixed">Mixed</nt> construct &#10;is contained in the replacement text for a &#10;<termref def="dt-PERef">parameter entity</termref>,&#10;both must be contained in the same replacement text.</p>&#10;<p><termref def="dt-interop">For interoperability</termref>, &#10;if a parameter-entity reference appears in a &#10;<nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or&#10;<nt def="NT-Mixed">Mixed</nt> construct, its replacement text&#10;should not be empty, and &#10;neither the first nor last non-blank&#10;character of the replacement text should be a connector &#10;(<code>|</code> or <code>,</code>).&#10;</p>&#10;</vcnote>&#10;<p>Examples of element-content models:&#10;<eg>&lt;!ELEMENT spec (front, body, back?)&gt;&#10;&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)&gt;&#10;&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*&gt;</eg></p>&#10;</div3>&#10;&#10;<div3 id="sec-mixed-content">&#10;<head>Mixed Content</head>&#10; &#10;<p><termdef id="dt-mixed" term="Mixed Content">An element &#10;<termref def="dt-stag">type</termref> has &#10;<term>mixed content</term> when elements of that type may contain&#10;character data, optionally interspersed with&#10;<termref def="dt-parentchild">child</termref> elements.</termdef>&#10;In this case, the types of the child elements&#10;may be constrained, but not their order or their number of occurrences:&#10;<scrap lang="ebnf">&#10;<head>Mixed-content Declaration</head>&#10;<prodgroup pcw2="5.5" pcw4="16" pcw5="11">&#10;<prod id="NT-Mixed"><lhs>Mixed</lhs>&#10;<rhs>'(' <nt def="NT-S">S</nt>? &#10;'#PCDATA'&#10;(<nt def="NT-S">S</nt>? &#10;'|' &#10;<nt def="NT-S">S</nt>? &#10;<nt def="NT-Name">Name</nt>)* &#10;<nt def="NT-S">S</nt>? &#10;')*' </rhs>&#10;<rhs>| '(' <nt def="NT-S">S</nt>? '#PCDATA' <nt def="NT-S">S</nt>? ')'&#10;</rhs><vc def="vc-PEinGroup"></vc>&#10;<vc def="vc-MixedChildrenUnique"></vc>&#10;</prod>&#10;&#10;</prodgroup>&#10;</scrap>&#10;where the <nt def="NT-Name">Name</nt>s give the types of elements&#10;that may appear as children.&#10;</p>&#10;<vcnote id="vc-MixedChildrenUnique">&#10;<head>No Duplicate Types</head>&#10;<p>The same name must not appear more than once in a single mixed-content&#10;declaration.&#10;</p></vcnote>&#10;<p>Examples of mixed content declarations:&#10;<eg>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;&#10;&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* &gt;&#10;&lt;!ELEMENT b (#PCDATA)&gt;</eg></p>&#10;</div3>&#10;</div2>&#10; &#10;<div2 id="attdecls">&#10;<head>Attribute-List Declarations</head>&#10; &#10;<p><termref def="dt-attr">Attributes</termref> are used to associate&#10;name-value pairs with <termref def="dt-element">elements</termref>.&#10;Attribute specifications may appear only within <termref def="dt-stag">start-tags</termref>&#10;and <termref def="dt-eetag">empty-element tags</termref>; &#10;thus, the productions used to&#10;recognize them appear in <specref ref="sec-starttags"></specref>.  &#10;Attribute-list&#10;declarations may be used:&#10;<ulist>&#10;<item><p>To define the set of attributes pertaining to a given&#10;element type.</p></item>&#10;<item><p>To establish type constraints for these&#10;attributes.</p></item>&#10;<item><p>To provide <termref def="dt-default">default values</termref>&#10;for attributes.</p></item>&#10;</ulist>&#10;</p>&#10;<p><termdef id="dt-attdecl" term="Attribute-List Declaration">&#10;<term>Attribute-list declarations</term> specify the name, data type, and default&#10;value (if any) of each attribute associated with a given element type:&#10;<scrap lang="ebnf">&#10;<head>Attribute-list Declaration</head>&#10;<prod id="NT-AttlistDecl"><lhs>AttlistDecl</lhs>&#10;<rhs>'&lt;!ATTLIST' <nt def="NT-S">S</nt> &#10;<nt def="NT-Name">Name</nt> &#10;<nt def="NT-AttDef">AttDef</nt>*&#10;<nt def="NT-S">S</nt>? '&gt;'</rhs>&#10;</prod>&#10;<prod id="NT-AttDef"><lhs>AttDef</lhs>&#10;<rhs><nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> &#10;<nt def="NT-S">S</nt> <nt def="NT-AttType">AttType</nt> &#10;<nt def="NT-S">S</nt> <nt def="NT-DefaultDecl">DefaultDecl</nt></rhs>&#10;</prod>&#10;</scrap>&#10;The <nt def="NT-Name">Name</nt> in the&#10;<nt def="NT-AttlistDecl">AttlistDecl</nt> rule is the type of an element.  At&#10;user option, an XML processor may issue a warning if attributes are&#10;declared for an element type not itself declared, but this is not an&#10;error.  The <nt def="NT-Name">Name</nt> in the &#10;<nt def="NT-AttDef">AttDef</nt> rule is&#10;the name of the attribute.</termdef></p>&#10;<p>&#10;When more than one <nt def="NT-AttlistDecl">AttlistDecl</nt> is provided for a&#10;given element type, the contents of all those provided are merged.  When&#10;more than one definition is provided for the same attribute of a&#10;given element type, the first declaration is binding and later&#10;declarations are ignored.  &#10;<termref def="dt-interop">For interoperability,</termref> writers of DTDs&#10;may choose to provide at most one attribute-list declaration&#10;for a given element type, at most one attribute definition&#10;for a given attribute name, and at least one attribute definition&#10;in each attribute-list declaration.&#10;For interoperability, an XML processor may at user option&#10;issue a warning when more than one attribute-list declaration is&#10;provided for a given element type, or more than one attribute definition&#10;is provided &#10;for a given attribute, but this is not an error.&#10;</p>&#10;&#10;<div3 id="sec-attribute-types">&#10;<head>Attribute Types</head>&#10; &#10;<p>XML attribute types are of three kinds:  a string type, a&#10;set of tokenized types, and enumerated types.  The string type may take&#10;any literal string as a value; the tokenized types have varying lexical&#10;and semantic constraints, as noted:&#10;<scrap lang="ebnf">&#10;<head>Attribute Types</head>&#10;<prodgroup pcw4="14" pcw5="11.5">&#10;<prod id="NT-AttType"><lhs>AttType</lhs>&#10;<rhs><nt def="NT-StringType">StringType</nt> &#10;| <nt def="NT-TokenizedType">TokenizedType</nt> &#10;| <nt def="NT-EnumeratedType">EnumeratedType</nt>&#10;</rhs>&#10;</prod>&#10;<prod id="NT-StringType"><lhs>StringType</lhs>&#10;<rhs>'CDATA'</rhs>&#10;</prod>&#10;<prod id="NT-TokenizedType"><lhs>TokenizedType</lhs>&#10;<rhs>'ID'</rhs>&#10;<vc def="id"></vc>&#10;<vc def="one-id-per-el"></vc>&#10;<vc def="id-default"></vc>&#10;<rhs>| 'IDREF'</rhs>&#10;<vc def="idref"></vc>&#10;<rhs>| 'IDREFS'</rhs>&#10;<vc def="idref"></vc>&#10;<rhs>| 'ENTITY'</rhs>&#10;<vc def="entname"></vc>&#10;<rhs>| 'ENTITIES'</rhs>&#10;<vc def="entname"></vc>&#10;<rhs>| 'NMTOKEN'</rhs>&#10;<vc def="nmtok"></vc>&#10;<rhs>| 'NMTOKENS'</rhs>&#10;<vc def="nmtok"></vc></prod>&#10;</prodgroup>&#10;</scrap>&#10;</p>&#10;<vcnote id="id">&#10;<head>ID</head>&#10;<p>&#10;Values of type <kw>ID</kw> must match the &#10;<nt def="NT-Name">Name</nt> production.  &#10;A name must not appear more than once in&#10;an XML document as a value of this type; i.e., ID values must uniquely&#10;identify the elements which bear them.   &#10;</p>&#10;</vcnote>&#10;<vcnote id="one-id-per-el">&#10;<head>One ID per Element Type</head>&#10;<p>No element type may have more than one ID attribute specified.</p>&#10;</vcnote>&#10;<vcnote id="id-default">&#10;<head>ID Attribute Default</head>&#10;<p>An ID attribute must have a declared default of <kw>#IMPLIED</kw> or&#10;<kw>#REQUIRED</kw>.</p>&#10;</vcnote>&#10;<vcnote id="idref">&#10;<head>IDREF</head>&#10;<p>&#10;Values of type <kw>IDREF</kw> must match&#10;the <nt def="NT-Name">Name</nt> production, and&#10;values of type <kw>IDREFS</kw> must match&#10;<nt def="NT-Names">Names</nt>; &#10;each <nt def="NT-Name">Name</nt> must match the value of an ID attribute on &#10;some element in the XML document; i.e. <kw>IDREF</kw> values must &#10;match the value of some ID attribute. &#10;</p>&#10;</vcnote>&#10;<vcnote id="entname">&#10;<head>Entity Name</head>&#10;<p>&#10;Values of type <kw>ENTITY</kw> &#10;must match the <nt def="NT-Name">Name</nt> production,&#10;values of type <kw>ENTITIES</kw> must match&#10;<nt def="NT-Names">Names</nt>;&#10;each <nt def="NT-Name">Name</nt> must &#10;match the&#10;name of an <termref def="dt-unparsed">unparsed entity</termref> declared in the&#10;<termref def="dt-doctype">DTD</termref>.&#10;</p>&#10;</vcnote>&#10;<vcnote id="nmtok">&#10;<head>Name Token</head>&#10;<p>&#10;Values of type <kw>NMTOKEN</kw> must match the&#10;<nt def="NT-Nmtoken">Nmtoken</nt> production;&#10;values of type <kw>NMTOKENS</kw> must &#10;match <termref def="NT-Nmtokens">Nmtokens</termref>.&#10;</p>&#10;</vcnote>&#10;&#10;<p><termdef id="dt-enumerated" term="Enumerated Attribute Values"><term>Enumerated attributes</term> can take one &#10;of a list of values provided in the declaration</termdef>. There are two&#10;kinds of enumerated types:&#10;<scrap lang="ebnf">&#10;<head>Enumerated Attribute Types</head>&#10;<prod id="NT-EnumeratedType"><lhs>EnumeratedType</lhs> &#10;<rhs><nt def="NT-NotationType">NotationType</nt> &#10;| <nt def="NT-Enumeration">Enumeration</nt>&#10;</rhs></prod>&#10;<prod id="NT-NotationType"><lhs>NotationType</lhs> &#10;<rhs>'NOTATION' &#10;<nt def="NT-S">S</nt> &#10;'(' &#10;<nt def="NT-S">S</nt>?  &#10;<nt def="NT-Name">Name</nt> &#10;(<nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>?  &#10;<nt def="NT-Name">Name</nt>)*&#10;<nt def="NT-S">S</nt>? ')'&#10;</rhs>&#10;<vc def="notatn"></vc></prod>&#10;<prod id="NT-Enumeration"><lhs>Enumeration</lhs> &#10;<rhs>'(' <nt def="NT-S">S</nt>?&#10;<nt def="NT-Nmtoken">Nmtoken</nt> &#10;(<nt def="NT-S">S</nt>? '|' &#10;<nt def="NT-S">S</nt>?  &#10;<nt def="NT-Nmtoken">Nmtoken</nt>)* &#10;<nt def="NT-S">S</nt>? &#10;')'</rhs> &#10;<vc def="enum"></vc></prod>&#10;</scrap>&#10;A <kw>NOTATION</kw> attribute identifies a &#10;<termref def="dt-notation">notation</termref>, declared in the &#10;DTD with associated system and/or public identifiers, to&#10;be used in interpreting the element to which the attribute&#10;is attached.&#10;</p>&#10;&#10;<vcnote id="notatn">&#10;<head>Notation Attributes</head>&#10;<p>&#10;Values of this type must match&#10;one of the <titleref href="Notations">notation</titleref> names included in&#10;the declaration; all notation names in the declaration must&#10;be declared.&#10;</p>&#10;</vcnote>&#10;<vcnote id="enum">&#10;<head>Enumeration</head>&#10;<p>&#10;Values of this type&#10;must match one of the <nt def="NT-Nmtoken">Nmtoken</nt> tokens in the&#10;declaration. &#10;</p>&#10;</vcnote>&#10;<p><termref def="dt-interop">For interoperability,</termref> the same&#10;<nt def="NT-Nmtoken">Nmtoken</nt> should not occur more than once in the&#10;enumerated attribute types of a single element type.&#10;</p>&#10;</div3>&#10;&#10;<div3 id="sec-attr-defaults">&#10;<head>Attribute Defaults</head>&#10; &#10;<p>An <termref def="dt-attdecl">attribute declaration</termref> provides&#10;information on whether&#10;the attribute's presence is required, and if not, how an XML processor should&#10;react if a declared attribute is absent in a document.&#10;<scrap lang="ebnf">&#10;<head>Attribute Defaults</head>&#10;<prodgroup pcw4="14" pcw5="11.5">&#10;<prod id="NT-DefaultDecl"><lhs>DefaultDecl</lhs>&#10;<rhs>'#REQUIRED' &#10;| '#IMPLIED' </rhs>&#10;<rhs>| (('#FIXED' S)? <nt def="NT-AttValue">AttValue</nt>)</rhs>&#10;<vc def="RequiredAttr"></vc>&#10;<vc def="defattrvalid"></vc>&#10;<wfc def="CleanAttrVals"></wfc>&#10;<vc def="FixedAttr"></vc>&#10;</prod>&#10;</prodgroup>&#10;</scrap>&#10;&#10;</p>&#10;<p>In an attribute declaration, <kw>#REQUIRED</kw> means that the&#10;attribute must always be provided, <kw>#IMPLIED</kw> that no default &#10;value is provided.&#10;&#10;<termdef id="dt-default" term="Attribute Default">If the &#10;declaration&#10;is neither <kw>#REQUIRED</kw> nor <kw>#IMPLIED</kw>, then the&#10;<nt def="NT-AttValue">AttValue</nt> value contains the declared&#10;<term>default</term> value; the <kw>#FIXED</kw> keyword states that&#10;the attribute must always have the default value.&#10;If a default value&#10;is declared, when an XML processor encounters an omitted attribute, it&#10;is to behave as though the attribute were present with &#10;the declared default value.</termdef></p>&#10;<vcnote id="RequiredAttr">&#10;<head>Required Attribute</head>&#10;<p>If the default declaration is the keyword <kw>#REQUIRED</kw>, then&#10;the attribute must be specified for&#10;all elements of the type in the attribute-list declaration.&#10;</p></vcnote>&#10;<vcnote id="defattrvalid">&#10;<head>Attribute Default Legal</head>&#10;<p>&#10;The declared&#10;default value must meet the lexical constraints of the declared attribute type.&#10;</p>&#10;</vcnote>&#10;<vcnote id="FixedAttr">&#10;<head>Fixed Attribute Default</head>&#10;<p>If an attribute has a default value declared with the &#10;<kw>#FIXED</kw> keyword, instances of that attribute must&#10;match the default value.&#10;</p></vcnote>&#10;&#10;<p>Examples of attribute-list declarations:&#10;<eg>&lt;!ATTLIST termdef&#10;          id      ID      #REQUIRED&#10;          name    CDATA   #IMPLIED&gt;&#10;&lt;!ATTLIST list&#10;          type    (bullets|ordered|glossary)  &quot;ordered&quot;&gt;&#10;&lt;!ATTLIST form&#10;          method  CDATA   #FIXED &quot;POST&quot;&gt;</eg></p>&#10;</div3>&#10;<div3 id="AVNormalize">&#10;<head>Attribute-Value Normalization</head>&#10;<p>Before the value of an attribute is passed to the application&#10;or checked for validity, the&#10;XML processor must normalize it as follows:&#10;<ulist>&#10;<item><p>a character reference is processed by appending the referenced    &#10;character to the attribute value</p></item>&#10;<item><p>an entity reference is processed by recursively processing the&#10;replacement text of the entity</p></item>&#10;<item><p>a whitespace character (#x20, #xD, #xA, #x9) is processed by&#10;appending #x20 to the normalized value, except that only a single #x20&#10;is appended for a &quot;#xD#xA&quot; sequence that is part of an external&#10;parsed entity or the literal entity value of an internal parsed&#10;entity</p></item>&#10;<item><p>other characters are processed by appending them to the normalized&#10;value</p>&#10;</item></ulist>&#10;</p>&#10;<p>If the declared value is not CDATA, then the XML processor must&#10;further process the normalized attribute value by discarding any&#10;leading and trailing space (#x20) characters, and by replacing&#10;sequences of space (#x20) characters by a single space (#x20)&#10;character.</p>&#10;<p>&#10;All attributes for which no declaration has been read should be treated&#10;by a non-validating parser as if declared&#10;<kw>CDATA</kw>.&#10;</p>&#10;</div3>&#10;</div2>&#10;<div2 id="sec-condition-sect">&#10;<head>Conditional Sections</head>&#10;<p><termdef id="dt-cond-section" term="conditional section">&#10;<term>Conditional sections</term> are portions of the&#10;<termref def="dt-doctype">document type declaration external subset</termref>&#10;which are &#10;included in, or excluded from, the logical structure of the DTD based on&#10;the keyword which governs them.</termdef>&#10;<scrap lang="ebnf">&#10;<head>Conditional Section</head>&#10;<prodgroup pcw2="9" pcw4="14.5">&#10;<prod id="NT-conditionalSect"><lhs>conditionalSect</lhs>&#10;<rhs><nt def="NT-includeSect">includeSect</nt>&#10;| <nt def="NT-ignoreSect">ignoreSect</nt>&#10;</rhs>&#10;</prod>&#10;<prod id="NT-includeSect"><lhs>includeSect</lhs>&#10;<rhs>'&lt;![' S? 'INCLUDE' S? '[' &#10;&#10;<nt def="NT-extSubsetDecl">extSubsetDecl</nt>&#10;']]&gt;'&#10;</rhs>&#10;</prod>&#10;<prod id="NT-ignoreSect"><lhs>ignoreSect</lhs>&#10;<rhs>'&lt;![' S? 'IGNORE' S? '[' &#10;<nt def="NT-ignoreSectContents">ignoreSectContents</nt>*&#10;']]&gt;'</rhs>&#10;</prod>&#10;&#10;<prod id="NT-ignoreSectContents"><lhs>ignoreSectContents</lhs>&#10;<rhs><nt def="NT-Ignore">Ignore</nt>&#10;('&lt;![' <nt def="NT-ignoreSectContents">ignoreSectContents</nt> ']]&gt;' &#10;<nt def="NT-Ignore">Ignore</nt>)*</rhs></prod>&#10;<prod id="NT-Ignore"><lhs>Ignore</lhs>&#10;<rhs><nt def="NT-Char">Char</nt>* - &#10;(<nt def="NT-Char">Char</nt>* ('&lt;![' | ']]&gt;') &#10;<nt def="NT-Char">Char</nt>*)&#10;</rhs></prod>&#10;&#10;</prodgroup>&#10;</scrap>&#10;</p>&#10;<p>Like the internal and external DTD subsets, a conditional section&#10;may contain one or more complete declarations,&#10;comments, processing instructions, &#10;or nested conditional sections, intermingled with white space.&#10;</p>&#10;<p>If the keyword of the&#10;conditional section is <kw>INCLUDE</kw>, then the contents of the conditional&#10;section are part of the DTD.&#10;If the keyword of the conditional&#10;section is <kw>IGNORE</kw>, then the contents of the conditional section are&#10;not logically part of the DTD.&#10;Note that for reliable parsing, the contents of even ignored&#10;conditional sections must be read in order to&#10;detect nested conditional sections and ensure that the end of the&#10;outermost (ignored) conditional section is properly detected.&#10;If a conditional section with a&#10;keyword of <kw>INCLUDE</kw> occurs within a larger conditional&#10;section with a keyword of <kw>IGNORE</kw>, both the outer and the&#10;inner conditional sections are ignored.</p>&#10;<p>If the keyword of the conditional section is a &#10;parameter-entity reference, the parameter entity must be replaced by its&#10;content before the processor decides whether to&#10;include or ignore the conditional section.</p>&#10;<p>An example:&#10;<eg>&lt;!ENTITY % draft 'INCLUDE' &gt;&#10;&lt;!ENTITY % final 'IGNORE' &gt;&#10; &#10;&lt;![%draft;[&#10;&lt;!ELEMENT book (comments*, title, body, supplements?)&gt;&#10;]]&gt;&#10;&lt;![%final;[&#10;&lt;!ELEMENT book (title, body, supplements?)&gt;&#10;]]&gt;&#10;</eg>&#10;</p>&#10;</div2>&#10;&#10;&#10; &#10;&#10;</div1>&#10;&#10; &#10;<div1 id="sec-physical-struct">&#10;<head>Physical Structures</head>&#10; &#10;<p><termdef id="dt-entity" term="Entity">An XML document may consist&#10;of one or many storage units.   These are called&#10;<term>entities</term>; they all have <term>content</term> and are all&#10;(except for the document entity, see below, and &#10;the <termref def="dt-doctype">external DTD subset</termref>) &#10;identified by <term>name</term>.&#10;</termdef>&#10;Each XML document has one entity&#10;called the <termref def="dt-docent">document entity</termref>, which serves&#10;as the starting point for the <termref def="dt-xml-proc">XML&#10;processor</termref> and may contain the whole document.</p>&#10;<p>Entities may be either parsed or unparsed.&#10;<termdef id="dt-parsedent" term="Text Entity">A <term>parsed entity's</term>&#10;contents are referred to as its &#10;<termref def="dt-repltext">replacement text</termref>;&#10;this <termref def="dt-text">text</termref> is considered an&#10;integral part of the document.</termdef></p>&#10;&#10;<p><termdef id="dt-unparsed" term="Unparsed Entity">An &#10;<term>unparsed entity</term> &#10;is a resource whose contents may or may not be&#10;<termref def="dt-text">text</termref>, and if text, may not be XML.&#10;Each unparsed entity&#10;has an associated <termref def="dt-notation">notation</termref>, identified by name.&#10;Beyond a requirement&#10;that an XML processor make the identifiers for the entity and &#10;notation available to the application,&#10;XML places no constraints on the contents of unparsed entities.</termdef> &#10;</p>&#10;<p>&#10;Parsed entities are invoked by name using entity references;&#10;unparsed entities by name, given in the value of <kw>ENTITY</kw>&#10;or <kw>ENTITIES</kw>&#10;attributes.</p>&#10;<p><termdef id="gen-entity" term="general entity"><term>General entities</term>&#10;are entities for use within the document content.&#10;In this specification, general entities are sometimes referred &#10;to with the unqualified term <emph>entity</emph> when this leads&#10;to no ambiguity.</termdef> &#10;<termdef id="dt-PE" term="Parameter entity">Parameter entities &#10;are parsed entities for use within the DTD.</termdef>&#10;These two types of entities use different forms of reference and&#10;are recognized in different contexts.&#10;Furthermore, they occupy different namespaces; a parameter entity and&#10;a general entity with the same name are two distinct entities.&#10;</p>&#10;&#10;<div2 id="sec-references">&#10;<head>Character and Entity References</head>&#10;<p><termdef id="dt-charref" term="Character Reference">&#10;A <term>character reference</term> refers to a specific character in the&#10;ISO/IEC 10646 character set, for example one not directly accessible from&#10;available input devices.&#10;<scrap lang="ebnf">&#10;<head>Character Reference</head>&#10;<prod id="NT-CharRef"><lhs>CharRef</lhs>&#10;<rhs>'&amp;#' [0-9]+ ';' </rhs>&#10;<rhs>| '&amp;#x' [0-9a-fA-F]+ ';'</rhs>&#10;<wfc def="wf-Legalchar"></wfc>&#10;</prod>&#10;</scrap>&#10;<wfcnote id="wf-Legalchar">&#10;<head>Legal Character</head>&#10;<p>Characters referred to using character references must&#10;match the production for&#10;<termref def="NT-Char">Char</termref>.</p>&#10;</wfcnote>&#10;If the character reference begins with &quot;<code>&amp;#x</code>&quot;, the digits and&#10;letters up to the terminating <code>;</code> provide a hexadecimal&#10;representation of the character's code point in ISO/IEC 10646.&#10;If it begins just with &quot;<code>&amp;#</code>&quot;, the digits up to the terminating&#10;<code>;</code> provide a decimal representation of the character's &#10;code point.&#10;</termdef>&#10;</p>&#10;<p><termdef id="dt-entref" term="Entity Reference">An <term>entity&#10;reference</term> refers to the content of a named entity.</termdef>&#10;<termdef id="dt-GERef" term="General Entity Reference">References to &#10;parsed general entities&#10;use ampersand (<code>&amp;</code>) and semicolon (<code>;</code>) as&#10;delimiters.</termdef>&#10;<termdef id="dt-PERef" term="Parameter-entity reference">&#10;<term>Parameter-entity references</term> use percent-sign (<code>%</code>) and&#10;semicolon &#10;(<code>;</code>) as delimiters.</termdef>&#10;</p>&#10;<scrap lang="ebnf">&#10;<head>Entity Reference</head>&#10;<prod id="NT-Reference"><lhs>Reference</lhs>&#10;<rhs><nt def="NT-EntityRef">EntityRef</nt> &#10;| <nt def="NT-CharRef">CharRef</nt></rhs></prod>&#10;<prod id="NT-EntityRef"><lhs>EntityRef</lhs>&#10;<rhs>'&amp;' <nt def="NT-Name">Name</nt> ';'</rhs>&#10;<wfc def="wf-entdeclared"></wfc>&#10;<vc def="vc-entdeclared"></vc>&#10;<wfc def="textent"></wfc>&#10;<wfc def="norecursion"></wfc>&#10;</prod>&#10;<prod id="NT-PEReference"><lhs>PEReference</lhs>&#10;<rhs>'%' <nt def="NT-Name">Name</nt> ';'</rhs>&#10;<vc def="vc-entdeclared"></vc>&#10;<wfc def="norecursion"></wfc>&#10;<wfc def="indtd"></wfc>&#10;</prod>&#10;</scrap>&#10;&#10;<wfcnote id="wf-entdeclared">&#10;<head>Entity Declared</head>&#10;<p>In a document without any DTD, a document with only an internal&#10;DTD subset which contains no parameter entity references, or a document with&#10;&quot;<code>standalone='yes'</code>&quot;, &#10;the <nt def="NT-Name">Name</nt> given in the entity reference must &#10;<termref def="dt-match">match</termref> that in an &#10;<titleref href="sec-entity-decl">entity declaration</titleref>, except that&#10;well-formed documents need not declare &#10;any of the following entities: <code>amp</code>,&#10;<code>lt</code>,&#10;<code>gt</code>,&#10;<code>apos</code>,&#10;<code>quot</code>.  &#10;The declaration of a parameter entity must precede any reference to it.&#10;Similarly, the declaration of a general entity must precede any&#10;reference to it which appears in a default value in an attribute-list&#10;declaration.</p>&#10;<p>Note that if entities are declared in the external subset or in &#10;external parameter entities, a non-validating processor is &#10;<titleref href="include-if-valid">not obligated to</titleref> read&#10;and process their declarations; for such documents, the rule that&#10;an entity must be declared is a well-formedness constraint only&#10;if <titleref href="sec-rmd">standalone='yes'</titleref>.</p>&#10;</wfcnote>&#10;<vcnote id="vc-entdeclared">&#10;<head>Entity Declared</head>&#10;<p>In a document with an external subset or external parameter&#10;entities with &quot;<code>standalone='no'</code>&quot;,&#10;the <nt def="NT-Name">Name</nt> given in the entity reference must <termref def="dt-match">match</termref> that in an &#10;<titleref href="sec-entity-decl">entity declaration</titleref>.&#10;For interoperability, valid documents should declare the entities &#10;<code>amp</code>,&#10;<code>lt</code>,&#10;<code>gt</code>,&#10;<code>apos</code>,&#10;<code>quot</code>, in the form&#10;specified in <specref ref="sec-predefined-ent"></specref>.&#10;The declaration of a parameter entity must precede any reference to it.&#10;Similarly, the declaration of a general entity must precede any&#10;reference to it which appears in a default value in an attribute-list&#10;declaration.</p>&#10;</vcnote>&#10;&#10;<wfcnote id="textent">&#10;<head>Parsed Entity</head>&#10;<p>&#10;An entity reference must not contain the name of an <termref def="dt-unparsed">unparsed entity</termref>. Unparsed entities may be referred&#10;to only in <termref def="dt-attrval">attribute values</termref> declared to&#10;be of type <kw>ENTITY</kw> or <kw>ENTITIES</kw>.&#10;</p>&#10;</wfcnote>&#10;<wfcnote id="norecursion">&#10;<head>No Recursion</head>&#10;<p>&#10;A parsed entity must not contain a recursive reference to itself,&#10;either directly or indirectly.&#10;</p>&#10;</wfcnote>&#10;<wfcnote id="indtd">&#10;<head>In DTD</head>&#10;<p>&#10;Parameter-entity references may only appear in the &#10;<termref def="dt-doctype">DTD</termref>.&#10;</p>&#10;</wfcnote>&#10;<p>Examples of character and entity references:&#10;<eg>Type &lt;key&gt;less-than&lt;/key&gt; (&amp;#x3C;) to save options.&#10;This document was prepared on &amp;docdate; and&#10;is classified &amp;security-level;.</eg></p>&#10;<p>Example of a parameter-entity reference:&#10;<eg>&lt;!-- declare the parameter entity &quot;ISOLat2&quot;... --&gt;&#10;&lt;!ENTITY % ISOLat2&#10;         SYSTEM &quot;http://www.xml.com/iso/isolat2-xml.entities&quot; &gt;&#10;&lt;!-- ... now reference it. --&gt;&#10;%ISOLat2;</eg></p>&#10;</div2>&#10; &#10;<div2 id="sec-entity-decl">&#10;<head>Entity Declarations</head>&#10; &#10;<p><termdef id="dt-entdecl" term="entity declaration">&#10;Entities are declared thus:&#10;<scrap lang="ebnf">&#10;<head>Entity Declaration</head>&#10;<prodgroup pcw2="5" pcw4="18.5">&#10;<prod id="NT-EntityDecl"><lhs>EntityDecl</lhs>&#10;<rhs><nt def="NT-GEDecl">GEDecl</nt> | <nt def="NT-PEDecl">PEDecl</nt></rhs>&#10;&#10;</prod>&#10;<prod id="NT-GEDecl"><lhs>GEDecl</lhs>&#10;<rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> &#10;<nt def="NT-S">S</nt> <nt def="NT-EntityDef">EntityDef</nt> &#10;<nt def="NT-S">S</nt>? '&gt;'</rhs>&#10;</prod>&#10;<prod id="NT-PEDecl"><lhs>PEDecl</lhs>&#10;<rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> '%' <nt def="NT-S">S</nt> &#10;<nt def="NT-Name">Name</nt> <nt def="NT-S">S</nt> &#10;<nt def="NT-PEDef">PEDef</nt> <nt def="NT-S">S</nt>? '&gt;'</rhs>&#10;&#10;</prod>&#10;<prod id="NT-EntityDef"><lhs>EntityDef</lhs>&#10;<rhs><nt def="NT-EntityValue">EntityValue</nt>&#10;| (<nt def="NT-ExternalID">ExternalID</nt> &#10;<nt def="NT-NDataDecl">NDataDecl</nt>?)</rhs>&#10;&#10;</prod>&#10;&#10;<prod id="NT-PEDef"><lhs>PEDef</lhs>&#10;<rhs><nt def="NT-EntityValue">EntityValue</nt> &#10;| <nt def="NT-ExternalID">ExternalID</nt></rhs></prod>&#10;</prodgroup>&#10;</scrap>&#10;The <nt def="NT-Name">Name</nt> identifies the entity in an&#10;<termref def="dt-entref">entity reference</termref> or, in the case of an&#10;unparsed entity, in the value of an <kw>ENTITY</kw> or <kw>ENTITIES</kw>&#10;attribute.&#10;If the same entity is declared more than once, the first declaration&#10;encountered is binding; at user option, an XML processor may issue a&#10;warning if entities are declared multiple times.</termdef>&#10;</p>&#10;&#10;<div3 id="sec-internal-ent">&#10;<head>Internal Entities</head>&#10; &#10;<p><termdef id="dt-internent" term="Internal Entity Replacement Text">If &#10;the entity definition is an &#10;<nt def="NT-EntityValue">EntityValue</nt>,  &#10;the defined entity is called an <term>internal entity</term>.  &#10;There is no separate physical&#10;storage object, and the content of the entity is given in the&#10;declaration. </termdef>&#10;Note that some processing of entity and character references in the&#10;<termref def="dt-litentval">literal entity value</termref> may be required to&#10;produce the correct <termref def="dt-repltext">replacement &#10;text</termref>: see <specref ref="intern-replacement"></specref>.&#10;</p>&#10;<p>An internal entity is a <termref def="dt-parsedent">parsed&#10;entity</termref>.</p>&#10;<p>Example of an internal entity declaration:&#10;<eg>&lt;!ENTITY Pub-Status &quot;This is a pre-release of the&#10; specification.&quot;&gt;</eg></p>&#10;</div3>&#10; &#10;<div3 id="sec-external-ent">&#10;<head>External Entities</head>&#10; &#10;<p><termdef id="dt-extent" term="External Entity">If the entity is not&#10;internal, it is an <term>external&#10;entity</term>, declared as follows:&#10;<scrap lang="ebnf">&#10;<head>External Entity Declaration</head>&#10;&#10;<prod id="NT-ExternalID"><lhs>ExternalID</lhs>&#10;<rhs>'SYSTEM' <nt def="NT-S">S</nt> &#10;<nt def="NT-SystemLiteral">SystemLiteral</nt></rhs>&#10;<rhs>| 'PUBLIC' <nt def="NT-S">S</nt> &#10;<nt def="NT-PubidLiteral">PubidLiteral</nt> &#10;<nt def="NT-S">S</nt> &#10;<nt def="NT-SystemLiteral">SystemLiteral</nt>&#10;</rhs>&#10;</prod>&#10;<prod id="NT-NDataDecl"><lhs>NDataDecl</lhs>&#10;<rhs><nt def="NT-S">S</nt> 'NDATA' <nt def="NT-S">S</nt> &#10;<nt def="NT-Name">Name</nt></rhs>&#10;<vc def="not-declared"></vc></prod>&#10;</scrap>&#10;If the <nt def="NT-NDataDecl">NDataDecl</nt> is present, this is a&#10;general <termref def="dt-unparsed">unparsed&#10;entity</termref>; otherwise it is a parsed entity.</termdef></p>&#10;<vcnote id="not-declared">&#10;<head>Notation Declared</head>&#10;<p>&#10;The <nt def="NT-Name">Name</nt> must match the declared name of a&#10;<termref def="dt-notation">notation</termref>.&#10;</p>&#10;</vcnote>&#10;<p><termdef id="dt-sysid" term="System Identifier">The&#10;<nt def="NT-SystemLiteral">SystemLiteral</nt> &#10;is called the entity's <term>system identifier</term>. It is a URI,&#10;which may be used to retrieve the entity.</termdef>&#10;Note that the hash mark (<code>#</code>) and fragment identifier &#10;frequently used with URIs are not, formally, part of the URI itself; &#10;an XML processor may signal an error if a fragment identifier is &#10;given as part of a system identifier.&#10;Unless otherwise provided by information outside the scope of this&#10;specification (e.g. a special XML element type defined by a particular&#10;DTD, or a processing instruction defined by a particular application&#10;specification), relative URIs are relative to the location of the&#10;resource within which the entity declaration occurs.&#10;A URI might thus be relative to the &#10;<termref def="dt-docent">document entity</termref>, to the entity&#10;containing the <termref def="dt-doctype">external DTD subset</termref>, &#10;or to some other <termref def="dt-extent">external parameter entity</termref>.&#10;</p>&#10;<p>An XML processor should handle a non-ASCII character in a URI by&#10;representing the character in UTF-8 as one or more bytes, and then &#10;escaping these bytes with the URI escaping mechanism (i.e., by&#10;converting each byte to %HH, where HH is the hexadecimal notation of the&#10;byte value).</p>&#10;<p><termdef id="dt-pubid" term="Public identifier">&#10;In addition to a system identifier, an external identifier may&#10;include a <term>public identifier</term>.</termdef>  &#10;An XML processor attempting to retrieve the entity's content may use the public&#10;identifier to try to generate an alternative URI.  If the processor&#10;is unable to do so, it must use the URI specified in the system&#10;literal.  Before a match is attempted, all strings&#10;of white space in the public identifier must be normalized to single space characters (#x20),&#10;and leading and trailing white space must be removed.</p>&#10;<p>Examples of external entity declarations:&#10;<eg>&lt;!ENTITY open-hatch&#10;         SYSTEM &quot;http://www.textuality.com/boilerplate/OpenHatch.xml&quot;&gt;&#10;&lt;!ENTITY open-hatch&#10;         PUBLIC &quot;-//Textuality//TEXT Standard open-hatch boilerplate//EN&quot;&#10;         &quot;http://www.textuality.com/boilerplate/OpenHatch.xml&quot;&gt;&#10;&lt;!ENTITY hatch-pic&#10;         SYSTEM &quot;../grafix/OpenHatch.gif&quot;&#10;         NDATA gif &gt;</eg></p>&#10;</div3>&#10; &#10;</div2>&#10;&#10;<div2 id="TextEntities">&#10;<head>Parsed Entities</head>&#10;<div3 id="sec-TextDecl">&#10;<head>The Text Declaration</head>&#10;<p>External parsed entities may each begin with a <term>text&#10;declaration</term>. &#10;<scrap lang="ebnf">&#10;<head>Text Declaration</head>&#10;<prodgroup pcw4="12.5" pcw5="13">&#10;<prod id="NT-TextDecl"><lhs>TextDecl</lhs>&#10;<rhs>'&lt;?xml' &#10;<nt def="NT-VersionInfo">VersionInfo</nt>?&#10;<nt def="NT-EncodingDecl">EncodingDecl</nt>&#10;<nt def="NT-S">S</nt>? '?&gt;'</rhs>&#10;</prod>&#10;</prodgroup>&#10;</scrap>&#10;</p>&#10;<p>The text declaration must be provided literally, not&#10;by reference to a parsed entity.&#10;No text declaration may appear at any position other than the beginning of&#10;an external parsed entity.</p>&#10;</div3>&#10;<div3 id="wf-entities">&#10;<head>Well-Formed Parsed Entities</head>&#10;<p>The document entity is well-formed if it matches the production labeled&#10;<nt def="NT-document">document</nt>.&#10;An external general &#10;parsed entity is well-formed if it matches the production labeled&#10;<nt def="NT-extParsedEnt">extParsedEnt</nt>.&#10;An external parameter&#10;entity is well-formed if it matches the production labeled&#10;<nt def="NT-extPE">extPE</nt>.&#10;<scrap lang="ebnf">&#10;<head>Well-Formed External Parsed Entity</head>&#10;<prod id="NT-extParsedEnt"><lhs>extParsedEnt</lhs>&#10;<rhs><nt def="NT-TextDecl">TextDecl</nt>? &#10;<nt def="NT-content">content</nt></rhs>&#10;</prod>&#10;<prod id="NT-extPE"><lhs>extPE</lhs>&#10;<rhs><nt def="NT-TextDecl">TextDecl</nt>? &#10;<nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs>&#10;</prod>&#10;</scrap>&#10;An internal general parsed entity is well-formed if its replacement text &#10;matches the production labeled&#10;<nt def="NT-content">content</nt>.&#10;All internal parameter entities are well-formed by definition.&#10;</p>&#10;<p>A consequence of well-formedness in entities is that the logical &#10;and physical structures in an XML document are properly nested; no &#10;<termref def="dt-stag">start-tag</termref>,&#10;<termref def="dt-etag">end-tag</termref>,&#10;<termref def="dt-empty">empty-element tag</termref>,&#10;<termref def="dt-element">element</termref>, &#10;<termref def="dt-comment">comment</termref>, &#10;<termref def="dt-pi">processing instruction</termref>, &#10;<termref def="dt-charref">character&#10;reference</termref>, or&#10;<termref def="dt-entref">entity reference</termref> &#10;can begin in one entity and end in another.</p>&#10;</div3>&#10;<div3 id="charencoding">&#10;<head>Character Encoding in Entities</head>&#10; &#10;<p>Each external parsed entity in an XML document may use a different&#10;encoding for its characters. All XML processors must be able to read&#10;entities in either UTF-8 or UTF-16. &#10;&#10;</p>&#10;<p>Entities encoded in UTF-16 must&#10;begin with the Byte Order Mark described by ISO/IEC 10646 Annex E and&#10;Unicode Appendix B (the ZERO WIDTH NO-BREAK SPACE character, #xFEFF).&#10;This is an encoding signature, not part of either the markup or the&#10;character data of the XML document.&#10;XML processors must be able to use this character to&#10;differentiate between UTF-8 and UTF-16 encoded documents.</p>&#10;<p>Although an XML processor is required to read only entities in&#10;the UTF-8 and UTF-16 encodings, it is recognized that other encodings are&#10;used around the world, and it may be desired for XML processors&#10;to read entities that use them.&#10;Parsed entities which are stored in an encoding other than&#10;UTF-8 or UTF-16 must begin with a <titleref href="TextDecl">text&#10;declaration</titleref> containing an encoding declaration:&#10;<scrap lang="ebnf">&#10;<head>Encoding Declaration</head>&#10;<prod id="NT-EncodingDecl"><lhs>EncodingDecl</lhs>&#10;<rhs><nt def="NT-S">S</nt>&#10;'encoding' <nt def="NT-Eq">Eq</nt> &#10;('&quot;' <nt def="NT-EncName">EncName</nt> '&quot;' | &#10;&quot;'&quot; <nt def="NT-EncName">EncName</nt> &quot;'&quot; )&#10;</rhs>&#10;</prod>&#10;<prod id="NT-EncName"><lhs>EncName</lhs>&#10;<rhs>[A-Za-z] ([A-Za-z0-9._] | '-')*</rhs>&#10;<com>Encoding name contains only Latin characters</com>&#10;</prod>&#10;</scrap>&#10;In the <termref def="dt-docent">document entity</termref>, the encoding&#10;declaration is part of the <termref def="dt-xmldecl">XML declaration</termref>.&#10;The <nt def="NT-EncName">EncName</nt> is the name of the encoding used.&#10;</p>&#10;&#10;<p>In an encoding declaration, the values&#10;&quot;<code>UTF-8</code>&quot;,&#10;&quot;<code>UTF-16</code>&quot;,&#10;&quot;<code>ISO-10646-UCS-2</code>&quot;, and&#10;&quot;<code>ISO-10646-UCS-4</code>&quot; should be &#10;used for the various encodings and transformations of Unicode /&#10;ISO/IEC 10646, the values&#10;&quot;<code>ISO-8859-1</code>&quot;,&#10;&quot;<code>ISO-8859-2</code>&quot;, ...&#10;&quot;<code>ISO-8859-9</code>&quot; should be used for the parts of ISO 8859, and&#10;the values&#10;&quot;<code>ISO-2022-JP</code>&quot;,&#10;&quot;<code>Shift_JIS</code>&quot;, and&#10;&quot;<code>EUC-JP</code>&quot;&#10;should be used for the various encoded forms of JIS X-0208-1997.  XML&#10;processors may recognize other encodings; it is recommended that&#10;character encodings registered (as <emph>charset</emph>s) &#10;with the Internet Assigned Numbers&#10;Authority <bibref ref="IANA"></bibref>, other than those just listed, should be&#10;referred to&#10;using their registered names.&#10;Note that these registered names are defined to be &#10;case-insensitive, so processors wishing to match against them &#10;should do so in a case-insensitive&#10;way.</p>&#10;<p>In the absence of information provided by an external&#10;transport protocol (e.g. HTTP or MIME), &#10;it is an <termref def="dt-error">error</termref> for an entity including&#10;an encoding declaration to be presented to the XML processor &#10;in an encoding other than that named in the declaration, &#10;for an encoding declaration to occur other than at the beginning &#10;of an external entity, or for&#10;an entity which begins with neither a Byte Order Mark nor an encoding&#10;declaration to use an encoding other than UTF-8.&#10;Note that since ASCII&#10;is a subset of UTF-8, ordinary ASCII entities do not strictly need&#10;an encoding declaration.</p>&#10;&#10;<p>It is a <termref def="dt-fatal">fatal error</termref> when an XML processor&#10;encounters an entity with an encoding that it is unable to process.</p>&#10;<p>Examples of encoding declarations:&#10;<eg>&lt;?xml encoding='UTF-8'?&gt;&#10;&lt;?xml encoding='EUC-JP'?&gt;</eg></p>&#10;</div3>&#10;</div2>&#10;<div2 id="entproc">&#10;<head>XML Processor Treatment of Entities and References</head>&#10;<p>The table below summarizes the contexts in which character references,&#10;entity references, and invocations of unparsed entities might appear and the&#10;required behavior of an <termref def="dt-xml-proc">XML processor</termref> in&#10;each case.  &#10;The labels in the leftmost column describe the recognition context:&#10;<glist>&#10;<gitem><label>Reference in Content</label>&#10;<def><p>as a reference&#10;anywhere after the <termref def="dt-stag">start-tag</termref> and&#10;before the <termref def="dt-etag">end-tag</termref> of an element; corresponds&#10;to the nonterminal <nt def="NT-content">content</nt>.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label>Reference in Attribute Value</label>&#10;<def><p>as a reference within either the value of an attribute in a &#10;<termref def="dt-stag">start-tag</termref>, or a default&#10;value in an <termref def="dt-attdecl">attribute declaration</termref>;&#10;corresponds to the nonterminal&#10;<nt def="NT-AttValue">AttValue</nt>.</p></def></gitem>&#10;<gitem>&#10;<label>Occurs as Attribute Value</label>&#10;<def><p>as a <nt def="NT-Name">Name</nt>, not a reference, appearing either as&#10;the value of an &#10;attribute which has been declared as type <kw>ENTITY</kw>, or as one of&#10;the space-separated tokens in the value of an attribute which has been&#10;declared as type <kw>ENTITIES</kw>.</p>&#10;</def></gitem>&#10;<gitem><label>Reference in Entity Value</label>&#10;<def><p>as a reference&#10;within a parameter or internal entity's &#10;<termref def="dt-litentval">literal entity value</termref> in&#10;the entity's declaration; corresponds to the nonterminal &#10;<nt def="NT-EntityValue">EntityValue</nt>.</p></def></gitem>&#10;<gitem><label>Reference in DTD</label>&#10;<def><p>as a reference within either the internal or external subsets of the &#10;<termref def="dt-doctype">DTD</termref>, but outside&#10;of an <nt def="NT-EntityValue">EntityValue</nt> or&#10;<nt def="NT-AttValue">AttValue</nt>.</p></def>&#10;</gitem>&#10;</glist></p>&#10;<htable align="center" border="1" cellpadding="7">&#10;<htbody>&#10;<tr><td bgcolor="#c0d9c0" colspan="1" rowspan="2"></td>&#10;<td align="center" bgcolor="#c0d9c0" colspan="4" valign="bottom">Entity Type</td>&#10;<td align="center" bgcolor="#c0d9c0" rowspan="2">Character</td>&#10;</tr>&#10;<tr align="center" valign="bottom">&#10;<td bgcolor="#c0d9c0">Parameter</td>&#10;<td bgcolor="#c0d9c0">Internal&#10;General</td>&#10;<td bgcolor="#c0d9c0">External Parsed&#10;General</td>&#10;<td bgcolor="#c0d9c0">Unparsed</td>&#10;</tr>&#10;<tr align="center" valign="middle">&#10;&#10;<td align="right" bgcolor="#c0d9c0">Reference&#10;in Content</td>&#10;<td bgcolor="#c0d9c0"><titleref href="not-recognized">Not recognized</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="included">Included</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="include-if-valid">Included if validating</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="included">Included</titleref></td>&#10;</tr>&#10;<tr align="center" valign="middle">&#10;<td align="right" bgcolor="#c0d9c0">Reference&#10;in Attribute Value</td>&#10;<td bgcolor="#c0d9c0"><titleref href="not-recognized">Not recognized</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="inliteral">Included in literal</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="included">Included</titleref></td>&#10;</tr>&#10;<tr align="center" valign="middle">&#10;<td align="right" bgcolor="#c0d9c0">Occurs as&#10;Attribute Value</td>&#10;<td bgcolor="#c0d9c0"><titleref href="not-recognized">Not recognized</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="not-recognized">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="not-recognized">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="notify">Notify</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="not recognized">Not recognized</titleref></td>&#10;</tr>&#10;<tr align="center" valign="middle">&#10;<td align="right" bgcolor="#c0d9c0">Reference&#10;in EntityValue</td>&#10;<td bgcolor="#c0d9c0"><titleref href="inliteral">Included in literal</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="bypass">Bypassed</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="bypass">Bypassed</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="included">Included</titleref></td>&#10;</tr>&#10;<tr align="center" valign="middle">&#10;<td align="right" bgcolor="#c0d9c0">Reference&#10;in DTD</td>&#10;<td bgcolor="#c0d9c0"><titleref href="as-PE">Included as PE</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;<td bgcolor="#c0d9c0"><titleref href="forbidden">Forbidden</titleref></td>&#10;</tr>&#10;</htbody>&#10;</htable>&#10;<div3 id="not-recognized">&#10;<head>Not Recognized</head>&#10;<p>Outside the DTD, the <code>%</code> character has no&#10;special significance; thus, what would be parameter entity references in the&#10;DTD are not recognized as markup in <nt def="NT-content">content</nt>.&#10;Similarly, the names of unparsed entities are not recognized except&#10;when they appear in the value of an appropriately declared attribute.&#10;</p>&#10;</div3>&#10;<div3 id="included">&#10;<head>Included</head>&#10;<p><termdef id="dt-include" term="Include">An entity is &#10;<term>included</term> when its &#10;<termref def="dt-repltext">replacement text</termref> is retrieved &#10;and processed, in place of the reference itself,&#10;as though it were part of the document at the location the&#10;reference was recognized.&#10;The replacement text may contain both &#10;<termref def="dt-chardata">character data</termref>&#10;and (except for parameter entities) <termref def="dt-markup">markup</termref>,&#10;which must be recognized in&#10;the usual way, except that the replacement text of entities used to escape&#10;markup delimiters (the entities <code>amp</code>,&#10;<code>lt</code>,&#10;<code>gt</code>,&#10;<code>apos</code>,&#10;<code>quot</code>) is always treated as&#10;data.  (The string &quot;<code>AT&amp;amp;T;</code>&quot; expands to&#10;&quot;<code>AT&amp;T;</code>&quot; and the remaining ampersand is not recognized&#10;as an entity-reference delimiter.) &#10;A character reference is <term>included</term> when the indicated&#10;character is processed in place of the reference itself.&#10;</termdef></p>&#10;</div3>&#10;<div3 id="include-if-valid">&#10;<head>Included If Validating</head>&#10;<p>When an XML processor recognizes a reference to a parsed entity, in order&#10;to <termref def="dt-valid">validate</termref>&#10;the document, the processor must &#10;<termref def="dt-include">include</termref> its&#10;replacement text.&#10;If the entity is external, and the processor is not&#10;attempting to validate the XML document, the&#10;processor <termref def="dt-may">may</termref>, but need not, &#10;include the entity's replacement text.&#10;If a non-validating parser does not include the replacement text,&#10;it must inform the application that it recognized, but did not&#10;read, the entity.</p>&#10;<p>This rule is based on the recognition that the automatic inclusion&#10;provided by the SGML and XML entity mechanism, primarily designed&#10;to support modularity in authoring, is not necessarily &#10;appropriate for other applications, in particular document browsing.&#10;Browsers, for example, when encountering an external parsed entity reference,&#10;might choose to provide a visual indication of the entity's&#10;presence and retrieve it for display only on demand.&#10;</p>&#10;</div3>&#10;<div3 id="forbidden">&#10;<head>Forbidden</head>&#10;<p>The following are forbidden, and constitute&#10;<termref def="dt-fatal">fatal</termref> errors:&#10;<ulist>&#10;<item><p>the appearance of a reference to an&#10;<termref def="dt-unparsed">unparsed entity</termref>.&#10;</p></item>&#10;<item><p>the appearance of any character or general-entity reference in the&#10;DTD except within an <nt def="NT-EntityValue">EntityValue</nt> or &#10;<nt def="NT-AttValue">AttValue</nt>.</p></item>&#10;<item><p>a reference to an external entity in an attribute value.</p>&#10;</item>&#10;</ulist>&#10;</p>&#10;</div3>&#10;<div3 id="inliteral">&#10;<head>Included in Literal</head>&#10;<p>When an <termref def="dt-entref">entity reference</termref> appears in an&#10;attribute value, or a parameter entity reference appears in a literal entity&#10;value, its <termref def="dt-repltext">replacement text</termref> is&#10;processed in place of the reference itself as though it&#10;were part of the document at the location the reference was recognized,&#10;except that a single or double quote character in the replacement text&#10;is always treated as a normal data character and will not terminate the&#10;literal. &#10;For example, this is well-formed:&#10;<eg>&lt;!ENTITY % YN '&quot;Yes&quot;' &gt;&#10;&lt;!ENTITY WhatHeSaid &quot;He said &amp;YN;&quot; &gt;</eg>&#10;while this is not:&#10;<eg>&lt;!ENTITY EndAttr &quot;27'&quot; &gt;&#10;&lt;element attribute='a-&amp;EndAttr;&gt;</eg>&#10;</p></div3>&#10;<div3 id="notify">&#10;<head>Notify</head>&#10;<p>When the name of an <termref def="dt-unparsed">unparsed&#10;entity</termref> appears as a token in the&#10;value of an attribute of declared type <kw>ENTITY</kw> or <kw>ENTITIES</kw>,&#10;a validating processor must inform the&#10;application of the <termref def="dt-sysid">system</termref> &#10;and <termref def="dt-pubid">public</termref> (if any)&#10;identifiers for both the entity and its associated&#10;<termref def="dt-notation">notation</termref>.</p>&#10;</div3>&#10;<div3 id="bypass">&#10;<head>Bypassed</head>&#10;<p>When a general entity reference appears in the&#10;<nt def="NT-EntityValue">EntityValue</nt> in an entity declaration,&#10;it is bypassed and left as is.</p>&#10;</div3>&#10;<div3 id="as-PE">&#10;<head>Included as PE</head>&#10;<p>Just as with external parsed entities, parameter entities&#10;need only be <titleref href="include-if-valid">included if&#10;validating</titleref>. &#10;When a parameter-entity reference is recognized in the DTD&#10;and included, its &#10;<termref def="dt-repltext">replacement&#10;text</termref> is enlarged by the attachment of one leading and one following&#10;space (#x20) character; the intent is to constrain the replacement&#10;text of parameter &#10;entities to contain an integral number of grammatical tokens in the DTD.&#10;</p>&#10;</div3>&#10;&#10;</div2>&#10;<div2 id="intern-replacement">&#10;<head>Construction of Internal Entity Replacement Text</head>&#10;<p>In discussing the treatment&#10;of internal entities, it is  &#10;useful to distinguish two forms of the entity's value.&#10;<termdef id="dt-litentval" term="Literal Entity Value">The <term>literal&#10;entity value</term> is the quoted string actually&#10;present in the entity declaration, corresponding to the&#10;non-terminal <nt def="NT-EntityValue">EntityValue</nt>.</termdef>&#10;<termdef id="dt-repltext" term="Replacement Text">The <term>replacement&#10;text</term> is the content of the entity, after&#10;replacement of character references and parameter-entity&#10;references.&#10;</termdef></p>&#10;&#10;<p>The literal entity value &#10;as given in an internal entity declaration&#10;(<nt def="NT-EntityValue">EntityValue</nt>) may contain character,&#10;parameter-entity, and general-entity references.&#10;Such references must be contained entirely within the&#10;literal entity value.&#10;The actual replacement text that is &#10;<termref def="dt-include">included</termref> as described above&#10;must contain the <emph>replacement text</emph> of any &#10;parameter entities referred to, and must contain the character&#10;referred to, in place of any character references in the&#10;literal entity value; however,&#10;general-entity references must be left as-is, unexpanded.&#10;For example, given the following declarations:&#10;&#10;<eg>&lt;!ENTITY % pub    &quot;&amp;#xc9;ditions Gallimard&quot; &gt;&#10;&lt;!ENTITY   rights &quot;All rights reserved&quot; &gt;&#10;&lt;!ENTITY   book   &quot;La Peste: Albert Camus, &#10;&amp;#xA9; 1947 %pub;. &amp;rights;&quot; &gt;</eg>&#10;then the replacement text for the entity &quot;<code>book</code>&quot; is:&#10;<eg>La Peste: Albert Camus, &#10;© 1947 Éditions Gallimard. &amp;rights;</eg>&#10;The general-entity reference &quot;<code>&amp;rights;</code>&quot; would be expanded&#10;should the reference &quot;<code>&amp;book;</code>&quot; appear in the document's&#10;content or an attribute value.</p>&#10;<p>These simple rules may have complex interactions; for a detailed&#10;discussion of a difficult example, see&#10;<specref ref="sec-entexpand"></specref>.&#10;</p>&#10;&#10;</div2>&#10;<div2 id="sec-predefined-ent">&#10;<head>Predefined Entities</head>&#10;<p><termdef id="dt-escape" term="escape">Entity and character&#10;references can both be used to <term>escape</term> the left angle bracket,&#10;ampersand, and other delimiters.   A set of general entities&#10;(<code>amp</code>,&#10;<code>lt</code>,&#10;<code>gt</code>,&#10;<code>apos</code>,&#10;<code>quot</code>) is specified for this purpose.&#10;Numeric character references may also be used; they are&#10;expanded immediately when recognized and must be treated as&#10;character data, so the numeric character references&#10;&quot;<code>&amp;#60;</code>&quot; and &quot;<code>&amp;#38;</code>&quot; may be used to &#10;escape <code>&lt;</code> and <code>&amp;</code> when they occur&#10;in character data.</termdef></p>&#10;<p>All XML processors must recognize these entities whether they&#10;are declared or not.  &#10;<termref def="dt-interop">For interoperability</termref>,&#10;valid XML documents should declare these&#10;entities, like any others, before using them.&#10;If the entities in question are declared, they must be declared&#10;as internal entities whose replacement text is the single&#10;character being escaped or a character reference to&#10;that character, as shown below.&#10;<eg>&lt;!ENTITY lt     &quot;&amp;#38;#60;&quot;&gt; &#10;&lt;!ENTITY gt     &quot;&amp;#62;&quot;&gt; &#10;&lt;!ENTITY amp    &quot;&amp;#38;#38;&quot;&gt; &#10;&lt;!ENTITY apos   &quot;&amp;#39;&quot;&gt; &#10;&lt;!ENTITY quot   &quot;&amp;#34;&quot;&gt; &#10;</eg>&#10;Note that the <code>&lt;</code> and <code>&amp;</code> characters&#10;in the declarations of &quot;<code>lt</code>&quot; and &quot;<code>amp</code>&quot;&#10;are doubly escaped to meet the requirement that entity replacement&#10;be well-formed.&#10;</p>&#10;</div2>&#10;&#10;<div2 id="Notations">&#10;<head>Notation Declarations</head>&#10; &#10;<p><termdef id="dt-notation" term="Notation"><term>Notations</term> identify by&#10;name the format of <termref def="dt-extent">unparsed&#10;entities</termref>, the&#10;format of elements which bear a notation attribute, &#10;or the application to which  &#10;a <termref def="dt-pi">processing instruction</termref> is&#10;addressed.</termdef></p>&#10;<p><termdef id="dt-notdecl" term="Notation Declaration">&#10;<term>Notation declarations</term>&#10;provide a name for the notation, for use in&#10;entity and attribute-list declarations and in attribute specifications,&#10;and an external identifier for the notation which may allow an XML&#10;processor or its client application to locate a helper application&#10;capable of processing data in the given notation.&#10;<scrap lang="ebnf">&#10;<head>Notation Declarations</head>&#10;<prod id="NT-NotationDecl"><lhs>NotationDecl</lhs>&#10;<rhs>'&lt;!NOTATION' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt> &#10;<nt def="NT-S">S</nt> &#10;(<nt def="NT-ExternalID">ExternalID</nt> | &#10;<nt def="NT-PublicID">PublicID</nt>)&#10;<nt def="NT-S">S</nt>? '&gt;'</rhs></prod>&#10;<prod id="NT-PublicID"><lhs>PublicID</lhs>&#10;<rhs>'PUBLIC' <nt def="NT-S">S</nt> &#10;<nt def="NT-PubidLiteral">PubidLiteral</nt> &#10;</rhs></prod>&#10;</scrap>&#10;</termdef></p>&#10;<p>XML processors must provide applications with the name and external&#10;identifier(s) of any notation declared and referred to in an attribute&#10;value, attribute definition, or entity declaration.  They may&#10;additionally resolve the external identifier into the&#10;<termref def="dt-sysid">system identifier</termref>,&#10;file name, or other information needed to allow the&#10;application to call a processor for data in the notation described.  (It&#10;is not an error, however, for XML documents to declare and refer to&#10;notations for which notation-specific applications are not available on&#10;the system where the XML processor or application is running.)</p>&#10;</div2>&#10;&#10; &#10;<div2 id="sec-doc-entity">&#10;<head>Document Entity</head>&#10; &#10;<p><termdef id="dt-docent" term="Document Entity">The <term>document&#10;entity</term> serves as the root of the entity&#10;tree and a starting-point for an <termref def="dt-xml-proc">XML&#10;processor</termref>.</termdef>&#10;This specification does&#10;not specify how the document entity is to be located by an XML&#10;processor; unlike other entities, the document entity has no name and might&#10;well appear on a processor input stream &#10;without any identification at all.</p>&#10;</div2>&#10;&#10;&#10;</div1>&#10;&#10; &#10;<div1 id="sec-conformance">&#10;<head>Conformance</head>&#10; &#10;<div2 id="proc-types">&#10;<head>Validating and Non-Validating Processors</head>&#10;<p>Conforming <termref def="dt-xml-proc">XML processors</termref> fall into two&#10;classes: validating and non-validating.</p>&#10;<p>Validating and non-validating processors alike must report&#10;violations of this specification's well-formedness constraints&#10;in the content of the&#10;<termref def="dt-docent">document entity</termref> and any &#10;other <termref def="dt-parsedent">parsed entities</termref> that &#10;they read.</p>&#10;<p><termdef id="dt-validating" term="Validating Processor">&#10;<term>Validating processors</term> must report&#10;violations of the constraints expressed by the declarations in the&#10;<termref def="dt-doctype">DTD</termref>, and&#10;failures to fulfill the validity constraints given&#10;in this specification.&#10;</termdef>&#10;To accomplish this, validating XML processors must read and process the entire&#10;DTD and all external parsed entities referenced in the document.&#10;</p>&#10;<p>Non-validating processors are required to check only the &#10;<termref def="dt-docent">document entity</termref>, including&#10;the entire internal DTD subset, for well-formedness.&#10;<termdef id="dt-use-mdecl" term="Process Declarations">&#10;While they are not required to check the document for validity,&#10;they are required to &#10;<term>process</term> all the declarations they read in the&#10;internal DTD subset and in any parameter entity that they&#10;read, up to the first reference&#10;to a parameter entity that they do <emph>not</emph> read; that is to &#10;say, they must&#10;use the information in those declarations to&#10;<titleref href="AVNormalize">normalize</titleref> attribute values,&#10;<titleref href="included">include</titleref> the replacement text of &#10;internal entities, and supply &#10;<titleref href="sec-attr-defaults">default attribute values</titleref>.&#10;</termdef>&#10;They must not <termref def="dt-use-mdecl">process</termref>&#10;<termref def="dt-entdecl">entity declarations</termref> or &#10;<termref def="dt-attdecl">attribute-list declarations</termref> &#10;encountered after a reference to a parameter entity that is not&#10;read, since the entity may have contained overriding declarations.&#10;</p>&#10;</div2>&#10;<div2 id="safe-behavior">&#10;<head>Using XML Processors</head>&#10;<p>The behavior of a validating XML processor is highly predictable; it&#10;must read every piece of a document and report all well-formedness and&#10;validity violations.&#10;Less is required of a non-validating processor; it need not read any&#10;part of the document other than the document entity.&#10;This has two effects that may be important to users of XML processors:&#10;<ulist>&#10;<item><p>Certain well-formedness errors, specifically those that require&#10;reading external entities, may not be detected by a non-validating processor.&#10;Examples include the constraints entitled &#10;<titleref href="wf-entdeclared">Entity Declared</titleref>, &#10;<titleref href="wf-textent">Parsed Entity</titleref>, and&#10;<titleref href="wf-norecursion">No Recursion</titleref>, as well&#10;as some of the cases described as&#10;<titleref href="forbidden">forbidden</titleref> in &#10;<specref ref="entproc"></specref>.</p></item>&#10;<item><p>The information passed from the processor to the application may&#10;vary, depending on whether the processor reads&#10;parameter and external entities.&#10;For example, a non-validating processor may not &#10;<titleref href="AVNormalize">normalize</titleref> attribute values,&#10;<titleref href="included">include</titleref> the replacement text of &#10;internal entities, or supply &#10;<titleref href="sec-attr-defaults">default attribute values</titleref>,&#10;where doing so depends on having read declarations in &#10;external or parameter entities.</p></item>&#10;</ulist>&#10;</p>&#10;<p>For maximum reliability in interoperating between different XML&#10;processors, applications which use non-validating processors should not &#10;rely on any behaviors not required of such processors.&#10;Applications which require facilities such as the use of default&#10;attributes or internal entities which are declared in external&#10;entities should use validating XML processors.</p>&#10;</div2>&#10;</div1>&#10;&#10;<div1 id="sec-notation">&#10;<head>Notation</head>&#10; &#10;<p>The formal grammar of XML is given in this specification using a simple&#10;Extended Backus-Naur Form (EBNF) notation.  Each rule in the grammar defines&#10;one symbol, in the form&#10;<eg>symbol ::= expression</eg></p>&#10;<p>Symbols are written with an initial capital letter if they are&#10;defined by a regular expression, or with an initial lower case letter &#10;otherwise.&#10;Literal strings are quoted.&#10;&#10;</p>&#10;&#10;<p>Within the expression on the right-hand side of a rule, the following&#10;expressions are used to match strings of one or more characters:&#10;<glist>&#10;<gitem>&#10;<label><code>#xN</code></label>&#10;<def><p>where <code>N</code> is a hexadecimal integer, the&#10;expression matches the character in ISO/IEC 10646 whose canonical&#10;(UCS-4) &#10;code value, when interpreted as an unsigned binary number, has&#10;the value indicated.  The number of leading zeros in the&#10;<code>#xN</code> form is insignificant; the number of leading&#10;zeros in the corresponding code value &#10;is governed by the character&#10;encoding in use and is not significant for XML.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></label>&#10;<def><p>matches any <termref def="dt-character">character</termref> &#10;with a value in the range(s) indicated (inclusive).</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>[^a-z]</code>, <code>[^#xN-#xN]</code></label>&#10;<def><p>matches any <termref def="dt-character">character</termref> &#10;with a value <emph>outside</emph> the&#10;range indicated.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></label>&#10;<def><p>matches any <termref def="dt-character">character</termref>&#10;with a value not among the characters given.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>&quot;string&quot;</code></label>&#10;<def><p>matches a literal string <termref def="dt-match">matching</termref>&#10;that given inside the double quotes.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>'string'</code></label>&#10;<def><p>matches a literal string <termref def="dt-match">matching</termref>&#10;that given inside the single quotes.</p></def>&#10;</gitem>&#10;</glist>&#10;These symbols may be combined to match more complex patterns as follows,&#10;where <code>A</code> and <code>B</code> represent simple expressions:&#10;<glist>&#10;<gitem>&#10;<label>(<code>expression</code>)</label>&#10;<def><p><code>expression</code> is treated as a unit &#10;and may be combined as described in this list.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A?</code></label>&#10;<def><p>matches <code>A</code> or nothing; optional <code>A</code>.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A B</code></label>&#10;<def><p>matches <code>A</code> followed by <code>B</code>.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A | B</code></label>&#10;<def><p>matches <code>A</code> or <code>B</code> but not both.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A - B</code></label>&#10;<def><p>matches any string that matches <code>A</code> but does not match&#10;<code>B</code>.&#10;</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A+</code></label>&#10;<def><p>matches one or more occurrences of <code>A</code>.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>A*</code></label>&#10;<def><p>matches zero or more occurrences of <code>A</code>.</p></def>&#10;</gitem>&#10;&#10;</glist>&#10;Other notations used in the productions are:&#10;<glist>&#10;<gitem>&#10;<label><code>/* ... */</code></label>&#10;<def><p>comment.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>[ wfc: ... ]</code></label>&#10;<def><p>well-formedness constraint; this identifies by name a &#10;constraint on &#10;<termref def="dt-wellformed">well-formed</termref> documents&#10;associated with a production.</p></def>&#10;</gitem>&#10;<gitem>&#10;<label><code>[ vc: ... ]</code></label>&#10;<def><p>validity constraint; this identifies by name a constraint on&#10;<termref def="dt-valid">valid</termref> documents associated with&#10;a production.</p></def>&#10;</gitem>&#10;</glist>&#10;</p></div1>&#10;&#10;</body>&#10;<back>&#10;&#10; &#10;&#10;&#10;<div1 id="sec-bibliography">&#10;&#10;<head>References</head>&#10;<div2 id="sec-existing-stds">&#10;<head>Normative References</head>&#10;&#10;<blist>&#10;<bibl id="IANA" key="IANA">&#10;(Internet Assigned Numbers Authority) <emph>Official Names for &#10;Character Sets</emph>,&#10;ed. Keld Simonsen et al.&#10;See <loc href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</loc>.&#10;</bibl>&#10;&#10;<bibl id="RFC1766" key="IETF RFC 1766">&#10;IETF (Internet Engineering Task Force).&#10;<emph>RFC 1766:  Tags for the Identification of Languages</emph>,&#10;ed. H. Alvestrand.&#10;1995.&#10;</bibl>&#10;&#10;<bibl id="ISO639" key="ISO 639">&#10;(International Organization for Standardization).&#10;<emph>ISO 639:1988 (E).&#10;Code for the representation of names of languages.</emph>&#10;[Geneva]:  International Organization for&#10;Standardization, 1988.</bibl>&#10;&#10;<bibl id="ISO3166" key="ISO 3166">&#10;(International Organization for Standardization).&#10;<emph>ISO 3166-1:1997 (E).&#10;Codes for the representation of names of countries and their subdivisions &#10;-- Part 1: Country codes</emph>&#10;[Geneva]:  International Organization for&#10;Standardization, 1997.</bibl>&#10;&#10;<bibl id="ISO10646" key="ISO/IEC 10646">ISO&#10;(International Organization for Standardization).&#10;<emph>ISO/IEC 10646-1993 (E).  Information technology -- Universal&#10;Multiple-Octet Coded Character Set (UCS) -- Part 1:&#10;Architecture and Basic Multilingual Plane.</emph>&#10;[Geneva]:  International Organization for&#10;Standardization, 1993 (plus amendments AM 1 through AM 7).&#10;</bibl>&#10;&#10;<bibl id="Unicode" key="Unicode">The Unicode Consortium.&#10;<emph>The Unicode Standard, Version 2.0.</emph>&#10;Reading, Mass.:  Addison-Wesley Developers Press, 1996.</bibl>&#10;&#10;</blist>&#10;&#10;</div2>&#10;&#10;<div2><head>Other References</head> &#10;&#10;<blist>&#10;&#10;<bibl id="Aho" key="Aho/Ullman">Aho, Alfred V., &#10;Ravi Sethi, and Jeffrey D. Ullman.&#10;<emph>Compilers:  Principles, Techniques, and Tools</emph>.&#10;Reading:  Addison-Wesley, 1986, rpt. corr. 1988.</bibl>&#10;&#10;<bibl id="Berners-Lee" key="Berners-Lee et al." xml-link="simple">&#10;Berners-Lee, T., R. Fielding, and L. Masinter.&#10;<emph>Uniform Resource Identifiers (URI):  Generic Syntax and&#10;Semantics</emph>.&#10;1997.&#10;(Work in progress; see updates to RFC1738.)</bibl>&#10;&#10;<bibl id="ABK" key="Brüggemann-Klein">Brüggemann-Klein, Anne.&#10;<emph>Regular Expressions into Finite Automata</emph>.&#10;Extended abstract in I. Simon, Hrsg., LATIN 1992, &#10;S. 97-98. Springer-Verlag, Berlin 1992. &#10;Full Version in Theoretical Computer Science 120: 197-213, 1993.&#10;&#10;</bibl>&#10;&#10;<bibl id="ABKDW" key="Brüggemann-Klein and Wood">Brüggemann-Klein, Anne,&#10;and Derick Wood.&#10;<emph>Deterministic Regular Languages</emph>.&#10;Universität Freiburg, Institut für Informatik,&#10;Bericht 38, Oktober 1991.&#10;</bibl>&#10;&#10;<bibl id="Clark" key="Clark">James Clark.&#10;Comparison of SGML and XML. See&#10;<loc href="http://www.w3.org/TR/NOTE-sgml-xml-971215">http://www.w3.org/TR/NOTE-sgml-xml-971215</loc>.&#10;</bibl>&#10;<bibl id="RFC1738" key="IETF RFC1738" xml-link="simple">&#10;IETF (Internet Engineering Task Force).&#10;<emph>RFC 1738:  Uniform Resource Locators (URL)</emph>, &#10;ed. T. Berners-Lee, L. Masinter, M. McCahill.&#10;1994.&#10;</bibl>&#10;&#10;<bibl id="RFC1808" key="IETF RFC1808" xml-link="simple">&#10;IETF (Internet Engineering Task Force).&#10;<emph>RFC 1808:  Relative Uniform Resource Locators</emph>, &#10;ed. R. Fielding.&#10;1995.&#10;</bibl>&#10;&#10;<bibl id="RFC2141" key="IETF RFC2141" xml-link="simple">&#10;IETF (Internet Engineering Task Force).&#10;<emph>RFC 2141:  URN Syntax</emph>, &#10;ed. R. Moats.&#10;1997.&#10;</bibl>&#10;&#10;<bibl id="ISO8879" key="ISO 8879">ISO&#10;(International Organization for Standardization).&#10;<emph>ISO 8879:1986(E).  Information processing -- Text and Office&#10;Systems -- Standard Generalized Markup Language (SGML).</emph>  First&#10;edition -- 1986-10-15.  [Geneva]:  International Organization for&#10;Standardization, 1986.&#10;</bibl>&#10;&#10;&#10;<bibl id="ISO10744" key="ISO/IEC 10744">ISO&#10;(International Organization for Standardization).&#10;<emph>ISO/IEC 10744-1992 (E).  Information technology --&#10;Hypermedia/Time-based Structuring Language (HyTime).&#10;</emph>&#10;[Geneva]:  International Organization for&#10;Standardization, 1992.&#10;<emph>Extended Facilities Annexe.</emph>&#10;[Geneva]:  International Organization for&#10;Standardization, 1996. &#10;</bibl>&#10;&#10;&#10;&#10;</blist>&#10;</div2>&#10;</div1>&#10;<div1 id="CharClasses">&#10;<head>Character Classes</head>&#10;<p>Following the characteristics defined in the Unicode standard,&#10;characters are classed as base characters (among others, these&#10;contain the alphabetic characters of the Latin alphabet, without&#10;diacritics), ideographic characters, and combining characters (among&#10;others, this class contains most diacritics); these classes combine&#10;to form the class of letters.  Digits and extenders are&#10;also distinguished.&#10;<scrap id="CHARACTERS" lang="ebnf">&#10;<head>Characters</head>&#10;<prodgroup pcw3="3" pcw4="15">&#10;<prod id="NT-Letter"><lhs>Letter</lhs>&#10;<rhs><nt def="NT-BaseChar">BaseChar</nt> &#10;| <nt def="NT-Ideographic">Ideographic</nt></rhs> </prod>&#10;<prod id="NT-BaseChar"><lhs>BaseChar</lhs>&#10;<rhs>[#x0041-#x005A]&#10;| [#x0061-#x007A]&#10;| [#x00C0-#x00D6]&#10;| [#x00D8-#x00F6]&#10;| [#x00F8-#x00FF]&#10;| [#x0100-#x0131]&#10;| [#x0134-#x013E]&#10;| [#x0141-#x0148]&#10;| [#x014A-#x017E]&#10;| [#x0180-#x01C3]&#10;| [#x01CD-#x01F0]&#10;| [#x01F4-#x01F5]&#10;| [#x01FA-#x0217]&#10;| [#x0250-#x02A8]&#10;| [#x02BB-#x02C1]&#10;| #x0386&#10;| [#x0388-#x038A]&#10;| #x038C&#10;| [#x038E-#x03A1]&#10;| [#x03A3-#x03CE]&#10;| [#x03D0-#x03D6]&#10;| #x03DA&#10;| #x03DC&#10;| #x03DE&#10;| #x03E0&#10;| [#x03E2-#x03F3]&#10;| [#x0401-#x040C]&#10;| [#x040E-#x044F]&#10;| [#x0451-#x045C]&#10;| [#x045E-#x0481]&#10;| [#x0490-#x04C4]&#10;| [#x04C7-#x04C8]&#10;| [#x04CB-#x04CC]&#10;| [#x04D0-#x04EB]&#10;| [#x04EE-#x04F5]&#10;| [#x04F8-#x04F9]&#10;| [#x0531-#x0556]&#10;| #x0559&#10;| [#x0561-#x0586]&#10;| [#x05D0-#x05EA]&#10;| [#x05F0-#x05F2]&#10;| [#x0621-#x063A]&#10;| [#x0641-#x064A]&#10;| [#x0671-#x06B7]&#10;| [#x06BA-#x06BE]&#10;| [#x06C0-#x06CE]&#10;| [#x06D0-#x06D3]&#10;| #x06D5&#10;| [#x06E5-#x06E6]&#10;| [#x0905-#x0939]&#10;| #x093D&#10;| [#x0958-#x0961]&#10;| [#x0985-#x098C]&#10;| [#x098F-#x0990]&#10;| [#x0993-#x09A8]&#10;| [#x09AA-#x09B0]&#10;| #x09B2&#10;| [#x09B6-#x09B9]&#10;| [#x09DC-#x09DD]&#10;| [#x09DF-#x09E1]&#10;| [#x09F0-#x09F1]&#10;| [#x0A05-#x0A0A]&#10;| [#x0A0F-#x0A10]&#10;| [#x0A13-#x0A28]&#10;| [#x0A2A-#x0A30]&#10;| [#x0A32-#x0A33]&#10;| [#x0A35-#x0A36]&#10;| [#x0A38-#x0A39]&#10;| [#x0A59-#x0A5C]&#10;| #x0A5E&#10;| [#x0A72-#x0A74]&#10;| [#x0A85-#x0A8B]&#10;| #x0A8D&#10;| [#x0A8F-#x0A91]&#10;| [#x0A93-#x0AA8]&#10;| [#x0AAA-#x0AB0]&#10;| [#x0AB2-#x0AB3]&#10;| [#x0AB5-#x0AB9]&#10;| #x0ABD&#10;| #x0AE0&#10;| [#x0B05-#x0B0C]&#10;| [#x0B0F-#x0B10]&#10;| [#x0B13-#x0B28]&#10;| [#x0B2A-#x0B30]&#10;| [#x0B32-#x0B33]&#10;| [#x0B36-#x0B39]&#10;| #x0B3D&#10;| [#x0B5C-#x0B5D]&#10;| [#x0B5F-#x0B61]&#10;| [#x0B85-#x0B8A]&#10;| [#x0B8E-#x0B90]&#10;| [#x0B92-#x0B95]&#10;| [#x0B99-#x0B9A]&#10;| #x0B9C&#10;| [#x0B9E-#x0B9F]&#10;| [#x0BA3-#x0BA4]&#10;| [#x0BA8-#x0BAA]&#10;| [#x0BAE-#x0BB5]&#10;| [#x0BB7-#x0BB9]&#10;| [#x0C05-#x0C0C]&#10;| [#x0C0E-#x0C10]&#10;| [#x0C12-#x0C28]&#10;| [#x0C2A-#x0C33]&#10;| [#x0C35-#x0C39]&#10;| [#x0C60-#x0C61]&#10;| [#x0C85-#x0C8C]&#10;| [#x0C8E-#x0C90]&#10;| [#x0C92-#x0CA8]&#10;| [#x0CAA-#x0CB3]&#10;| [#x0CB5-#x0CB9]&#10;| #x0CDE&#10;| [#x0CE0-#x0CE1]&#10;| [#x0D05-#x0D0C]&#10;| [#x0D0E-#x0D10]&#10;| [#x0D12-#x0D28]&#10;| [#x0D2A-#x0D39]&#10;| [#x0D60-#x0D61]&#10;| [#x0E01-#x0E2E]&#10;| #x0E30&#10;| [#x0E32-#x0E33]&#10;| [#x0E40-#x0E45]&#10;| [#x0E81-#x0E82]&#10;| #x0E84&#10;| [#x0E87-#x0E88]&#10;| #x0E8A&#10;| #x0E8D&#10;| [#x0E94-#x0E97]&#10;| [#x0E99-#x0E9F]&#10;| [#x0EA1-#x0EA3]&#10;| #x0EA5&#10;| #x0EA7&#10;| [#x0EAA-#x0EAB]&#10;| [#x0EAD-#x0EAE]&#10;| #x0EB0&#10;| [#x0EB2-#x0EB3]&#10;| #x0EBD&#10;| [#x0EC0-#x0EC4]&#10;| [#x0F40-#x0F47]&#10;| [#x0F49-#x0F69]&#10;| [#x10A0-#x10C5]&#10;| [#x10D0-#x10F6]&#10;| #x1100&#10;| [#x1102-#x1103]&#10;| [#x1105-#x1107]&#10;| #x1109&#10;| [#x110B-#x110C]&#10;| [#x110E-#x1112]&#10;| #x113C&#10;| #x113E&#10;| #x1140&#10;| #x114C&#10;| #x114E&#10;| #x1150&#10;| [#x1154-#x1155]&#10;| #x1159&#10;| [#x115F-#x1161]&#10;| #x1163&#10;| #x1165&#10;| #x1167&#10;| #x1169&#10;| [#x116D-#x116E]&#10;| [#x1172-#x1173]&#10;| #x1175&#10;| #x119E&#10;| #x11A8&#10;| #x11AB&#10;| [#x11AE-#x11AF]&#10;| [#x11B7-#x11B8]&#10;| #x11BA&#10;| [#x11BC-#x11C2]&#10;| #x11EB&#10;| #x11F0&#10;| #x11F9&#10;| [#x1E00-#x1E9B]&#10;| [#x1EA0-#x1EF9]&#10;| [#x1F00-#x1F15]&#10;| [#x1F18-#x1F1D]&#10;| [#x1F20-#x1F45]&#10;| [#x1F48-#x1F4D]&#10;| [#x1F50-#x1F57]&#10;| #x1F59&#10;| #x1F5B&#10;| #x1F5D&#10;| [#x1F5F-#x1F7D]&#10;| [#x1F80-#x1FB4]&#10;| [#x1FB6-#x1FBC]&#10;| #x1FBE&#10;| [#x1FC2-#x1FC4]&#10;| [#x1FC6-#x1FCC]&#10;| [#x1FD0-#x1FD3]&#10;| [#x1FD6-#x1FDB]&#10;| [#x1FE0-#x1FEC]&#10;| [#x1FF2-#x1FF4]&#10;| [#x1FF6-#x1FFC]&#10;| #x2126&#10;| [#x212A-#x212B]&#10;| #x212E&#10;| [#x2180-#x2182]&#10;| [#x3041-#x3094]&#10;| [#x30A1-#x30FA]&#10;| [#x3105-#x312C]&#10;| [#xAC00-#xD7A3]&#10;</rhs></prod>&#10;<prod id="NT-Ideographic"><lhs>Ideographic</lhs>&#10;<rhs>[#x4E00-#x9FA5]&#10;| #x3007&#10;| [#x3021-#x3029]&#10;</rhs></prod>&#10;<prod id="NT-CombiningChar"><lhs>CombiningChar</lhs>&#10;<rhs>[#x0300-#x0345]&#10;| [#x0360-#x0361]&#10;| [#x0483-#x0486]&#10;| [#x0591-#x05A1]&#10;| [#x05A3-#x05B9]&#10;| [#x05BB-#x05BD]&#10;| #x05BF&#10;| [#x05C1-#x05C2]&#10;| #x05C4&#10;| [#x064B-#x0652]&#10;| #x0670&#10;| [#x06D6-#x06DC]&#10;| [#x06DD-#x06DF]&#10;| [#x06E0-#x06E4]&#10;| [#x06E7-#x06E8]&#10;| [#x06EA-#x06ED]&#10;| [#x0901-#x0903]&#10;| #x093C&#10;| [#x093E-#x094C]&#10;| #x094D&#10;| [#x0951-#x0954]&#10;| [#x0962-#x0963]&#10;| [#x0981-#x0983]&#10;| #x09BC&#10;| #x09BE&#10;| #x09BF&#10;| [#x09C0-#x09C4]&#10;| [#x09C7-#x09C8]&#10;| [#x09CB-#x09CD]&#10;| #x09D7&#10;| [#x09E2-#x09E3]&#10;| #x0A02&#10;| #x0A3C&#10;| #x0A3E&#10;| #x0A3F&#10;| [#x0A40-#x0A42]&#10;| [#x0A47-#x0A48]&#10;| [#x0A4B-#x0A4D]&#10;| [#x0A70-#x0A71]&#10;| [#x0A81-#x0A83]&#10;| #x0ABC&#10;| [#x0ABE-#x0AC5]&#10;| [#x0AC7-#x0AC9]&#10;| [#x0ACB-#x0ACD]&#10;| [#x0B01-#x0B03]&#10;| #x0B3C&#10;| [#x0B3E-#x0B43]&#10;| [#x0B47-#x0B48]&#10;| [#x0B4B-#x0B4D]&#10;| [#x0B56-#x0B57]&#10;| [#x0B82-#x0B83]&#10;| [#x0BBE-#x0BC2]&#10;| [#x0BC6-#x0BC8]&#10;| [#x0BCA-#x0BCD]&#10;| #x0BD7&#10;| [#x0C01-#x0C03]&#10;| [#x0C3E-#x0C44]&#10;| [#x0C46-#x0C48]&#10;| [#x0C4A-#x0C4D]&#10;| [#x0C55-#x0C56]&#10;| [#x0C82-#x0C83]&#10;| [#x0CBE-#x0CC4]&#10;| [#x0CC6-#x0CC8]&#10;| [#x0CCA-#x0CCD]&#10;| [#x0CD5-#x0CD6]&#10;| [#x0D02-#x0D03]&#10;| [#x0D3E-#x0D43]&#10;| [#x0D46-#x0D48]&#10;| [#x0D4A-#x0D4D]&#10;| #x0D57&#10;| #x0E31&#10;| [#x0E34-#x0E3A]&#10;| [#x0E47-#x0E4E]&#10;| #x0EB1&#10;| [#x0EB4-#x0EB9]&#10;| [#x0EBB-#x0EBC]&#10;| [#x0EC8-#x0ECD]&#10;| [#x0F18-#x0F19]&#10;| #x0F35&#10;| #x0F37&#10;| #x0F39&#10;| #x0F3E&#10;| #x0F3F&#10;| [#x0F71-#x0F84]&#10;| [#x0F86-#x0F8B]&#10;| [#x0F90-#x0F95]&#10;| #x0F97&#10;| [#x0F99-#x0FAD]&#10;| [#x0FB1-#x0FB7]&#10;| #x0FB9&#10;| [#x20D0-#x20DC]&#10;| #x20E1&#10;| [#x302A-#x302F]&#10;| #x3099&#10;| #x309A&#10;</rhs></prod>&#10;<prod id="NT-Digit"><lhs>Digit</lhs>&#10;<rhs>[#x0030-#x0039]&#10;| [#x0660-#x0669]&#10;| [#x06F0-#x06F9]&#10;| [#x0966-#x096F]&#10;| [#x09E6-#x09EF]&#10;| [#x0A66-#x0A6F]&#10;| [#x0AE6-#x0AEF]&#10;| [#x0B66-#x0B6F]&#10;| [#x0BE7-#x0BEF]&#10;| [#x0C66-#x0C6F]&#10;| [#x0CE6-#x0CEF]&#10;| [#x0D66-#x0D6F]&#10;| [#x0E50-#x0E59]&#10;| [#x0ED0-#x0ED9]&#10;| [#x0F20-#x0F29]&#10;</rhs></prod>&#10;<prod id="NT-Extender"><lhs>Extender</lhs>&#10;<rhs>#x00B7&#10;| #x02D0&#10;| #x02D1&#10;| #x0387&#10;| #x0640&#10;| #x0E46&#10;| #x0EC6&#10;| #x3005&#10;| [#x3031-#x3035]&#10;| [#x309D-#x309E]&#10;| [#x30FC-#x30FE]&#10;</rhs></prod>&#10;&#10;</prodgroup>&#10;</scrap>&#10;</p>&#10;<p>The character classes defined here can be derived from the&#10;Unicode character database as follows:&#10;<ulist>&#10;<item>&#10;<p>Name start characters must have one of the categories Ll, Lu,&#10;Lo, Lt, Nl.</p>&#10;</item>&#10;<item>&#10;<p>Name characters other than Name-start characters &#10;must have one of the categories Mc, Me, Mn, Lm, or Nd.</p>&#10;</item>&#10;<item>&#10;<p>Characters in the compatibility area (i.e. with character code&#10;greater than #xF900 and less than #xFFFE) are not allowed in XML&#10;names.</p>&#10;</item>&#10;<item>&#10;<p>Characters which have a font or compatibility decomposition (i.e. those&#10;with a &quot;compatibility formatting tag&quot; in field 5 of the database --&#10;marked by field 5 beginning with a &quot;&lt;&quot;) are not allowed.</p>&#10;</item>&#10;<item>&#10;<p>The following characters are treated as name-start characters&#10;rather than name characters, because the property file classifies&#10;them as Alphabetic:  [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.</p>&#10;</item>&#10;<item>&#10;<p>Characters #x20DD-#x20E0 are excluded (in accordance with &#10;Unicode, section 5.14).</p>&#10;</item>&#10;<item>&#10;<p>Character #x00B7 is classified as an extender, because the&#10;property list so identifies it.</p>&#10;</item>&#10;<item>&#10;<p>Character #x0387 is added as a name character, because #x00B7&#10;is its canonical equivalent.</p>&#10;</item>&#10;<item>&#10;<p>Characters ':' and '_' are allowed as name-start characters.</p>&#10;</item>&#10;<item>&#10;<p>Characters '-' and '.' are allowed as name characters.</p>&#10;</item>&#10;</ulist>&#10;</p>&#10;</div1>&#10;<inform-div1 id="sec-xml-and-sgml">&#10;<head>XML and SGML</head>&#10; &#10;<p>XML is designed to be a subset of SGML, in that every&#10;<termref def="dt-valid">valid</termref> XML document should also be a&#10;conformant SGML document.&#10;For a detailed comparison of the additional restrictions that XML places on&#10;documents beyond those of SGML, see <bibref ref="Clark"></bibref>.&#10;</p>&#10;</inform-div1>&#10;<inform-div1 id="sec-entexpand">&#10;<head>Expansion of Entity and Character References</head>&#10;<p>This appendix contains some examples illustrating the&#10;sequence of entity- and character-reference recognition and&#10;expansion, as specified in <specref ref="entproc"></specref>.</p>&#10;<p>&#10;If the DTD contains the declaration &#10;<eg>&lt;!ENTITY example &quot;&lt;p&gt;An ampersand (&amp;#38;#38;) may be escaped&#10;numerically (&amp;#38;#38;#38;) or with a general entity&#10;(&amp;amp;amp;).&lt;/p&gt;&quot; &gt;&#10;</eg>&#10;then the XML processor will recognize the character references &#10;when it parses the entity declaration, and resolve them before &#10;storing the following string as the&#10;value of the entity &quot;<code>example</code>&quot;:&#10;<eg>&lt;p&gt;An ampersand (&amp;#38;) may be escaped&#10;numerically (&amp;#38;#38;) or with a general entity&#10;(&amp;amp;amp;).&lt;/p&gt;&#10;</eg>&#10;A reference in the document to &quot;<code>&amp;example;</code>&quot; &#10;will cause the text to be reparsed, at which time the &#10;start- and end-tags of the &quot;<code>p</code>&quot; element will be recognized &#10;and the three references will be recognized and expanded, &#10;resulting in a &quot;<code>p</code>&quot; element with the following content&#10;(all data, no delimiters or markup):&#10;<eg>An ampersand (&amp;) may be escaped&#10;numerically (&amp;#38;) or with a general entity&#10;(&amp;amp;).&#10;</eg>&#10;</p>&#10;<p>A more complex example will illustrate the rules and their&#10;effects fully.  In the following example, the line numbers are&#10;solely for reference.&#10;<eg>1 &lt;?xml version='1.0'?&gt;&#10;2 &lt;!DOCTYPE test [&#10;3 &lt;!ELEMENT test (#PCDATA) &gt;&#10;4 &lt;!ENTITY % xx '&amp;#37;zz;'&gt;&#10;5 &lt;!ENTITY % zz '&amp;#60;!ENTITY tricky &quot;error-prone&quot; &gt;' &gt;&#10;6 %xx;&#10;7 ]&gt;&#10;8 &lt;test&gt;This sample shows a &amp;tricky; method.&lt;/test&gt;&#10;</eg>&#10;This produces the following:&#10;<ulist spacing="compact">&#10;<item><p>in line 4, the reference to character 37 is expanded immediately,&#10;and the parameter entity &quot;<code>xx</code>&quot; is stored in the symbol&#10;table with the value &quot;<code>%zz;</code>&quot;.  Since the replacement text&#10;is not rescanned, the reference to parameter entity &quot;<code>zz</code>&quot;&#10;is not recognized.  (And it would be an error if it were, since&#10;&quot;<code>zz</code>&quot; is not yet declared.)</p></item>&#10;<item><p>in line 5, the character reference &quot;<code>&amp;#60;</code>&quot; is&#10;expanded immediately and the parameter entity &quot;<code>zz</code>&quot; is&#10;stored with the replacement text &#10;&quot;<code>&lt;!ENTITY tricky &quot;error-prone&quot; &gt;</code>&quot;,&#10;which is a well-formed entity declaration.</p></item>&#10;<item><p>in line 6, the reference to &quot;<code>xx</code>&quot; is recognized,&#10;and the replacement text of &quot;<code>xx</code>&quot; (namely &#10;&quot;<code>%zz;</code>&quot;) is parsed.  The reference to &quot;<code>zz</code>&quot;&#10;is recognized in its turn, and its replacement text &#10;(&quot;<code>&lt;!ENTITY tricky &quot;error-prone&quot; &gt;</code>&quot;) is parsed.&#10;The general entity &quot;<code>tricky</code>&quot; has now been&#10;declared, with the replacement text &quot;<code>error-prone</code>&quot;.</p></item>&#10;<item><p>&#10;in line 8, the reference to the general entity &quot;<code>tricky</code>&quot; is&#10;recognized, and it is expanded, so the full content of the&#10;&quot;<code>test</code>&quot; element is the self-describing (and ungrammatical) string&#10;<emph>This sample shows a error-prone method.</emph>&#10;</p></item>&#10;</ulist>&#10;</p>&#10;</inform-div1> &#10;<inform-div1 id="determinism">&#10;<head>Deterministic Content Models</head>&#10;<p><termref def="dt-compat">For compatibility</termref>, it is&#10;required&#10;that content models in element type declarations be deterministic.  &#10;</p>&#10;&#10;<p>SGML&#10;requires deterministic content models (it calls them&#10;&quot;unambiguous&quot;); XML processors built using SGML systems may&#10;flag non-deterministic content models as errors.</p>&#10;<p>For example, the content model <code>((b, c) | (b, d))</code> is&#10;non-deterministic, because given an initial <code>b</code> the parser&#10;cannot know which <code>b</code> in the model is being matched without&#10;looking ahead to see which element follows the <code>b</code>.&#10;In this case, the two references to&#10;<code>b</code> can be collapsed &#10;into a single reference, making the model read&#10;<code>(b, (c | d))</code>.  An initial <code>b</code> now clearly&#10;matches only a single name in the content model.  The parser doesn't&#10;need to look ahead to see what follows; either <code>c</code> or&#10;<code>d</code> would be accepted.</p>&#10;<p>More formally:  a finite state automaton may be constructed from the&#10;content model using the standard algorithms, e.g. algorithm 3.5 &#10;in section 3.9&#10;of Aho, Sethi, and Ullman <bibref ref="Aho"></bibref>.&#10;In many such algorithms, a follow set is constructed for each &#10;position in the regular expression (i.e., each leaf &#10;node in the &#10;syntax tree for the regular expression);&#10;if any position has a follow set in which &#10;more than one following position is &#10;labeled with the same element type name, &#10;then the content model is in error&#10;and may be reported as an error.&#10;</p>&#10;<p>Algorithms exist which allow many but not all non-deterministic&#10;content models to be reduced automatically to equivalent deterministic&#10;models; see Brüggemann-Klein 1991 <bibref ref="ABK"></bibref>.</p>&#10;</inform-div1>&#10;<inform-div1 id="sec-guessing">&#10;<head>Autodetection of Character Encodings</head>&#10;<p>The XML encoding declaration functions as an internal label on each&#10;entity, indicating which character encoding is in use.  Before an XML&#10;processor can read the internal label, however, it apparently has to&#10;know what character encoding is in use--which is what the internal label&#10;is trying to indicate.  In the general case, this is a hopeless&#10;situation. It is not entirely hopeless in XML, however, because XML&#10;limits the general case in two ways:  each implementation is assumed&#10;to support only a  finite set of character encodings, and the XML&#10;encoding declaration is restricted in position and content in order to&#10;make it feasible to autodetect the character encoding in use in each&#10;entity in normal cases.  Also, in many cases other sources of information&#10;are available in addition to the XML data stream itself.  &#10;Two cases may be distinguished, &#10;depending on whether the XML entity is presented to the&#10;processor without, or with, any accompanying&#10;(external) information.  We consider the first case first.&#10;</p>&#10;<p>&#10;Because each XML entity not in UTF-8 or UTF-16 format <emph>must</emph>&#10;begin with an XML encoding declaration, in which the first  characters&#10;must be '<code>&lt;?xml</code>', any conforming processor can detect,&#10;after two to four octets of input, which of the following cases apply. &#10;In reading this list, it may help to know that in UCS-4, '&lt;' is&#10;&quot;<code>#x0000003C</code>&quot; and '?' is &quot;<code>#x0000003F</code>&quot;, and the Byte&#10;Order Mark required of UTF-16 data streams is &quot;<code>#xFEFF</code>&quot;.</p>&#10;<p>&#10;<ulist>&#10;<item>&#10;<p><code>00 00 00 3C</code>: UCS-4, big-endian machine (1234 order)</p>&#10;</item>&#10;<item>&#10;<p><code>3C 00 00 00</code>: UCS-4, little-endian machine (4321 order)</p>&#10;</item>&#10;<item>&#10;<p><code>00 00 3C 00</code>: UCS-4, unusual octet order (2143)</p>&#10;</item>&#10;<item>&#10;<p><code>00 3C 00 00</code>: UCS-4, unusual octet order (3412)</p>&#10;</item>&#10;<item>&#10;<p><code>FE FF</code>: UTF-16, big-endian</p>&#10;</item>&#10;<item>&#10;<p><code>FF FE</code>: UTF-16, little-endian</p>&#10;</item>&#10;<item>&#10;<p><code>00 3C 00 3F</code>: UTF-16, big-endian, no Byte Order Mark&#10;(and thus, strictly speaking, in error)</p>&#10;</item>&#10;<item>&#10;<p><code>3C 00 3F 00</code>: UTF-16, little-endian, no Byte Order Mark&#10;(and thus, strictly speaking, in error)</p>&#10;</item>&#10;<item>&#10;<p><code>3C 3F 78 6D</code>: UTF-8, ISO 646, ASCII, some part of ISO 8859, &#10;Shift-JIS, EUC, or any other 7-bit, 8-bit, or mixed-width encoding&#10;which ensures that the characters of ASCII have their normal positions,&#10;width,&#10;and values; the actual encoding declaration must be read to &#10;detect which of these applies, but since all of these encodings&#10;use the same bit patterns for the ASCII characters, the encoding &#10;declaration itself may be read reliably&#10;</p>&#10;</item>&#10;<item>&#10;<p><code>4C 6F A7 94</code>: EBCDIC (in some flavor; the full&#10;encoding declaration must be read to tell which code page is in &#10;use)</p>&#10;</item>&#10;<item>&#10;<p>other: UTF-8 without an encoding declaration, or else &#10;the data stream is corrupt, fragmentary, or enclosed in&#10;a wrapper of some kind</p>&#10;</item>&#10;</ulist>&#10;</p>&#10;<p>&#10;This level of autodetection is enough to read the XML encoding&#10;declaration and parse the character-encoding identifier, which is&#10;still necessary to distinguish the individual members of each family&#10;of encodings (e.g. to tell  UTF-8 from 8859, and the parts of 8859&#10;from each other, or to distinguish the specific EBCDIC code page in&#10;use, and so on).&#10;</p>&#10;<p>&#10;Because the contents of the encoding declaration are restricted to&#10;ASCII characters, a processor can reliably read the entire encoding&#10;declaration as soon as it has detected which family of encodings is in&#10;use.  Since in practice, all widely used character encodings fall into&#10;one of the categories above, the XML encoding declaration allows&#10;reasonably reliable in-band labeling of character encodings, even when&#10;external sources of information at the operating-system or&#10;transport-protocol level are unreliable.&#10;</p>&#10;<p>&#10;Once the processor has detected the character encoding in use, it can&#10;act appropriately, whether by invoking a separate input routine for&#10;each case, or by calling the proper conversion function on each&#10;character of input. &#10;</p>&#10;<p>&#10;Like any self-labeling system, the XML encoding declaration will not&#10;work if any software changes the entity's character set or encoding&#10;without updating the encoding declaration.  Implementors of&#10;character-encoding routines should be careful to ensure the accuracy&#10;of the internal and external information used to label the entity.&#10;</p>&#10;<p>The second possible case occurs when the XML entity is accompanied&#10;by encoding information, as in some file systems and some network&#10;protocols.&#10;When multiple sources of information are available,&#10;&#10;their relative&#10;priority and the preferred method of handling conflict should be&#10;specified as part of the higher-level protocol used to deliver XML.&#10;Rules for the relative priority of the internal label and the&#10;MIME-type label in an external header, for example, should be part of the&#10;RFC document defining the text/xml and application/xml MIME types. In&#10;the interests of interoperability, however, the following rules&#10;are recommended.&#10;<ulist>&#10;<item><p>If an XML entity is in a file, the Byte-Order Mark&#10;and encoding-declaration PI are used (if present) to determine the&#10;character encoding.  All other heuristics and sources of information&#10;are solely for error recovery.&#10;</p></item>&#10;<item><p>If an XML entity is delivered with a&#10;MIME type of text/xml, then the <code>charset</code> parameter&#10;on the MIME type determines the&#10;character encoding method; all other heuristics and sources of&#10;information are solely for error recovery.&#10;</p></item>&#10;<item><p>If an XML entity is delivered &#10;with a&#10;MIME type of application/xml, then the Byte-Order Mark and&#10;encoding-declaration PI are used (if present) to determine the&#10;character encoding.  All other heuristics and sources of&#10;information are solely for error recovery.&#10;</p></item>&#10;</ulist>&#10;These rules apply only in the absence of protocol-level documentation;&#10;in particular, when the MIME types text/xml and application/xml are&#10;defined, the recommendations of the relevant RFC will supersede&#10;these rules.&#10;</p>&#10;&#10;</inform-div1>&#10;&#10;<inform-div1 id="sec-xml-wg">&#10;<head>W3C XML Working Group</head>&#10; &#10;<p>This specification was prepared and approved for publication by the&#10;W3C XML Working Group (WG).  WG approval of this specification does&#10;not necessarily imply that all WG members voted for its approval.  &#10;The current and former members of the XML WG are:</p>&#10; &#10;<orglist>&#10;<member><name>Jon Bosak, Sun</name><role>Chair</role></member>&#10;<member><name>James Clark</name><role>Technical Lead</role></member>&#10;<member><name>Tim Bray, Textuality and Netscape</name><role>XML Co-editor</role></member>&#10;<member><name>Jean Paoli, Microsoft</name><role>XML Co-editor</role></member>&#10;<member><name>C. M. Sperberg-McQueen, U. of Ill.</name><role>XML&#10;Co-editor</role></member>&#10;<member><name>Dan Connolly, W3C</name><role>W3C Liaison</role></member>&#10;<member><name>Paula Angerstein, Texcel</name></member>&#10;<member><name>Steve DeRose, INSO</name></member>&#10;<member><name>Dave Hollander, HP</name></member>&#10;<member><name>Eliot Kimber, ISOGEN</name></member>&#10;<member><name>Eve Maler, ArborText</name></member>&#10;<member><name>Tom Magliery, NCSA</name></member>&#10;<member><name>Murray Maloney, Muzmo and Grif</name></member>&#10;<member><name>Makoto Murata, Fuji Xerox Information Systems</name></member>&#10;<member><name>Joel Nava, Adobe</name></member>&#10;<member><name>Conleth O'Connell, Vignette</name></member>&#10;<member><name>Peter Sharpe, SoftQuad</name></member>&#10;<member><name>John Tigue, DataChannel</name></member>&#10;</orglist>&#10;&#10;</inform-div1>&#10;</back>&#10;</spec>