xref: /aosp_15_r20/external/libxml2/result/valid/REC-xml-19980210.xml (revision 7c5688314b92172186c154356a6374bf7684c3ca)
1*7c568831SAndroid Build Coastguard Worker<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2*7c568831SAndroid Build Coastguard Worker<!DOCTYPE spec SYSTEM "dtds/spec.dtd" [
3*7c568831SAndroid Build Coastguard Worker<!-- LAST TOUCHED BY: Tim Bray, 8 February 1997 --><!-- The words 'FINAL EDIT' in comments mark places where changes
4*7c568831SAndroid Build Coastguard Workerneed to be made after approval of the document by the ERB, before
5*7c568831SAndroid Build Coastguard Workerpublication.  --><!ENTITY XML.version "1.0">
6*7c568831SAndroid Build Coastguard Worker<!ENTITY doc.date "10 February 1998">
7*7c568831SAndroid Build Coastguard Worker<!ENTITY iso6.doc.date "19980210">
8*7c568831SAndroid Build Coastguard Worker<!ENTITY w3c.doc.date "02-Feb-1998">
9*7c568831SAndroid Build Coastguard Worker<!ENTITY draft.day "10">
10*7c568831SAndroid Build Coastguard Worker<!ENTITY draft.month "February">
11*7c568831SAndroid Build Coastguard Worker<!ENTITY draft.year "1998">
12*7c568831SAndroid Build Coastguard Worker<!ENTITY WebSGML "WebSGML Adaptations Annex to ISO 8879">
13*7c568831SAndroid Build Coastguard Worker<!ENTITY lt "&#38;#60;">
14*7c568831SAndroid Build Coastguard Worker<!ENTITY gt ">">
15*7c568831SAndroid Build Coastguard Worker<!ENTITY xmlpio "'&lt;?xml'">
16*7c568831SAndroid Build Coastguard Worker<!ENTITY pic "'?>'">
17*7c568831SAndroid Build Coastguard Worker<!ENTITY br "\n">
18*7c568831SAndroid Build Coastguard Worker<!ENTITY cellback "#c0d9c0">
19*7c568831SAndroid Build Coastguard Worker<!ENTITY mdash "--">
20*7c568831SAndroid Build Coastguard Worker<!-- &#x2014, but nsgmls doesn't grok hex --><!ENTITY com "--">
21*7c568831SAndroid Build Coastguard Worker<!ENTITY como "--">
22*7c568831SAndroid Build Coastguard Worker<!ENTITY comc "--">
23*7c568831SAndroid Build Coastguard Worker<!ENTITY hcro "&amp;#x">
24*7c568831SAndroid Build Coastguard Worker<!-- <!ENTITY nbsp "�"> --><!ENTITY nbsp "&#160;">
25*7c568831SAndroid Build Coastguard Worker<!ENTITY magicents "<code>amp</code>,
26*7c568831SAndroid Build Coastguard Worker<code>lt</code>,
27*7c568831SAndroid Build Coastguard Worker<code>gt</code>,
28*7c568831SAndroid Build Coastguard Worker<code>apos</code>,
29*7c568831SAndroid Build Coastguard Worker<code>quot</code>">
30*7c568831SAndroid Build Coastguard Worker<!-- audience and distribution status:  for use at publication time --><!ENTITY doc.audience "public review and discussion">
31*7c568831SAndroid Build Coastguard Worker<!ENTITY doc.distribution "may be distributed freely, as long as
32*7c568831SAndroid Build Coastguard Workerall text and legal notices remain intact">
33*7c568831SAndroid Build Coastguard Worker]>
34*7c568831SAndroid Build Coastguard Worker<!-- for Panorama *-->
35*7c568831SAndroid Build Coastguard Worker<?VERBATIM "eg" ?>
36*7c568831SAndroid Build Coastguard Worker<spec>
37*7c568831SAndroid Build Coastguard Worker<header>
38*7c568831SAndroid Build Coastguard Worker<title>Extensible Markup Language (XML) 1.0</title>
39*7c568831SAndroid Build Coastguard Worker<version/>
40*7c568831SAndroid Build Coastguard Worker<w3c-designation>REC-xml-&iso6.doc.date;</w3c-designation>
41*7c568831SAndroid Build Coastguard Worker<w3c-doctype>W3C Recommendation</w3c-doctype>
42*7c568831SAndroid Build Coastguard Worker<pubdate><day>&draft.day;</day><month>&draft.month;</month><year>&draft.year;</year></pubdate>
43*7c568831SAndroid Build Coastguard Worker
44*7c568831SAndroid Build Coastguard Worker<publoc>
45*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;">
46*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;</loc>
47*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.xml">
48*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.xml</loc>
49*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.html">
50*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.html</loc>
51*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.pdf">
52*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.pdf</loc>
53*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.ps">
54*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/1998/REC-xml-&iso6.doc.date;.ps</loc>
55*7c568831SAndroid Build Coastguard Worker</publoc>
56*7c568831SAndroid Build Coastguard Worker<latestloc>
57*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/REC-xml">
58*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/REC-xml</loc>
59*7c568831SAndroid Build Coastguard Worker</latestloc>
60*7c568831SAndroid Build Coastguard Worker<prevlocs>
61*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/PR-xml-971208">
62*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/PR-xml-971208</loc>
63*7c568831SAndroid Build Coastguard Worker<!--
64*7c568831SAndroid Build Coastguard Worker<loc  href='http://www.w3.org/TR/WD-xml-961114'>
65*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/WD-xml-961114</loc>
66*7c568831SAndroid Build Coastguard Worker<loc  href='http://www.w3.org/TR/WD-xml-lang-970331'>
67*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/WD-xml-lang-970331</loc>
68*7c568831SAndroid Build Coastguard Worker<loc  href='http://www.w3.org/TR/WD-xml-lang-970630'>
69*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/WD-xml-lang-970630</loc>
70*7c568831SAndroid Build Coastguard Worker<loc  href='http://www.w3.org/TR/WD-xml-970807'>
71*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/WD-xml-970807</loc>
72*7c568831SAndroid Build Coastguard Worker<loc  href='http://www.w3.org/TR/WD-xml-971117'>
73*7c568831SAndroid Build Coastguard Workerhttp://www.w3.org/TR/WD-xml-971117</loc>-->
74*7c568831SAndroid Build Coastguard Worker</prevlocs>
75*7c568831SAndroid Build Coastguard Worker<authlist>
76*7c568831SAndroid Build Coastguard Worker<author><name>Tim Bray</name>
77*7c568831SAndroid Build Coastguard Worker<affiliation>Textuality and Netscape</affiliation>
78*7c568831SAndroid Build Coastguard Worker<email href="mailto:[email protected]">[email protected]</email></author>
79*7c568831SAndroid Build Coastguard Worker<author><name>Jean Paoli</name>
80*7c568831SAndroid Build Coastguard Worker<affiliation>Microsoft</affiliation>
81*7c568831SAndroid Build Coastguard Worker<email href="mailto:[email protected]">[email protected]</email></author>
82*7c568831SAndroid Build Coastguard Worker<author><name>C. M. Sperberg-McQueen</name>
83*7c568831SAndroid Build Coastguard Worker<affiliation>University of Illinois at Chicago</affiliation>
84*7c568831SAndroid Build Coastguard Worker<email href="mailto:[email protected]">[email protected]</email></author>
85*7c568831SAndroid Build Coastguard Worker</authlist>
86*7c568831SAndroid Build Coastguard Worker<abstract>
87*7c568831SAndroid Build Coastguard Worker<p>The Extensible Markup Language (XML) is a subset of
88*7c568831SAndroid Build Coastguard WorkerSGML that is completely described in this document. Its goal is to
89*7c568831SAndroid Build Coastguard Workerenable generic SGML to be served, received, and processed on the Web
90*7c568831SAndroid Build Coastguard Workerin the way that is now possible with HTML. XML has been designed for
91*7c568831SAndroid Build Coastguard Workerease of implementation and for interoperability with both SGML and
92*7c568831SAndroid Build Coastguard WorkerHTML.</p>
93*7c568831SAndroid Build Coastguard Worker</abstract>
94*7c568831SAndroid Build Coastguard Worker<status>
95*7c568831SAndroid Build Coastguard Worker<p>This document has been reviewed by W3C Members and
96*7c568831SAndroid Build Coastguard Workerother interested parties and has been endorsed by the
97*7c568831SAndroid Build Coastguard WorkerDirector as a W3C Recommendation. It is a stable
98*7c568831SAndroid Build Coastguard Workerdocument and may be used as reference material or cited
99*7c568831SAndroid Build Coastguard Workeras a normative reference from another document. W3C's
100*7c568831SAndroid Build Coastguard Workerrole in making the Recommendation is to draw attention
101*7c568831SAndroid Build Coastguard Workerto the specification and to promote its widespread
102*7c568831SAndroid Build Coastguard Workerdeployment. This enhances the functionality and
103*7c568831SAndroid Build Coastguard Workerinteroperability of the Web.</p>
104*7c568831SAndroid Build Coastguard Worker<p>
105*7c568831SAndroid Build Coastguard WorkerThis document specifies a syntax created by subsetting an existing,
106*7c568831SAndroid Build Coastguard Workerwidely used international text processing standard (Standard
107*7c568831SAndroid Build Coastguard WorkerGeneralized Markup Language, ISO 8879:1986(E) as amended and
108*7c568831SAndroid Build Coastguard Workercorrected) for use on the World Wide Web.  It is a product of the W3C
109*7c568831SAndroid Build Coastguard WorkerXML Activity, details of which can be found at <loc href="http://www.w3.org/XML">http://www.w3.org/XML</loc>.  A list of
110*7c568831SAndroid Build Coastguard Workercurrent W3C Recommendations and other technical documents can be found
111*7c568831SAndroid Build Coastguard Workerat <loc href="http://www.w3.org/TR">http://www.w3.org/TR</loc>.
112*7c568831SAndroid Build Coastguard Worker</p>
113*7c568831SAndroid Build Coastguard Worker<p>This specification uses the term URI, which is defined by <bibref ref="Berners-Lee"/>, a work in progress expected to update <bibref ref="RFC1738"/> and <bibref ref="RFC1808"/>.
114*7c568831SAndroid Build Coastguard Worker</p>
115*7c568831SAndroid Build Coastguard Worker<p>The list of known errors in this specification is
116*7c568831SAndroid Build Coastguard Workeravailable at
117*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/XML/xml-19980210-errata">http://www.w3.org/XML/xml-19980210-errata</loc>.</p>
118*7c568831SAndroid Build Coastguard Worker<p>Please report errors in this document to
119*7c568831SAndroid Build Coastguard Worker<loc href="mailto:[email protected]">[email protected]</loc>.
120*7c568831SAndroid Build Coastguard Worker</p>
121*7c568831SAndroid Build Coastguard Worker</status>
122*7c568831SAndroid Build Coastguard Worker
123*7c568831SAndroid Build Coastguard Worker
124*7c568831SAndroid Build Coastguard Worker<pubstmt>
125*7c568831SAndroid Build Coastguard Worker<p>Chicago, Vancouver, Mountain View, et al.:
126*7c568831SAndroid Build Coastguard WorkerWorld-Wide Web Consortium, XML Working Group, 1996, 1997.</p>
127*7c568831SAndroid Build Coastguard Worker</pubstmt>
128*7c568831SAndroid Build Coastguard Worker<sourcedesc>
129*7c568831SAndroid Build Coastguard Worker<p>Created in electronic form.</p>
130*7c568831SAndroid Build Coastguard Worker</sourcedesc>
131*7c568831SAndroid Build Coastguard Worker<langusage>
132*7c568831SAndroid Build Coastguard Worker<language id="EN">English</language>
133*7c568831SAndroid Build Coastguard Worker<language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>
134*7c568831SAndroid Build Coastguard Worker</langusage>
135*7c568831SAndroid Build Coastguard Worker<revisiondesc>
136*7c568831SAndroid Build Coastguard Worker<slist>
137*7c568831SAndroid Build Coastguard Worker<sitem>1997-12-03 : CMSMcQ : yet further changes</sitem>
138*7c568831SAndroid Build Coastguard Worker<sitem>1997-12-02 : TB : further changes (see TB to XML WG,
139*7c568831SAndroid Build Coastguard Worker2 December 1997)</sitem>
140*7c568831SAndroid Build Coastguard Worker<sitem>1997-12-02 : CMSMcQ : deal with as many corrections and
141*7c568831SAndroid Build Coastguard Workercomments from the proofreaders as possible:
142*7c568831SAndroid Build Coastguard Workerentify hard-coded document date in pubdate element,
143*7c568831SAndroid Build Coastguard Workerchange expansion of entity WebSGML,
144*7c568831SAndroid Build Coastguard Workerupdate status description as per Dan Connolly (am not sure
145*7c568831SAndroid Build Coastguard Workerabout refernece to Berners-Lee et al.),
146*7c568831SAndroid Build Coastguard Workeradd 'The' to abstract as per WG decision,
147*7c568831SAndroid Build Coastguard Workermove Relationship to Existing Standards to back matter and
148*7c568831SAndroid Build Coastguard Workercombine with References,
149*7c568831SAndroid Build Coastguard Workerre-order back matter so normative appendices come first,
150*7c568831SAndroid Build Coastguard Workerre-tag back matter so informative appendices are tagged informdiv1,
151*7c568831SAndroid Build Coastguard Workerremove XXX XXX from list of 'normative' specs in prose,
152*7c568831SAndroid Build Coastguard Workermove some references from Other References to Normative References,
153*7c568831SAndroid Build Coastguard Workeradd RFC 1738, 1808, and 2141 to Other References (they are not
154*7c568831SAndroid Build Coastguard Workernormative since we do not require the processor to enforce any
155*7c568831SAndroid Build Coastguard Workerrules based on them),
156*7c568831SAndroid Build Coastguard Workeradd reference to 'Fielding draft' (Berners-Lee et al.),
157*7c568831SAndroid Build Coastguard Workermove notation section to end of body,
158*7c568831SAndroid Build Coastguard Workerdrop URIchar non-terminal and use SkipLit instead,
159*7c568831SAndroid Build Coastguard Workerlose stray reference to defunct nonterminal 'markupdecls',
160*7c568831SAndroid Build Coastguard Workermove reference to Aho et al. into appendix (Tim's right),
161*7c568831SAndroid Build Coastguard Workeradd prose note saying that hash marks and fragment identifiers are
162*7c568831SAndroid Build Coastguard WorkerNOT part of the URI formally speaking, and are NOT legal in
163*7c568831SAndroid Build Coastguard Workersystem identifiers (processor 'may' signal an error).
164*7c568831SAndroid Build Coastguard WorkerWork through:
165*7c568831SAndroid Build Coastguard WorkerTim Bray reacting to James Clark,
166*7c568831SAndroid Build Coastguard WorkerTim Bray on his own,
167*7c568831SAndroid Build Coastguard WorkerEve Maler,
168*7c568831SAndroid Build Coastguard Worker
169*7c568831SAndroid Build Coastguard WorkerNOT DONE YET:
170*7c568831SAndroid Build Coastguard Workerchange binary / text to unparsed / parsed.
171*7c568831SAndroid Build Coastguard Workerhandle James's suggestion about &lt; in attriubte values
172*7c568831SAndroid Build Coastguard Workeruppercase hex characters,
173*7c568831SAndroid Build Coastguard Workernamechar list,
174*7c568831SAndroid Build Coastguard Worker</sitem>
175*7c568831SAndroid Build Coastguard Worker<sitem>1997-12-01 : JB : add some column-width parameters</sitem>
176*7c568831SAndroid Build Coastguard Worker<sitem>1997-12-01 : CMSMcQ : begin round of changes to incorporate
177*7c568831SAndroid Build Coastguard Workerrecent WG decisions and other corrections:
178*7c568831SAndroid Build Coastguard Workerbinding sources of character encoding info (27 Aug / 3 Sept),
179*7c568831SAndroid Build Coastguard Workercorrect wording of Faust quotation (restore dropped line),
180*7c568831SAndroid Build Coastguard Workerdrop SDD from EncodingDecl,
181*7c568831SAndroid Build Coastguard Workerchange text at version number 1.0,
182*7c568831SAndroid Build Coastguard Workerdrop misleading (wrong!) sentence about ignorables and extenders,
183*7c568831SAndroid Build Coastguard Workermodify definition of PCData to make bar on msc grammatical,
184*7c568831SAndroid Build Coastguard Workerchange grammar's handling of internal subset (drop non-terminal markupdecls),
185*7c568831SAndroid Build Coastguard Workerchange definition of includeSect to allow conditional sections,
186*7c568831SAndroid Build Coastguard Workeradd integral-declaration constraint on internal subset,
187*7c568831SAndroid Build Coastguard Workerdrop misleading / dangerous sentence about relationship of
188*7c568831SAndroid Build Coastguard Workerentities with system storage objects,
189*7c568831SAndroid Build Coastguard Workerchange table body tag to htbody as per EM change to DTD,
190*7c568831SAndroid Build Coastguard Workeradd rule about space normalization in public identifiers,
191*7c568831SAndroid Build Coastguard Workeradd description of how to generate our name-space rules from
192*7c568831SAndroid Build Coastguard WorkerUnicode character database (needs further work!).
193*7c568831SAndroid Build Coastguard Worker</sitem>
194*7c568831SAndroid Build Coastguard Worker<sitem>1997-10-08 : TB : Removed %-constructs again, new rules
195*7c568831SAndroid Build Coastguard Workerfor PE appearance.</sitem>
196*7c568831SAndroid Build Coastguard Worker<sitem>1997-10-01 : TB : Case-sensitive markup; cleaned up
197*7c568831SAndroid Build Coastguard Workerelement-type defs, lotsa little edits for style</sitem>
198*7c568831SAndroid Build Coastguard Worker<sitem>1997-09-25 : TB : Change to elm's new DTD, with
199*7c568831SAndroid Build Coastguard Workersubstantial detail cleanup as a side-effect</sitem>
200*7c568831SAndroid Build Coastguard Worker<sitem>1997-07-24 : CMSMcQ : correct error (lost *) in definition
201*7c568831SAndroid Build Coastguard Workerof ignoreSectContents (thanks to Makoto Murata)</sitem>
202*7c568831SAndroid Build Coastguard Worker<sitem>Allow all empty elements to have end-tags, consistent with
203*7c568831SAndroid Build Coastguard WorkerSGML TC (as per JJC).</sitem>
204*7c568831SAndroid Build Coastguard Worker<sitem>1997-07-23 : CMSMcQ : pre-emptive strike on pending corrections:
205*7c568831SAndroid Build Coastguard Workerintroduce the term 'empty-element tag', note that all empty elements
206*7c568831SAndroid Build Coastguard Workermay use it, and elements declared EMPTY must use it.
207*7c568831SAndroid Build Coastguard WorkerAdd WFC requiring encoding decl to come first in an entity.
208*7c568831SAndroid Build Coastguard WorkerRedefine notations to point to PIs as well as binary entities.
209*7c568831SAndroid Build Coastguard WorkerChange autodetection table by removing bytes 3 and 4 from
210*7c568831SAndroid Build Coastguard Workerexamples with Byte Order Mark.
211*7c568831SAndroid Build Coastguard WorkerAdd content model as a term and clarify that it applies to both
212*7c568831SAndroid Build Coastguard Workermixed and element content.
213*7c568831SAndroid Build Coastguard Worker</sitem>
214*7c568831SAndroid Build Coastguard Worker<sitem>1997-06-30 : CMSMcQ : change date, some cosmetic changes,
215*7c568831SAndroid Build Coastguard Workerchanges to productions for choice, seq, Mixed, NotationType,
216*7c568831SAndroid Build Coastguard WorkerEnumeration.  Follow James Clark's suggestion and prohibit
217*7c568831SAndroid Build Coastguard Workerconditional sections in internal subset.  TO DO:  simplify
218*7c568831SAndroid Build Coastguard Workerproduction for ignored sections as a result, since we don't
219*7c568831SAndroid Build Coastguard Workerneed to worry about parsers which don't expand PErefs finding
220*7c568831SAndroid Build Coastguard Workera conditional section.</sitem>
221*7c568831SAndroid Build Coastguard Worker<sitem>1997-06-29 : TB : various edits</sitem>
222*7c568831SAndroid Build Coastguard Worker<sitem>1997-06-29 : CMSMcQ : further changes:
223*7c568831SAndroid Build Coastguard WorkerSuppress old FINAL EDIT comments and some dead material.
224*7c568831SAndroid Build Coastguard WorkerRevise occurrences of % in grammar to exploit Henry Thompson's pun,
225*7c568831SAndroid Build Coastguard Workerespecially markupdecl and attdef.
226*7c568831SAndroid Build Coastguard WorkerRemove RMD requirement relating to element content (?).
227*7c568831SAndroid Build Coastguard Worker</sitem>
228*7c568831SAndroid Build Coastguard Worker<sitem>1997-06-28 : CMSMcQ : Various changes for 1 July draft:
229*7c568831SAndroid Build Coastguard WorkerAdd text for draconian error handling (introduce
230*7c568831SAndroid Build Coastguard Workerthe term Fatal Error).
231*7c568831SAndroid Build Coastguard WorkerRE deleta est (changing wording from
232*7c568831SAndroid Build Coastguard Workeroriginal announcement to restrict the requirement to validating
233*7c568831SAndroid Build Coastguard Workerparsers).
234*7c568831SAndroid Build Coastguard WorkerTag definition of validating processor and link to it.
235*7c568831SAndroid Build Coastguard WorkerAdd colon as name character.
236*7c568831SAndroid Build Coastguard WorkerChange def of %operator.
237*7c568831SAndroid Build Coastguard WorkerChange standard definitions of lt, gt, amp.
238*7c568831SAndroid Build Coastguard WorkerStrip leading zeros from #x00nn forms.</sitem>
239*7c568831SAndroid Build Coastguard Worker<sitem>1997-04-02 : CMSMcQ : final corrections of editorial errors
240*7c568831SAndroid Build Coastguard Workerfound in last night's proofreading.  Reverse course once more on
241*7c568831SAndroid Build Coastguard Workerwell-formed:   Webster's Second hyphenates it, and that's enough
242*7c568831SAndroid Build Coastguard Workerfor me.</sitem>
243*7c568831SAndroid Build Coastguard Worker<sitem>1997-04-01 : CMSMcQ : corrections from JJC, EM, HT, and self</sitem>
244*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-31 : Tim Bray : many changes</sitem>
245*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-29 : CMSMcQ : some Henry Thompson (on entity handling),
246*7c568831SAndroid Build Coastguard Workersome Charles Goldfarb, some ERB decisions (PE handling in miscellaneous
247*7c568831SAndroid Build Coastguard Workerdeclarations.  Changed Ident element to accept def attribute.
248*7c568831SAndroid Build Coastguard WorkerAllow normalization of Unicode characters.  move def of systemliteral
249*7c568831SAndroid Build Coastguard Workerinto section on literals.</sitem>
250*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-28 : CMSMcQ : make as many corrections as possible, from
251*7c568831SAndroid Build Coastguard WorkerTerry Allen, Norbert Mikula, James Clark, Jon Bosak, Henry Thompson,
252*7c568831SAndroid Build Coastguard WorkerPaul Grosso, and self.  Among other things:  give in on "well formed"
253*7c568831SAndroid Build Coastguard Worker(Terry is right), tentatively rename QuotedCData as AttValue
254*7c568831SAndroid Build Coastguard Workerand Literal as EntityValue to be more informative, since attribute
255*7c568831SAndroid Build Coastguard Workervalues are the <emph>only</emph> place QuotedCData was used, and
256*7c568831SAndroid Build Coastguard Workervice versa for entity text and Literal. (I'd call it Entity Text,
257*7c568831SAndroid Build Coastguard Workerbut 8879 uses that name for both internal and external entities.)</sitem>
258*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-26 : CMSMcQ : resynch the two forks of this draft, reapply
259*7c568831SAndroid Build Coastguard Workermy changes dated 03-20 and 03-21.  Normalize old 'may not' to 'must not'
260*7c568831SAndroid Build Coastguard Workerexcept in the one case where it meant 'may or may not'.</sitem>
261*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-21 : TB : massive changes on plane flight from Chicago
262*7c568831SAndroid Build Coastguard Workerto Vancouver</sitem>
263*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-21 : CMSMcQ : correct as many reported errors as possible.
264*7c568831SAndroid Build Coastguard Worker</sitem>
265*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-20 : CMSMcQ : correct typos listed in CMSMcQ hand copy of spec.</sitem>
266*7c568831SAndroid Build Coastguard Worker<sitem>1997-03-20 : CMSMcQ : cosmetic changes preparatory to revision for
267*7c568831SAndroid Build Coastguard WorkerWWW conference April 1997:  restore some of the internal entity
268*7c568831SAndroid Build Coastguard Workerreferences (e.g. to docdate, etc.), change character xA0 to &amp;nbsp;
269*7c568831SAndroid Build Coastguard Workerand define nbsp as &amp;#160;, and refill a lot of paragraphs for
270*7c568831SAndroid Build Coastguard Workerlegibility.</sitem>
271*7c568831SAndroid Build Coastguard Worker<sitem>1996-11-12 : CMSMcQ : revise using Tim's edits:
272*7c568831SAndroid Build Coastguard WorkerAdd list type of NUMBERED and change most lists either to
273*7c568831SAndroid Build Coastguard WorkerBULLETS or to NUMBERED.
274*7c568831SAndroid Build Coastguard WorkerSuppress QuotedNames, Names (not used).
275*7c568831SAndroid Build Coastguard WorkerCorrect trivial-grammar doc type decl.
276*7c568831SAndroid Build Coastguard WorkerRename 'marked section' as 'CDATA section' passim.
277*7c568831SAndroid Build Coastguard WorkerAlso edits from James Clark:
278*7c568831SAndroid Build Coastguard WorkerDefine the set of characters from which [^abc] subtracts.
279*7c568831SAndroid Build Coastguard WorkerCharref should use just [0-9] not Digit.
280*7c568831SAndroid Build Coastguard WorkerLocation info needs cleaner treatment:  remove?  (ERB
281*7c568831SAndroid Build Coastguard Workerquestion).
282*7c568831SAndroid Build Coastguard WorkerOne example of a PI has wrong pic.
283*7c568831SAndroid Build Coastguard WorkerClarify discussion of encoding names.
284*7c568831SAndroid Build Coastguard WorkerEncoding failure should lead to unspecified results; don't
285*7c568831SAndroid Build Coastguard Workerprescribe error recovery.
286*7c568831SAndroid Build Coastguard WorkerDon't require exposure of entity boundaries.
287*7c568831SAndroid Build Coastguard WorkerIgnore white space in element content.
288*7c568831SAndroid Build Coastguard WorkerReserve entity names of the form u-NNNN.
289*7c568831SAndroid Build Coastguard WorkerClarify relative URLs.
290*7c568831SAndroid Build Coastguard WorkerAnd some of my own:
291*7c568831SAndroid Build Coastguard WorkerCorrect productions for content model:  model cannot
292*7c568831SAndroid Build Coastguard Workerconsist of a name, so "elements ::= cp" is no good.
293*7c568831SAndroid Build Coastguard Worker</sitem>
294*7c568831SAndroid Build Coastguard Worker<sitem>1996-11-11 : CMSMcQ : revise for style.
295*7c568831SAndroid Build Coastguard WorkerAdd new rhs to entity declaration, for parameter entities.</sitem>
296*7c568831SAndroid Build Coastguard Worker<sitem>1996-11-10 : CMSMcQ : revise for style.
297*7c568831SAndroid Build Coastguard WorkerFix / complete section on names, characters.
298*7c568831SAndroid Build Coastguard WorkerAdd sections on parameter entities, conditional sections.
299*7c568831SAndroid Build Coastguard WorkerStill to do:  Add compatibility note on deterministic content models.
300*7c568831SAndroid Build Coastguard WorkerFinish stylistic revision.</sitem>
301*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-31 : TB : Add Entity Handling section</sitem>
302*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-30 : TB : Clean up term &amp; termdef.  Slip in
303*7c568831SAndroid Build Coastguard WorkerERB decision re EMPTY.</sitem>
304*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-28 : TB : Change DTD.  Implement some of Michael's
305*7c568831SAndroid Build Coastguard Workersuggestions.  Change comments back to //.  Introduce language for
306*7c568831SAndroid Build Coastguard WorkerXML namespace reservation.  Add section on white-space handling.
307*7c568831SAndroid Build Coastguard WorkerLots more cleanup.</sitem>
308*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-24 : CMSMcQ : quick tweaks, implement some ERB
309*7c568831SAndroid Build Coastguard Workerdecisions.  Characters are not integers.  Comments are /* */ not //.
310*7c568831SAndroid Build Coastguard WorkerAdd bibliographic refs to 10646, HyTime, Unicode.
311*7c568831SAndroid Build Coastguard WorkerRename old Cdata as MsData since it's <emph>only</emph> seen
312*7c568831SAndroid Build Coastguard Workerin marked sections.  Call them attribute-value pairs not
313*7c568831SAndroid Build Coastguard Workername-value pairs, except once.  Internal subset is optional, needs
314*7c568831SAndroid Build Coastguard Worker'?'.  Implied attributes should be signaled to the app, not
315*7c568831SAndroid Build Coastguard Workerhave values supplied by processor.</sitem>
316*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-16 : TB : track down &amp; excise all DSD references;
317*7c568831SAndroid Build Coastguard Workerintroduce some EBNF for entity declarations.</sitem>
318*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-?? : TB : consistency check, fix up scraps so
319*7c568831SAndroid Build Coastguard Workerthey all parse, get formatter working, correct a few productions.</sitem>
320*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-10/11 : CMSMcQ : various maintenance, stylistic, and
321*7c568831SAndroid Build Coastguard Workerorganizational changes:
322*7c568831SAndroid Build Coastguard WorkerReplace a few literals with xmlpio and
323*7c568831SAndroid Build Coastguard Workerpic entities, to make them consistent and ensure we can change pic
324*7c568831SAndroid Build Coastguard Workerreliably when the ERB votes.
325*7c568831SAndroid Build Coastguard WorkerDrop paragraph on recognizers from notation section.
326*7c568831SAndroid Build Coastguard WorkerAdd match, exact match to terminology.
327*7c568831SAndroid Build Coastguard WorkerMove old 2.2 XML Processors and Apps into intro.
328*7c568831SAndroid Build Coastguard WorkerMention comments, PIs, and marked sections in discussion of
329*7c568831SAndroid Build Coastguard Workerdelimiter escaping.
330*7c568831SAndroid Build Coastguard WorkerStreamline discussion of doctype decl syntax.
331*7c568831SAndroid Build Coastguard WorkerDrop old section of 'PI syntax' for doctype decl, and add
332*7c568831SAndroid Build Coastguard Workersection on partial-DTD summary PIs to end of Logical Structures
333*7c568831SAndroid Build Coastguard Workersection.
334*7c568831SAndroid Build Coastguard WorkerRevise DSD syntax section to use Tim's subset-in-a-PI
335*7c568831SAndroid Build Coastguard Workermechanism.</sitem>
336*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-10 : TB : eliminate name recognizers (and more?)</sitem>
337*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-09 : CMSMcQ : revise for style, consistency through 2.3
338*7c568831SAndroid Build Coastguard Worker(Characters)</sitem>
339*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-09 : CMSMcQ : re-unite everything for convenience,
340*7c568831SAndroid Build Coastguard Workerat least temporarily, and revise quickly</sitem>
341*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-08 : TB : first major homogenization pass</sitem>
342*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-08 : TB : turn "current" attribute on div type into
343*7c568831SAndroid Build Coastguard WorkerCDATA</sitem>
344*7c568831SAndroid Build Coastguard Worker<sitem>1996-10-02 : TB : remould into skeleton + entities</sitem>
345*7c568831SAndroid Build Coastguard Worker<sitem>1996-09-30 : CMSMcQ : add a few more sections prior to exchange
346*7c568831SAndroid Build Coastguard Worker                            with Tim.</sitem>
347*7c568831SAndroid Build Coastguard Worker<sitem>1996-09-20 : CMSMcQ : finish transcribing notes.</sitem>
348*7c568831SAndroid Build Coastguard Worker<sitem>1996-09-19 : CMSMcQ : begin transcribing notes for draft.</sitem>
349*7c568831SAndroid Build Coastguard Worker<sitem>1996-09-13 : CMSMcQ : made outline from notes of 09-06,
350*7c568831SAndroid Build Coastguard Workerdo some housekeeping</sitem>
351*7c568831SAndroid Build Coastguard Worker</slist>
352*7c568831SAndroid Build Coastguard Worker</revisiondesc>
353*7c568831SAndroid Build Coastguard Worker</header>
354*7c568831SAndroid Build Coastguard Worker<body>
355*7c568831SAndroid Build Coastguard Worker<div1 id="sec-intro">
356*7c568831SAndroid Build Coastguard Worker<head>Introduction</head>
357*7c568831SAndroid Build Coastguard Worker<p>Extensible Markup Language, abbreviated XML, describes a class of
358*7c568831SAndroid Build Coastguard Workerdata objects called <termref def="dt-xml-doc">XML documents</termref> and
359*7c568831SAndroid Build Coastguard Workerpartially describes the behavior of
360*7c568831SAndroid Build Coastguard Workercomputer programs which process them. XML is an application profile or
361*7c568831SAndroid Build Coastguard Workerrestricted form of SGML, the Standard Generalized Markup
362*7c568831SAndroid Build Coastguard WorkerLanguage <bibref ref="ISO8879"/>.
363*7c568831SAndroid Build Coastguard WorkerBy construction, XML documents
364*7c568831SAndroid Build Coastguard Workerare conforming SGML documents.
365*7c568831SAndroid Build Coastguard Worker</p>
366*7c568831SAndroid Build Coastguard Worker<p>XML documents are made up of storage units called <termref def="dt-entity">entities</termref>, which contain either parsed
367*7c568831SAndroid Build Coastguard Workeror unparsed data.
368*7c568831SAndroid Build Coastguard WorkerParsed data is made up of <termref def="dt-character">characters</termref>,
369*7c568831SAndroid Build Coastguard Workersome
370*7c568831SAndroid Build Coastguard Workerof which form <termref def="dt-chardata">character data</termref>,
371*7c568831SAndroid Build Coastguard Workerand some of which form <termref def="dt-markup">markup</termref>.
372*7c568831SAndroid Build Coastguard WorkerMarkup encodes a description of the document's storage layout and
373*7c568831SAndroid Build Coastguard Workerlogical structure. XML provides a mechanism to impose constraints on
374*7c568831SAndroid Build Coastguard Workerthe storage layout and logical structure.</p>
375*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-xml-proc" term="XML Processor">A software module
376*7c568831SAndroid Build Coastguard Workercalled an <term>XML processor</term> is used to read XML documents
377*7c568831SAndroid Build Coastguard Workerand provide access to their content and structure.</termdef> <termdef id="dt-app" term="Application">It is assumed that an XML processor is
378*7c568831SAndroid Build Coastguard Workerdoing its work on behalf of another module, called the
379*7c568831SAndroid Build Coastguard Worker<term>application</term>.</termdef> This specification describes the
380*7c568831SAndroid Build Coastguard Workerrequired behavior of an XML processor in terms of how it must read XML
381*7c568831SAndroid Build Coastguard Workerdata and the information it must provide to the application.</p>
382*7c568831SAndroid Build Coastguard Worker
383*7c568831SAndroid Build Coastguard Worker<div2 id="sec-origin-goals">
384*7c568831SAndroid Build Coastguard Worker<head>Origin and Goals</head>
385*7c568831SAndroid Build Coastguard Worker<p>XML was developed by an XML Working Group (originally known as the
386*7c568831SAndroid Build Coastguard WorkerSGML Editorial Review Board) formed under the auspices of the World
387*7c568831SAndroid Build Coastguard WorkerWide Web Consortium (W3C) in 1996.
388*7c568831SAndroid Build Coastguard WorkerIt was chaired by Jon Bosak of Sun
389*7c568831SAndroid Build Coastguard WorkerMicrosystems with the active participation of an XML Special
390*7c568831SAndroid Build Coastguard WorkerInterest Group (previously known as the SGML Working Group) also
391*7c568831SAndroid Build Coastguard Workerorganized by the W3C. The membership of the XML Working Group is given
392*7c568831SAndroid Build Coastguard Workerin an appendix. Dan Connolly served as the WG's contact with the W3C.
393*7c568831SAndroid Build Coastguard Worker</p>
394*7c568831SAndroid Build Coastguard Worker<p>The design goals for XML are:<olist>
395*7c568831SAndroid Build Coastguard Worker<item><p>XML shall be straightforwardly usable over the
396*7c568831SAndroid Build Coastguard WorkerInternet.</p></item>
397*7c568831SAndroid Build Coastguard Worker<item><p>XML shall support a wide variety of applications.</p></item>
398*7c568831SAndroid Build Coastguard Worker<item><p>XML shall be compatible with SGML.</p></item>
399*7c568831SAndroid Build Coastguard Worker<item><p>It shall be easy to write programs which process XML
400*7c568831SAndroid Build Coastguard Workerdocuments.</p></item>
401*7c568831SAndroid Build Coastguard Worker<item><p>The number of optional features in XML is to be kept to the
402*7c568831SAndroid Build Coastguard Workerabsolute minimum, ideally zero.</p></item>
403*7c568831SAndroid Build Coastguard Worker<item><p>XML documents should be human-legible and reasonably
404*7c568831SAndroid Build Coastguard Workerclear.</p></item>
405*7c568831SAndroid Build Coastguard Worker<item><p>The XML design should be prepared quickly.</p></item>
406*7c568831SAndroid Build Coastguard Worker<item><p>The design of XML shall be formal and concise.</p></item>
407*7c568831SAndroid Build Coastguard Worker<item><p>XML documents shall be easy to create.</p></item>
408*7c568831SAndroid Build Coastguard Worker<item><p>Terseness in XML markup is of minimal importance.</p></item></olist>
409*7c568831SAndroid Build Coastguard Worker</p>
410*7c568831SAndroid Build Coastguard Worker<p>This specification,
411*7c568831SAndroid Build Coastguard Workertogether with associated standards
412*7c568831SAndroid Build Coastguard Worker(Unicode and ISO/IEC 10646 for characters,
413*7c568831SAndroid Build Coastguard WorkerInternet RFC 1766 for language identification tags,
414*7c568831SAndroid Build Coastguard WorkerISO 639 for language name codes, and
415*7c568831SAndroid Build Coastguard WorkerISO 3166 for country name codes),
416*7c568831SAndroid Build Coastguard Workerprovides all the information necessary to understand
417*7c568831SAndroid Build Coastguard WorkerXML Version &XML.version;
418*7c568831SAndroid Build Coastguard Workerand construct computer programs to process it.</p>
419*7c568831SAndroid Build Coastguard Worker<p>This version of the XML specification
420*7c568831SAndroid Build Coastguard Worker<!-- is for &doc.audience;.-->
421*7c568831SAndroid Build Coastguard Worker&doc.distribution;.</p>
422*7c568831SAndroid Build Coastguard Worker
423*7c568831SAndroid Build Coastguard Worker</div2>
424*7c568831SAndroid Build Coastguard Worker
425*7c568831SAndroid Build Coastguard Worker
426*7c568831SAndroid Build Coastguard Worker
427*7c568831SAndroid Build Coastguard Worker
428*7c568831SAndroid Build Coastguard Worker<div2 id="sec-terminology">
429*7c568831SAndroid Build Coastguard Worker<head>Terminology</head>
430*7c568831SAndroid Build Coastguard Worker
431*7c568831SAndroid Build Coastguard Worker<p>The terminology used to describe XML documents is defined in the body of
432*7c568831SAndroid Build Coastguard Workerthis specification.
433*7c568831SAndroid Build Coastguard WorkerThe terms defined in the following list are used in building those
434*7c568831SAndroid Build Coastguard Workerdefinitions and in describing the actions of an XML processor:
435*7c568831SAndroid Build Coastguard Worker<glist>
436*7c568831SAndroid Build Coastguard Worker<gitem>
437*7c568831SAndroid Build Coastguard Worker<label>may</label>
438*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-may" term="May">Conforming documents and XML
439*7c568831SAndroid Build Coastguard Workerprocessors are permitted to but need not behave as
440*7c568831SAndroid Build Coastguard Workerdescribed.</termdef></p></def>
441*7c568831SAndroid Build Coastguard Worker</gitem>
442*7c568831SAndroid Build Coastguard Worker<gitem>
443*7c568831SAndroid Build Coastguard Worker<label>must</label>
444*7c568831SAndroid Build Coastguard Worker<def><p>Conforming documents and XML processors
445*7c568831SAndroid Build Coastguard Workerare required to behave as described; otherwise they are in error.
446*7c568831SAndroid Build Coastguard Worker<!-- do NOT change this! this is what defines a violation of
447*7c568831SAndroid Build Coastguard Workera 'must' clause as 'an error'. -MSM -->
448*7c568831SAndroid Build Coastguard Worker</p></def>
449*7c568831SAndroid Build Coastguard Worker</gitem>
450*7c568831SAndroid Build Coastguard Worker<gitem>
451*7c568831SAndroid Build Coastguard Worker<label>error</label>
452*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-error" term="Error">A violation of the rules of this
453*7c568831SAndroid Build Coastguard Workerspecification; results are
454*7c568831SAndroid Build Coastguard Workerundefined.  Conforming software may detect and report an error and may
455*7c568831SAndroid Build Coastguard Workerrecover from it.</termdef></p></def>
456*7c568831SAndroid Build Coastguard Worker</gitem>
457*7c568831SAndroid Build Coastguard Worker<gitem>
458*7c568831SAndroid Build Coastguard Worker<label>fatal error</label>
459*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-fatal" term="Fatal Error">An error
460*7c568831SAndroid Build Coastguard Workerwhich a conforming <termref def="dt-xml-proc">XML processor</termref>
461*7c568831SAndroid Build Coastguard Workermust detect and report to the application.
462*7c568831SAndroid Build Coastguard WorkerAfter encountering a fatal error, the
463*7c568831SAndroid Build Coastguard Workerprocessor may continue
464*7c568831SAndroid Build Coastguard Workerprocessing the data to search for further errors and may report such
465*7c568831SAndroid Build Coastguard Workererrors to the application.  In order to support correction of errors,
466*7c568831SAndroid Build Coastguard Workerthe processor may make unprocessed data from the document (with
467*7c568831SAndroid Build Coastguard Workerintermingled character data and markup) available to the application.
468*7c568831SAndroid Build Coastguard WorkerOnce a fatal error is detected, however, the processor must not
469*7c568831SAndroid Build Coastguard Workercontinue normal processing (i.e., it must not
470*7c568831SAndroid Build Coastguard Workercontinue to pass character data and information about the document's
471*7c568831SAndroid Build Coastguard Workerlogical structure to the application in the normal way).
472*7c568831SAndroid Build Coastguard Worker</termdef></p></def>
473*7c568831SAndroid Build Coastguard Worker</gitem>
474*7c568831SAndroid Build Coastguard Worker<gitem>
475*7c568831SAndroid Build Coastguard Worker<label>at user option</label>
476*7c568831SAndroid Build Coastguard Worker<def><p>Conforming software may or must (depending on the modal verb in the
477*7c568831SAndroid Build Coastguard Workersentence) behave as described; if it does, it must
478*7c568831SAndroid Build Coastguard Workerprovide users a means to enable or disable the behavior
479*7c568831SAndroid Build Coastguard Workerdescribed.</p></def>
480*7c568831SAndroid Build Coastguard Worker</gitem>
481*7c568831SAndroid Build Coastguard Worker<gitem>
482*7c568831SAndroid Build Coastguard Worker<label>validity constraint</label>
483*7c568831SAndroid Build Coastguard Worker<def><p>A rule which applies to all
484*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">valid</termref> XML documents.
485*7c568831SAndroid Build Coastguard WorkerViolations of validity constraints are errors; they must, at user option,
486*7c568831SAndroid Build Coastguard Workerbe reported by
487*7c568831SAndroid Build Coastguard Worker<termref def="dt-validating">validating XML processors</termref>.</p></def>
488*7c568831SAndroid Build Coastguard Worker</gitem>
489*7c568831SAndroid Build Coastguard Worker<gitem>
490*7c568831SAndroid Build Coastguard Worker<label>well-formedness constraint</label>
491*7c568831SAndroid Build Coastguard Worker<def><p>A rule which applies to all <termref def="dt-wellformed">well-formed</termref> XML documents.
492*7c568831SAndroid Build Coastguard WorkerViolations of well-formedness constraints are
493*7c568831SAndroid Build Coastguard Worker<termref def="dt-fatal">fatal errors</termref>.</p></def>
494*7c568831SAndroid Build Coastguard Worker</gitem>
495*7c568831SAndroid Build Coastguard Worker
496*7c568831SAndroid Build Coastguard Worker<gitem>
497*7c568831SAndroid Build Coastguard Worker<label>match</label>
498*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-match" term="match">(Of strings or names:)
499*7c568831SAndroid Build Coastguard WorkerTwo strings or names being compared must be identical.
500*7c568831SAndroid Build Coastguard WorkerCharacters with multiple possible representations in ISO/IEC 10646 (e.g.
501*7c568831SAndroid Build Coastguard Workercharacters with
502*7c568831SAndroid Build Coastguard Workerboth precomposed and base+diacritic forms) match only if they have the
503*7c568831SAndroid Build Coastguard Workersame representation in both strings.
504*7c568831SAndroid Build Coastguard WorkerAt user option, processors may normalize such characters to
505*7c568831SAndroid Build Coastguard Workersome canonical form.
506*7c568831SAndroid Build Coastguard WorkerNo case folding is performed.
507*7c568831SAndroid Build Coastguard Worker(Of strings and rules in the grammar:)
508*7c568831SAndroid Build Coastguard WorkerA string matches a grammatical production if it belongs to the
509*7c568831SAndroid Build Coastguard Workerlanguage generated by that production.
510*7c568831SAndroid Build Coastguard Worker(Of content and content models:)
511*7c568831SAndroid Build Coastguard WorkerAn element matches its declaration when it conforms
512*7c568831SAndroid Build Coastguard Workerin the fashion described in the constraint
513*7c568831SAndroid Build Coastguard Worker<specref ref="elementvalid"/>.
514*7c568831SAndroid Build Coastguard Worker</termdef>
515*7c568831SAndroid Build Coastguard Worker</p></def>
516*7c568831SAndroid Build Coastguard Worker</gitem>
517*7c568831SAndroid Build Coastguard Worker<gitem>
518*7c568831SAndroid Build Coastguard Worker<label>for compatibility</label>
519*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-compat" term="For Compatibility">A feature of
520*7c568831SAndroid Build Coastguard WorkerXML included solely to ensure that XML remains compatible with SGML.
521*7c568831SAndroid Build Coastguard Worker</termdef></p></def>
522*7c568831SAndroid Build Coastguard Worker</gitem>
523*7c568831SAndroid Build Coastguard Worker<gitem>
524*7c568831SAndroid Build Coastguard Worker<label>for interoperability</label>
525*7c568831SAndroid Build Coastguard Worker<def><p><termdef id="dt-interop" term="For interoperability">A
526*7c568831SAndroid Build Coastguard Workernon-binding recommendation included to increase the chances that XML
527*7c568831SAndroid Build Coastguard Workerdocuments can be processed by the existing installed base of SGML
528*7c568831SAndroid Build Coastguard Workerprocessors which predate the
529*7c568831SAndroid Build Coastguard Worker&WebSGML;.</termdef></p></def>
530*7c568831SAndroid Build Coastguard Worker</gitem>
531*7c568831SAndroid Build Coastguard Worker</glist>
532*7c568831SAndroid Build Coastguard Worker</p>
533*7c568831SAndroid Build Coastguard Worker</div2>
534*7c568831SAndroid Build Coastguard Worker
535*7c568831SAndroid Build Coastguard Worker
536*7c568831SAndroid Build Coastguard Worker</div1>
537*7c568831SAndroid Build Coastguard Worker<!-- &Docs; -->
538*7c568831SAndroid Build Coastguard Worker
539*7c568831SAndroid Build Coastguard Worker<div1 id="sec-documents">
540*7c568831SAndroid Build Coastguard Worker<head>Documents</head>
541*7c568831SAndroid Build Coastguard Worker
542*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-xml-doc" term="XML Document">
543*7c568831SAndroid Build Coastguard WorkerA data object is an
544*7c568831SAndroid Build Coastguard Worker<term>XML document</term> if it is
545*7c568831SAndroid Build Coastguard Worker<termref def="dt-wellformed">well-formed</termref>, as
546*7c568831SAndroid Build Coastguard Workerdefined in this specification.
547*7c568831SAndroid Build Coastguard WorkerA well-formed XML document may in addition be
548*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">valid</termref> if it meets certain further
549*7c568831SAndroid Build Coastguard Workerconstraints.</termdef></p>
550*7c568831SAndroid Build Coastguard Worker
551*7c568831SAndroid Build Coastguard Worker<p>Each XML document has both a logical and a physical structure.
552*7c568831SAndroid Build Coastguard WorkerPhysically, 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
553*7c568831SAndroid Build Coastguard Workerinclusion in the document. A document begins in a "root"  or <termref def="dt-docent">document entity</termref>.
554*7c568831SAndroid Build Coastguard WorkerLogically, the document is composed of declarations, elements,
555*7c568831SAndroid Build Coastguard Workercomments,
556*7c568831SAndroid Build Coastguard Workercharacter references, and
557*7c568831SAndroid Build Coastguard Workerprocessing
558*7c568831SAndroid Build Coastguard Workerinstructions, all of which are indicated in the document by explicit
559*7c568831SAndroid Build Coastguard Workermarkup.
560*7c568831SAndroid Build Coastguard WorkerThe logical and physical structures must nest properly, as described
561*7c568831SAndroid Build Coastguard Workerin <specref ref="wf-entities"/>.
562*7c568831SAndroid Build Coastguard Worker</p>
563*7c568831SAndroid Build Coastguard Worker
564*7c568831SAndroid Build Coastguard Worker<div2 id="sec-well-formed">
565*7c568831SAndroid Build Coastguard Worker<head>Well-Formed XML Documents</head>
566*7c568831SAndroid Build Coastguard Worker
567*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-wellformed" term="Well-Formed">
568*7c568831SAndroid Build Coastguard WorkerA textual object is
569*7c568831SAndroid Build Coastguard Workera well-formed XML document if:</termdef>
570*7c568831SAndroid Build Coastguard Worker<olist>
571*7c568831SAndroid Build Coastguard Worker<item><p>Taken as a whole, it
572*7c568831SAndroid Build Coastguard Workermatches the production labeled <nt def="NT-document">document</nt>.</p></item>
573*7c568831SAndroid Build Coastguard Worker<item><p>It
574*7c568831SAndroid Build Coastguard Workermeets all the well-formedness constraints given in this specification.</p>
575*7c568831SAndroid Build Coastguard Worker</item>
576*7c568831SAndroid Build Coastguard Worker<item><p>Each of the <termref def="dt-parsedent">parsed entities</termref>
577*7c568831SAndroid Build Coastguard Workerwhich is referenced directly or indirectly within the document is
578*7c568831SAndroid Build Coastguard Worker<titleref href="wf-entities">well-formed</titleref>.</p></item>
579*7c568831SAndroid Build Coastguard Worker</olist></p>
580*7c568831SAndroid Build Coastguard Worker<p>
581*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="document">
582*7c568831SAndroid Build Coastguard Worker<head>Document</head>
583*7c568831SAndroid Build Coastguard Worker<prod id="NT-document"><lhs>document</lhs>
584*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-prolog">prolog</nt>
585*7c568831SAndroid Build Coastguard Worker<nt def="NT-element">element</nt>
586*7c568831SAndroid Build Coastguard Worker<nt def="NT-Misc">Misc</nt>*</rhs></prod>
587*7c568831SAndroid Build Coastguard Worker</scrap>
588*7c568831SAndroid Build Coastguard Worker</p>
589*7c568831SAndroid Build Coastguard Worker<p>Matching the <nt def="NT-document">document</nt> production
590*7c568831SAndroid Build Coastguard Workerimplies that:
591*7c568831SAndroid Build Coastguard Worker<olist>
592*7c568831SAndroid Build Coastguard Worker<item><p>It contains one or more
593*7c568831SAndroid Build Coastguard Worker<termref def="dt-element">elements</termref>.</p>
594*7c568831SAndroid Build Coastguard Worker</item>
595*7c568831SAndroid Build Coastguard Worker<!--* N.B. some readers (notably JC) find the following
596*7c568831SAndroid Build Coastguard Workerparagraph awkward and redundant.  I agree it's logically redundant:
597*7c568831SAndroid Build Coastguard Workerit *says* it is summarizing the logical implications of
598*7c568831SAndroid Build Coastguard Workermatching the grammar, and that means by definition it's
599*7c568831SAndroid Build Coastguard Workerlogically redundant.  I don't think it's rhetorically
600*7c568831SAndroid Build Coastguard Workerredundant or unnecessary, though, so I'm keeping it.  It
601*7c568831SAndroid Build Coastguard Workercould however use some recasting when the editors are feeling
602*7c568831SAndroid Build Coastguard Workerstronger. -MSM *-->
603*7c568831SAndroid Build Coastguard Worker<item><p><termdef id="dt-root" term="Root Element">There is  exactly
604*7c568831SAndroid Build Coastguard Workerone element, called the <term>root</term>, or document element,  no
605*7c568831SAndroid Build Coastguard Workerpart of which appears in the <termref def="dt-content">content</termref> of any other element.</termdef>
606*7c568831SAndroid Build Coastguard WorkerFor all other elements, if the start-tag is in the content of another
607*7c568831SAndroid Build Coastguard Workerelement, the end-tag is in the content of the same element.  More
608*7c568831SAndroid Build Coastguard Workersimply stated, the elements, delimited by start- and end-tags, nest
609*7c568831SAndroid Build Coastguard Workerproperly within each other.
610*7c568831SAndroid Build Coastguard Worker</p></item>
611*7c568831SAndroid Build Coastguard Worker</olist>
612*7c568831SAndroid Build Coastguard Worker</p>
613*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-parentchild" term="Parent/Child">As a consequence
614*7c568831SAndroid Build Coastguard Workerof this,
615*7c568831SAndroid Build Coastguard Workerfor each non-root element
616*7c568831SAndroid Build Coastguard Worker<code>C</code> in the document, there is one other element <code>P</code>
617*7c568831SAndroid Build Coastguard Workerin the document such that
618*7c568831SAndroid Build Coastguard Worker<code>C</code> is in the content of <code>P</code>, but is not in
619*7c568831SAndroid Build Coastguard Workerthe content of any other element that is in the content of
620*7c568831SAndroid Build Coastguard Worker<code>P</code>.
621*7c568831SAndroid Build Coastguard Worker<code>P</code> is referred to as the
622*7c568831SAndroid Build Coastguard Worker<term>parent</term> of <code>C</code>, and <code>C</code> as a
623*7c568831SAndroid Build Coastguard Worker<term>child</term> of <code>P</code>.</termdef></p></div2>
624*7c568831SAndroid Build Coastguard Worker
625*7c568831SAndroid Build Coastguard Worker<div2 id="charsets">
626*7c568831SAndroid Build Coastguard Worker<head>Characters</head>
627*7c568831SAndroid Build Coastguard Worker
628*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-text" term="Text">A parsed entity contains
629*7c568831SAndroid Build Coastguard Worker<term>text</term>, a sequence of
630*7c568831SAndroid Build Coastguard Worker<termref def="dt-character">characters</termref>,
631*7c568831SAndroid Build Coastguard Workerwhich may represent markup or character data.</termdef>
632*7c568831SAndroid Build Coastguard Worker<termdef id="dt-character" term="Character">A <term>character</term>
633*7c568831SAndroid Build Coastguard Workeris an atomic unit of text as specified by
634*7c568831SAndroid Build Coastguard WorkerISO/IEC 10646 <bibref ref="ISO10646"/>.
635*7c568831SAndroid Build Coastguard WorkerLegal characters are tab, carriage return, line feed, and the legal
636*7c568831SAndroid Build Coastguard Workergraphic characters of Unicode and ISO/IEC 10646.
637*7c568831SAndroid Build Coastguard WorkerThe use of "compatibility characters", as defined in section 6.8
638*7c568831SAndroid Build Coastguard Workerof <bibref ref="Unicode"/>, is discouraged.
639*7c568831SAndroid Build Coastguard Worker</termdef>
640*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="char32">
641*7c568831SAndroid Build Coastguard Worker<head>Character Range</head>
642*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
643*7c568831SAndroid Build Coastguard Worker<prod id="NT-Char"><lhs>Char</lhs>
644*7c568831SAndroid Build Coastguard Worker<rhs>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
645*7c568831SAndroid Build Coastguard Worker| [#x10000-#x10FFFF]</rhs>
646*7c568831SAndroid Build Coastguard Worker<com>any Unicode character, excluding the
647*7c568831SAndroid Build Coastguard Workersurrogate blocks, FFFE, and FFFF.</com> </prod>
648*7c568831SAndroid Build Coastguard Worker</prodgroup>
649*7c568831SAndroid Build Coastguard Worker</scrap>
650*7c568831SAndroid Build Coastguard Worker</p>
651*7c568831SAndroid Build Coastguard Worker
652*7c568831SAndroid Build Coastguard Worker<p>The mechanism for encoding character code points into bit patterns may
653*7c568831SAndroid Build Coastguard Workervary from entity to entity. All XML processors must accept the UTF-8
654*7c568831SAndroid Build Coastguard Workerand UTF-16 encodings of 10646; the mechanisms for signaling which of
655*7c568831SAndroid Build Coastguard Workerthe two is in use, or for bringing other encodings into play, are
656*7c568831SAndroid Build Coastguard Workerdiscussed later, in <specref ref="charencoding"/>.
657*7c568831SAndroid Build Coastguard Worker</p>
658*7c568831SAndroid Build Coastguard Worker<!--
659*7c568831SAndroid Build Coastguard Worker<p>Regardless of the specific encoding used, any character in the ISO/IEC
660*7c568831SAndroid Build Coastguard Worker10646 character set may be referred to by the decimal or hexadecimal
661*7c568831SAndroid Build Coastguard Workerequivalent of its
662*7c568831SAndroid Build Coastguard WorkerUCS-4 code value.
663*7c568831SAndroid Build Coastguard Worker</p>-->
664*7c568831SAndroid Build Coastguard Worker</div2>
665*7c568831SAndroid Build Coastguard Worker
666*7c568831SAndroid Build Coastguard Worker<div2 id="sec-common-syn">
667*7c568831SAndroid Build Coastguard Worker<head>Common Syntactic Constructs</head>
668*7c568831SAndroid Build Coastguard Worker
669*7c568831SAndroid Build Coastguard Worker<p>This section defines some symbols used widely in the grammar.</p>
670*7c568831SAndroid Build Coastguard Worker<p><nt def="NT-S">S</nt> (white space) consists of one or more space (#x20)
671*7c568831SAndroid Build Coastguard Workercharacters, carriage returns, line feeds, or tabs.
672*7c568831SAndroid Build Coastguard Worker
673*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="white">
674*7c568831SAndroid Build Coastguard Worker<head>White Space</head>
675*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="4" pcw4="17.5" pcw5="11">
676*7c568831SAndroid Build Coastguard Worker<prod id="NT-S"><lhs>S</lhs>
677*7c568831SAndroid Build Coastguard Worker<rhs>(#x20 | #x9 | #xD | #xA)+</rhs>
678*7c568831SAndroid Build Coastguard Worker</prod>
679*7c568831SAndroid Build Coastguard Worker</prodgroup>
680*7c568831SAndroid Build Coastguard Worker</scrap></p>
681*7c568831SAndroid Build Coastguard Worker<p>Characters are classified for convenience as letters, digits, or other
682*7c568831SAndroid Build Coastguard Workercharacters.  Letters consist of an alphabetic or syllabic
683*7c568831SAndroid Build Coastguard Workerbase character possibly
684*7c568831SAndroid Build Coastguard Workerfollowed by one or more combining characters, or of an ideographic
685*7c568831SAndroid Build Coastguard Workercharacter.
686*7c568831SAndroid Build Coastguard WorkerFull definitions of the specific characters in each class
687*7c568831SAndroid Build Coastguard Workerare given in <specref ref="CharClasses"/>.</p>
688*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-name" term="Name">A <term>Name</term> is a token
689*7c568831SAndroid Build Coastguard Workerbeginning with a letter or one of a few punctuation characters, and continuing
690*7c568831SAndroid Build Coastguard Workerwith letters, digits, hyphens, underscores, colons, or full stops, together
691*7c568831SAndroid Build Coastguard Workerknown as name characters.</termdef>
692*7c568831SAndroid Build Coastguard WorkerNames beginning with the string "<code>xml</code>", or any string
693*7c568831SAndroid Build Coastguard Workerwhich would match <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>, are
694*7c568831SAndroid Build Coastguard Workerreserved for standardization in this or future versions of this
695*7c568831SAndroid Build Coastguard Workerspecification.
696*7c568831SAndroid Build Coastguard Worker</p>
697*7c568831SAndroid Build Coastguard Worker<note>
698*7c568831SAndroid Build Coastguard Worker<p>The colon character within XML names is reserved for experimentation with
699*7c568831SAndroid Build Coastguard Workername spaces.
700*7c568831SAndroid Build Coastguard WorkerIts meaning is expected to be
701*7c568831SAndroid Build Coastguard Workerstandardized at some future point, at which point those documents
702*7c568831SAndroid Build Coastguard Workerusing the colon for experimental purposes may need to be updated.
703*7c568831SAndroid Build Coastguard Worker(There is no guarantee that any name-space mechanism
704*7c568831SAndroid Build Coastguard Workeradopted for XML will in fact use the colon as a name-space delimiter.)
705*7c568831SAndroid Build Coastguard WorkerIn practice, this means that authors should not use the colon in XML
706*7c568831SAndroid Build Coastguard Workernames except as part of name-space experiments, but that XML processors
707*7c568831SAndroid Build Coastguard Workershould accept the colon as a name character.</p>
708*7c568831SAndroid Build Coastguard Worker</note>
709*7c568831SAndroid Build Coastguard Worker<p>An
710*7c568831SAndroid Build Coastguard Worker<nt def="NT-Nmtoken">Nmtoken</nt> (name token) is any mixture of
711*7c568831SAndroid Build Coastguard Workername characters.
712*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
713*7c568831SAndroid Build Coastguard Worker<head>Names and Tokens</head>
714*7c568831SAndroid Build Coastguard Worker<prod id="NT-NameChar"><lhs>NameChar</lhs>
715*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Letter">Letter</nt>
716*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Digit">Digit</nt>
717*7c568831SAndroid Build Coastguard Worker| '.' | '-' | '_' | ':'
718*7c568831SAndroid Build Coastguard Worker| <nt def="NT-CombiningChar">CombiningChar</nt>
719*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Extender">Extender</nt></rhs>
720*7c568831SAndroid Build Coastguard Worker</prod>
721*7c568831SAndroid Build Coastguard Worker<prod id="NT-Name"><lhs>Name</lhs>
722*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-Letter">Letter</nt> | '_' | ':')
723*7c568831SAndroid Build Coastguard Worker(<nt def="NT-NameChar">NameChar</nt>)*</rhs></prod>
724*7c568831SAndroid Build Coastguard Worker<prod id="NT-Names"><lhs>Names</lhs>
725*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Name">Name</nt>
726*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>)*</rhs></prod>
727*7c568831SAndroid Build Coastguard Worker<prod id="NT-Nmtoken"><lhs>Nmtoken</lhs>
728*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-NameChar">NameChar</nt>)+</rhs></prod>
729*7c568831SAndroid Build Coastguard Worker<prod id="NT-Nmtokens"><lhs>Nmtokens</lhs>
730*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Nmtoken">Nmtoken</nt> (<nt def="NT-S">S</nt> <nt def="NT-Nmtoken">Nmtoken</nt>)*</rhs></prod>
731*7c568831SAndroid Build Coastguard Worker</scrap>
732*7c568831SAndroid Build Coastguard Worker</p>
733*7c568831SAndroid Build Coastguard Worker<p>Literal data is any quoted string not containing
734*7c568831SAndroid Build Coastguard Workerthe quotation mark used as a delimiter for that string.
735*7c568831SAndroid Build Coastguard WorkerLiterals are used
736*7c568831SAndroid Build Coastguard Workerfor specifying the content of internal entities
737*7c568831SAndroid Build Coastguard Worker(<nt def="NT-EntityValue">EntityValue</nt>),
738*7c568831SAndroid Build Coastguard Workerthe values of attributes (<nt def="NT-AttValue">AttValue</nt>),
739*7c568831SAndroid Build Coastguard Workerand external identifiers
740*7c568831SAndroid Build Coastguard Worker(<nt def="NT-SystemLiteral">SystemLiteral</nt>).
741*7c568831SAndroid Build Coastguard WorkerNote that a <nt def="NT-SystemLiteral">SystemLiteral</nt>
742*7c568831SAndroid Build Coastguard Workercan be parsed without scanning for markup.
743*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
744*7c568831SAndroid Build Coastguard Worker<head>Literals</head>
745*7c568831SAndroid Build Coastguard Worker<prod id="NT-EntityValue"><lhs>EntityValue</lhs>
746*7c568831SAndroid Build Coastguard Worker<rhs>'"'
747*7c568831SAndroid Build Coastguard Worker([^%&amp;"]
748*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PEReference">PEReference</nt>
749*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Reference">Reference</nt>)*
750*7c568831SAndroid Build Coastguard Worker'"'
751*7c568831SAndroid Build Coastguard Worker</rhs>
752*7c568831SAndroid Build Coastguard Worker<rhs>|&nbsp;
753*7c568831SAndroid Build Coastguard Worker"'"
754*7c568831SAndroid Build Coastguard Worker([^%&amp;']
755*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PEReference">PEReference</nt>
756*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Reference">Reference</nt>)*
757*7c568831SAndroid Build Coastguard Worker"'"</rhs>
758*7c568831SAndroid Build Coastguard Worker</prod>
759*7c568831SAndroid Build Coastguard Worker<prod id="NT-AttValue"><lhs>AttValue</lhs>
760*7c568831SAndroid Build Coastguard Worker<rhs>'"'
761*7c568831SAndroid Build Coastguard Worker([^&lt;&amp;"]
762*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Reference">Reference</nt>)*
763*7c568831SAndroid Build Coastguard Worker'"'
764*7c568831SAndroid Build Coastguard Worker</rhs>
765*7c568831SAndroid Build Coastguard Worker<rhs>|&nbsp;
766*7c568831SAndroid Build Coastguard Worker"'"
767*7c568831SAndroid Build Coastguard Worker([^&lt;&amp;']
768*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Reference">Reference</nt>)*
769*7c568831SAndroid Build Coastguard Worker"'"</rhs>
770*7c568831SAndroid Build Coastguard Worker</prod>
771*7c568831SAndroid Build Coastguard Worker<prod id="NT-SystemLiteral"><lhs>SystemLiteral</lhs>
772*7c568831SAndroid Build Coastguard Worker<rhs>('"' [^"]* '"') |&nbsp;("'" [^']* "'")
773*7c568831SAndroid Build Coastguard Worker</rhs>
774*7c568831SAndroid Build Coastguard Worker</prod>
775*7c568831SAndroid Build Coastguard Worker<prod id="NT-PubidLiteral"><lhs>PubidLiteral</lhs>
776*7c568831SAndroid Build Coastguard Worker<rhs>'"' <nt def="NT-PubidChar">PubidChar</nt>*
777*7c568831SAndroid Build Coastguard Worker'"'
778*7c568831SAndroid Build Coastguard Worker| "'" (<nt def="NT-PubidChar">PubidChar</nt> - "'")* "'"</rhs>
779*7c568831SAndroid Build Coastguard Worker</prod>
780*7c568831SAndroid Build Coastguard Worker<prod id="NT-PubidChar"><lhs>PubidChar</lhs>
781*7c568831SAndroid Build Coastguard Worker<rhs>#x20 | #xD | #xA
782*7c568831SAndroid Build Coastguard Worker|&nbsp;[a-zA-Z0-9]
783*7c568831SAndroid Build Coastguard Worker|&nbsp;[-'()+,./:=?;!*#@$_%]</rhs>
784*7c568831SAndroid Build Coastguard Worker</prod>
785*7c568831SAndroid Build Coastguard Worker</scrap>
786*7c568831SAndroid Build Coastguard Worker</p>
787*7c568831SAndroid Build Coastguard Worker
788*7c568831SAndroid Build Coastguard Worker</div2>
789*7c568831SAndroid Build Coastguard Worker
790*7c568831SAndroid Build Coastguard Worker<div2 id="syntax">
791*7c568831SAndroid Build Coastguard Worker<head>Character Data and Markup</head>
792*7c568831SAndroid Build Coastguard Worker
793*7c568831SAndroid Build Coastguard Worker<p><termref def="dt-text">Text</termref> consists of intermingled
794*7c568831SAndroid Build Coastguard Worker<termref def="dt-chardata">character
795*7c568831SAndroid Build Coastguard Workerdata</termref> and markup.
796*7c568831SAndroid Build Coastguard Worker<termdef id="dt-markup" term="Markup"><term>Markup</term> takes the form of
797*7c568831SAndroid Build Coastguard Worker<termref def="dt-stag">start-tags</termref>,
798*7c568831SAndroid Build Coastguard Worker<termref def="dt-etag">end-tags</termref>,
799*7c568831SAndroid Build Coastguard Worker<termref def="dt-empty">empty-element tags</termref>,
800*7c568831SAndroid Build Coastguard Worker<termref def="dt-entref">entity references</termref>,
801*7c568831SAndroid Build Coastguard Worker<termref def="dt-charref">character references</termref>,
802*7c568831SAndroid Build Coastguard Worker<termref def="dt-comment">comments</termref>,
803*7c568831SAndroid Build Coastguard Worker<termref def="dt-cdsection">CDATA section</termref> delimiters,
804*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">document type declarations</termref>, and
805*7c568831SAndroid Build Coastguard Worker<termref def="dt-pi">processing instructions</termref>.
806*7c568831SAndroid Build Coastguard Worker</termdef>
807*7c568831SAndroid Build Coastguard Worker</p>
808*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-chardata" term="Character Data">All text that is not markup
809*7c568831SAndroid Build Coastguard Workerconstitutes the <term>character data</term> of
810*7c568831SAndroid Build Coastguard Workerthe document.</termdef></p>
811*7c568831SAndroid Build Coastguard Worker<p>The ampersand character (&amp;) and the left angle bracket (&lt;)
812*7c568831SAndroid Build Coastguard Workermay appear in their literal form <emph>only</emph> when used as markup
813*7c568831SAndroid Build Coastguard Workerdelimiters, or within a <termref def="dt-comment">comment</termref>, a
814*7c568831SAndroid Build Coastguard Worker<termref def="dt-pi">processing instruction</termref>,
815*7c568831SAndroid Build Coastguard Workeror a <termref def="dt-cdsection">CDATA section</termref>.
816*7c568831SAndroid Build Coastguard Worker
817*7c568831SAndroid Build Coastguard WorkerThey are also legal within the <termref def="dt-litentval">literal entity
818*7c568831SAndroid Build Coastguard Workervalue</termref> of an internal entity declaration; see
819*7c568831SAndroid Build Coastguard Worker<specref ref="wf-entities"/>.
820*7c568831SAndroid Build Coastguard Worker<!-- FINAL EDIT:  restore internal entity decl or leave it out. -->
821*7c568831SAndroid Build Coastguard WorkerIf they are needed elsewhere,
822*7c568831SAndroid Build Coastguard Workerthey must be <termref def="dt-escape">escaped</termref>
823*7c568831SAndroid Build Coastguard Workerusing either <termref def="dt-charref">numeric character references</termref>
824*7c568831SAndroid Build Coastguard Workeror the strings
825*7c568831SAndroid Build Coastguard Worker"<code>&amp;amp;</code>" and "<code>&amp;lt;</code>" respectively.
826*7c568831SAndroid Build Coastguard WorkerThe right angle
827*7c568831SAndroid Build Coastguard Workerbracket (&gt;) may be represented using the string
828*7c568831SAndroid Build Coastguard Worker"<code>&amp;gt;</code>", and must, <termref def="dt-compat">for
829*7c568831SAndroid Build Coastguard Workercompatibility</termref>,
830*7c568831SAndroid Build Coastguard Workerbe escaped using
831*7c568831SAndroid Build Coastguard Worker"<code>&amp;gt;</code>" or a character reference
832*7c568831SAndroid Build Coastguard Workerwhen it appears in the string
833*7c568831SAndroid Build Coastguard Worker"<code>]]&gt;</code>"
834*7c568831SAndroid Build Coastguard Workerin content,
835*7c568831SAndroid Build Coastguard Workerwhen that string is not marking the end of
836*7c568831SAndroid Build Coastguard Workera <termref def="dt-cdsection">CDATA section</termref>.
837*7c568831SAndroid Build Coastguard Worker</p>
838*7c568831SAndroid Build Coastguard Worker<p>
839*7c568831SAndroid Build Coastguard WorkerIn the content of elements, character data
840*7c568831SAndroid Build Coastguard Workeris any string of characters which does
841*7c568831SAndroid Build Coastguard Workernot contain the start-delimiter of any markup.
842*7c568831SAndroid Build Coastguard WorkerIn a CDATA section, character data
843*7c568831SAndroid Build Coastguard Workeris any string of characters not including the CDATA-section-close
844*7c568831SAndroid Build Coastguard Workerdelimiter, "<code>]]&gt;</code>".</p>
845*7c568831SAndroid Build Coastguard Worker<p>
846*7c568831SAndroid Build Coastguard WorkerTo allow attribute values to contain both single and double quotes, the
847*7c568831SAndroid Build Coastguard Workerapostrophe or single-quote character (') may be represented as
848*7c568831SAndroid Build Coastguard Worker"<code>&amp;apos;</code>", and the double-quote character (") as
849*7c568831SAndroid Build Coastguard Worker"<code>&amp;quot;</code>".
850*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
851*7c568831SAndroid Build Coastguard Worker<head>Character Data</head>
852*7c568831SAndroid Build Coastguard Worker<prod id="NT-CharData">
853*7c568831SAndroid Build Coastguard Worker<lhs>CharData</lhs>
854*7c568831SAndroid Build Coastguard Worker<rhs>[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)</rhs>
855*7c568831SAndroid Build Coastguard Worker</prod>
856*7c568831SAndroid Build Coastguard Worker</scrap>
857*7c568831SAndroid Build Coastguard Worker</p>
858*7c568831SAndroid Build Coastguard Worker</div2>
859*7c568831SAndroid Build Coastguard Worker
860*7c568831SAndroid Build Coastguard Worker<div2 id="sec-comments">
861*7c568831SAndroid Build Coastguard Worker<head>Comments</head>
862*7c568831SAndroid Build Coastguard Worker
863*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-comment" term="Comment"><term>Comments</term> may
864*7c568831SAndroid Build Coastguard Workerappear anywhere in a document outside other
865*7c568831SAndroid Build Coastguard Worker<termref def="dt-markup">markup</termref>; in addition,
866*7c568831SAndroid Build Coastguard Workerthey may appear within the document type declaration
867*7c568831SAndroid Build Coastguard Workerat places allowed by the grammar.
868*7c568831SAndroid Build Coastguard WorkerThey are not part of the document's <termref def="dt-chardata">character
869*7c568831SAndroid Build Coastguard Workerdata</termref>; an XML
870*7c568831SAndroid Build Coastguard Workerprocessor may, but need not, make it possible for an application to
871*7c568831SAndroid Build Coastguard Workerretrieve the text of comments.
872*7c568831SAndroid Build Coastguard Worker<termref def="dt-compat">For compatibility</termref>, the string
873*7c568831SAndroid Build Coastguard Worker"<code>--</code>" (double-hyphen) must not occur within
874*7c568831SAndroid Build Coastguard Workercomments.
875*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
876*7c568831SAndroid Build Coastguard Worker<head>Comments</head>
877*7c568831SAndroid Build Coastguard Worker<prod id="NT-Comment"><lhs>Comment</lhs>
878*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!--'
879*7c568831SAndroid Build Coastguard Worker((<nt def="NT-Char">Char</nt> - '-')
880*7c568831SAndroid Build Coastguard Worker| ('-' (<nt def="NT-Char">Char</nt> - '-')))*
881*7c568831SAndroid Build Coastguard Worker'--&gt;'</rhs>
882*7c568831SAndroid Build Coastguard Worker</prod>
883*7c568831SAndroid Build Coastguard Worker</scrap>
884*7c568831SAndroid Build Coastguard Worker</termdef></p>
885*7c568831SAndroid Build Coastguard Worker<p>An example of a comment:
886*7c568831SAndroid Build Coastguard Worker<eg>&lt;!&como; declarations for &lt;head&gt; &amp; &lt;body&gt; &comc;&gt;</eg>
887*7c568831SAndroid Build Coastguard Worker</p>
888*7c568831SAndroid Build Coastguard Worker</div2>
889*7c568831SAndroid Build Coastguard Worker
890*7c568831SAndroid Build Coastguard Worker<div2 id="sec-pi">
891*7c568831SAndroid Build Coastguard Worker<head>Processing Instructions</head>
892*7c568831SAndroid Build Coastguard Worker
893*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-pi" term="Processing instruction"><term>Processing
894*7c568831SAndroid Build Coastguard Workerinstructions</term> (PIs) allow documents to contain instructions
895*7c568831SAndroid Build Coastguard Workerfor applications.
896*7c568831SAndroid Build Coastguard Worker
897*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
898*7c568831SAndroid Build Coastguard Worker<head>Processing Instructions</head>
899*7c568831SAndroid Build Coastguard Worker<prod id="NT-PI"><lhs>PI</lhs>
900*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;?' <nt def="NT-PITarget">PITarget</nt>
901*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt>
902*7c568831SAndroid Build Coastguard Worker(<nt def="NT-Char">Char</nt>* -
903*7c568831SAndroid Build Coastguard Worker(<nt def="NT-Char">Char</nt>* &pic; <nt def="NT-Char">Char</nt>*)))?
904*7c568831SAndroid Build Coastguard Worker&pic;</rhs></prod>
905*7c568831SAndroid Build Coastguard Worker<prod id="NT-PITarget"><lhs>PITarget</lhs>
906*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Name">Name</nt> -
907*7c568831SAndroid Build Coastguard Worker(('X' | 'x') ('M' | 'm') ('L' | 'l'))</rhs>
908*7c568831SAndroid Build Coastguard Worker</prod>
909*7c568831SAndroid Build Coastguard Worker</scrap></termdef>
910*7c568831SAndroid Build Coastguard WorkerPIs are not part of the document's <termref def="dt-chardata">character
911*7c568831SAndroid Build Coastguard Workerdata</termref>, but must be passed through to the application. The
912*7c568831SAndroid Build Coastguard WorkerPI begins with a target (<nt def="NT-PITarget">PITarget</nt>) used
913*7c568831SAndroid Build Coastguard Workerto identify the application to which the instruction is directed.
914*7c568831SAndroid Build Coastguard WorkerThe target names "<code>XML</code>", "<code>xml</code>", and so on are
915*7c568831SAndroid Build Coastguard Workerreserved for standardization in this or future versions of this
916*7c568831SAndroid Build Coastguard Workerspecification.
917*7c568831SAndroid Build Coastguard WorkerThe
918*7c568831SAndroid Build Coastguard WorkerXML <termref def="dt-notation">Notation</termref> mechanism
919*7c568831SAndroid Build Coastguard Workermay be used for
920*7c568831SAndroid Build Coastguard Workerformal declaration of PI targets.
921*7c568831SAndroid Build Coastguard Worker</p>
922*7c568831SAndroid Build Coastguard Worker</div2>
923*7c568831SAndroid Build Coastguard Worker
924*7c568831SAndroid Build Coastguard Worker<div2 id="sec-cdata-sect">
925*7c568831SAndroid Build Coastguard Worker<head>CDATA Sections</head>
926*7c568831SAndroid Build Coastguard Worker
927*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-cdsection" term="CDATA Section"><term>CDATA sections</term>
928*7c568831SAndroid Build Coastguard Workermay occur
929*7c568831SAndroid Build Coastguard Workeranywhere character data may occur; they are
930*7c568831SAndroid Build Coastguard Workerused to escape blocks of text containing characters which would
931*7c568831SAndroid Build Coastguard Workerotherwise be recognized as markup.  CDATA sections begin with the
932*7c568831SAndroid Build Coastguard Workerstring "<code>&lt;![CDATA[</code>" and end with the string
933*7c568831SAndroid Build Coastguard Worker"<code>]]&gt;</code>":
934*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
935*7c568831SAndroid Build Coastguard Worker<head>CDATA Sections</head>
936*7c568831SAndroid Build Coastguard Worker<prod id="NT-CDSect"><lhs>CDSect</lhs>
937*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-CDStart">CDStart</nt>
938*7c568831SAndroid Build Coastguard Worker<nt def="NT-CData">CData</nt>
939*7c568831SAndroid Build Coastguard Worker<nt def="NT-CDEnd">CDEnd</nt></rhs></prod>
940*7c568831SAndroid Build Coastguard Worker<prod id="NT-CDStart"><lhs>CDStart</lhs>
941*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;![CDATA['</rhs>
942*7c568831SAndroid Build Coastguard Worker</prod>
943*7c568831SAndroid Build Coastguard Worker<prod id="NT-CData"><lhs>CData</lhs>
944*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-Char">Char</nt>* -
945*7c568831SAndroid Build Coastguard Worker(<nt def="NT-Char">Char</nt>* ']]&gt;' <nt def="NT-Char">Char</nt>*))
946*7c568831SAndroid Build Coastguard Worker</rhs>
947*7c568831SAndroid Build Coastguard Worker</prod>
948*7c568831SAndroid Build Coastguard Worker<prod id="NT-CDEnd"><lhs>CDEnd</lhs>
949*7c568831SAndroid Build Coastguard Worker<rhs>']]&gt;'</rhs>
950*7c568831SAndroid Build Coastguard Worker</prod>
951*7c568831SAndroid Build Coastguard Worker</scrap>
952*7c568831SAndroid Build Coastguard Worker
953*7c568831SAndroid Build Coastguard WorkerWithin a CDATA section, only the <nt def="NT-CDEnd">CDEnd</nt> string is
954*7c568831SAndroid Build Coastguard Workerrecognized as markup, so that left angle brackets and ampersands may occur in
955*7c568831SAndroid Build Coastguard Workertheir literal form; they need not (and cannot) be escaped using
956*7c568831SAndroid Build Coastguard Worker"<code>&amp;lt;</code>" and "<code>&amp;amp;</code>".  CDATA sections
957*7c568831SAndroid Build Coastguard Workercannot nest.</termdef>
958*7c568831SAndroid Build Coastguard Worker</p>
959*7c568831SAndroid Build Coastguard Worker
960*7c568831SAndroid Build Coastguard Worker<p>An example of a CDATA section, in which "<code>&lt;greeting&gt;</code>" and
961*7c568831SAndroid Build Coastguard Worker"<code>&lt;/greeting&gt;</code>"
962*7c568831SAndroid Build Coastguard Workerare recognized as <termref def="dt-chardata">character data</termref>, not
963*7c568831SAndroid Build Coastguard Worker<termref def="dt-markup">markup</termref>:
964*7c568831SAndroid Build Coastguard Worker<eg>&lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt;</eg>
965*7c568831SAndroid Build Coastguard Worker</p>
966*7c568831SAndroid Build Coastguard Worker</div2>
967*7c568831SAndroid Build Coastguard Worker
968*7c568831SAndroid Build Coastguard Worker<div2 id="sec-prolog-dtd">
969*7c568831SAndroid Build Coastguard Worker<head>Prolog and Document Type Declaration</head>
970*7c568831SAndroid Build Coastguard Worker
971*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-xmldecl" term="XML Declaration">XML documents
972*7c568831SAndroid Build Coastguard Workermay, and should,
973*7c568831SAndroid Build Coastguard Workerbegin with an <term>XML declaration</term> which specifies
974*7c568831SAndroid Build Coastguard Workerthe version of
975*7c568831SAndroid Build Coastguard WorkerXML being used.</termdef>
976*7c568831SAndroid Build Coastguard WorkerFor example, the following is a complete XML document, <termref def="dt-wellformed">well-formed</termref> but not
977*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">valid</termref>:
978*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<?xml version="1.0"?>
979*7c568831SAndroid Build Coastguard Worker<greeting>Hello, world!</greeting>
980*7c568831SAndroid Build Coastguard Worker]]></eg>
981*7c568831SAndroid Build Coastguard Workerand so is this:
982*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<greeting>Hello, world!</greeting>
983*7c568831SAndroid Build Coastguard Worker]]></eg>
984*7c568831SAndroid Build Coastguard Worker</p>
985*7c568831SAndroid Build Coastguard Worker
986*7c568831SAndroid Build Coastguard Worker<p>The version number "<code>1.0</code>" should be used to indicate
987*7c568831SAndroid Build Coastguard Workerconformance to this version of this specification; it is an error
988*7c568831SAndroid Build Coastguard Workerfor a document to use the value "<code>1.0</code>"
989*7c568831SAndroid Build Coastguard Workerif it does not conform to this version of this specification.
990*7c568831SAndroid Build Coastguard WorkerIt is the intent
991*7c568831SAndroid Build Coastguard Workerof the XML working group to give later versions of this specification
992*7c568831SAndroid Build Coastguard Workernumbers other than "<code>1.0</code>", but this intent does not
993*7c568831SAndroid Build Coastguard Workerindicate a
994*7c568831SAndroid Build Coastguard Workercommitment to produce any future versions of XML, nor if any are produced, to
995*7c568831SAndroid Build Coastguard Workeruse any particular numbering scheme.
996*7c568831SAndroid Build Coastguard WorkerSince future versions are not ruled out, this construct is provided
997*7c568831SAndroid Build Coastguard Workeras a means to allow the possibility of automatic version recognition, should
998*7c568831SAndroid Build Coastguard Workerit become necessary.
999*7c568831SAndroid Build Coastguard WorkerProcessors may signal an error if they receive documents labeled with
1000*7c568831SAndroid Build Coastguard Workerversions they do not support.
1001*7c568831SAndroid Build Coastguard Worker</p>
1002*7c568831SAndroid Build Coastguard Worker<p>The function of the markup in an XML document is to describe its
1003*7c568831SAndroid Build Coastguard Workerstorage and logical structure and to associate attribute-value pairs
1004*7c568831SAndroid Build Coastguard Workerwith its logical structures.  XML provides a mechanism, the <termref def="dt-doctype">document type declaration</termref>, to define
1005*7c568831SAndroid Build Coastguard Workerconstraints on the logical structure and to support the use of
1006*7c568831SAndroid Build Coastguard Workerpredefined storage units.
1007*7c568831SAndroid Build Coastguard Worker
1008*7c568831SAndroid Build Coastguard Worker<termdef id="dt-valid" term="Validity">An XML document is
1009*7c568831SAndroid Build Coastguard Worker<term>valid</term> if it has an associated document type
1010*7c568831SAndroid Build Coastguard Workerdeclaration and if the document
1011*7c568831SAndroid Build Coastguard Workercomplies with the constraints expressed in it.</termdef></p>
1012*7c568831SAndroid Build Coastguard Worker<p>The document type declaration must appear before
1013*7c568831SAndroid Build Coastguard Workerthe first <termref def="dt-element">element</termref> in the document.
1014*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="xmldoc">
1015*7c568831SAndroid Build Coastguard Worker<head>Prolog</head>
1016*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
1017*7c568831SAndroid Build Coastguard Worker<prod id="NT-prolog"><lhs>prolog</lhs>
1018*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-XMLDecl">XMLDecl</nt>?
1019*7c568831SAndroid Build Coastguard Worker<nt def="NT-Misc">Misc</nt>*
1020*7c568831SAndroid Build Coastguard Worker(<nt def="NT-doctypedecl">doctypedecl</nt>
1021*7c568831SAndroid Build Coastguard Worker<nt def="NT-Misc">Misc</nt>*)?</rhs></prod>
1022*7c568831SAndroid Build Coastguard Worker<prod id="NT-XMLDecl"><lhs>XMLDecl</lhs>
1023*7c568831SAndroid Build Coastguard Worker<rhs>&xmlpio;
1024*7c568831SAndroid Build Coastguard Worker<nt def="NT-VersionInfo">VersionInfo</nt>
1025*7c568831SAndroid Build Coastguard Worker<nt def="NT-EncodingDecl">EncodingDecl</nt>?
1026*7c568831SAndroid Build Coastguard Worker<nt def="NT-SDDecl">SDDecl</nt>?
1027*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
1028*7c568831SAndroid Build Coastguard Worker&pic;</rhs>
1029*7c568831SAndroid Build Coastguard Worker</prod>
1030*7c568831SAndroid Build Coastguard Worker<prod id="NT-VersionInfo"><lhs>VersionInfo</lhs>
1031*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-S">S</nt> 'version' <nt def="NT-Eq">Eq</nt>
1032*7c568831SAndroid Build Coastguard Worker(' <nt def="NT-VersionNum">VersionNum</nt> '
1033*7c568831SAndroid Build Coastguard Worker| " <nt def="NT-VersionNum">VersionNum</nt> ")</rhs>
1034*7c568831SAndroid Build Coastguard Worker</prod>
1035*7c568831SAndroid Build Coastguard Worker<prod id="NT-Eq"><lhs>Eq</lhs>
1036*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-S">S</nt>? '=' <nt def="NT-S">S</nt>?</rhs></prod>
1037*7c568831SAndroid Build Coastguard Worker<prod id="NT-VersionNum">
1038*7c568831SAndroid Build Coastguard Worker<lhs>VersionNum</lhs>
1039*7c568831SAndroid Build Coastguard Worker<rhs>([a-zA-Z0-9_.:] | '-')+</rhs>
1040*7c568831SAndroid Build Coastguard Worker</prod>
1041*7c568831SAndroid Build Coastguard Worker<prod id="NT-Misc"><lhs>Misc</lhs>
1042*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Comment">Comment</nt> | <nt def="NT-PI">PI</nt> |
1043*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt></rhs></prod>
1044*7c568831SAndroid Build Coastguard Worker</prodgroup>
1045*7c568831SAndroid Build Coastguard Worker</scrap></p>
1046*7c568831SAndroid Build Coastguard Worker
1047*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-doctype" term="Document Type Declaration">The XML
1048*7c568831SAndroid Build Coastguard Worker<term>document type declaration</term>
1049*7c568831SAndroid Build Coastguard Workercontains or points to
1050*7c568831SAndroid Build Coastguard Worker<termref def="dt-markupdecl">markup declarations</termref>
1051*7c568831SAndroid Build Coastguard Workerthat provide a grammar for a
1052*7c568831SAndroid Build Coastguard Workerclass of documents.
1053*7c568831SAndroid Build Coastguard WorkerThis grammar is known as a document type definition,
1054*7c568831SAndroid Build Coastguard Workeror <term>DTD</term>.
1055*7c568831SAndroid Build Coastguard WorkerThe document type declaration can point to an external subset (a
1056*7c568831SAndroid Build Coastguard Workerspecial kind of
1057*7c568831SAndroid Build Coastguard Worker<termref def="dt-extent">external entity</termref>) containing markup
1058*7c568831SAndroid Build Coastguard Workerdeclarations, or can
1059*7c568831SAndroid Build Coastguard Workercontain the markup declarations directly in an internal subset, or can do
1060*7c568831SAndroid Build Coastguard Workerboth.
1061*7c568831SAndroid Build Coastguard WorkerThe DTD for a document consists of both subsets taken
1062*7c568831SAndroid Build Coastguard Workertogether.</termdef>
1063*7c568831SAndroid Build Coastguard Worker</p>
1064*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-markupdecl" term="markup declaration">
1065*7c568831SAndroid Build Coastguard WorkerA <term>markup declaration</term> is
1066*7c568831SAndroid Build Coastguard Workeran <termref def="dt-eldecl">element type declaration</termref>,
1067*7c568831SAndroid Build Coastguard Workeran <termref def="dt-attdecl">attribute-list declaration</termref>,
1068*7c568831SAndroid Build Coastguard Workeran <termref def="dt-entdecl">entity declaration</termref>, or
1069*7c568831SAndroid Build Coastguard Workera <termref def="dt-notdecl">notation declaration</termref>.
1070*7c568831SAndroid Build Coastguard Worker</termdef>
1071*7c568831SAndroid Build Coastguard WorkerThese declarations may be contained in whole or in part
1072*7c568831SAndroid Build Coastguard Workerwithin <termref def="dt-PE">parameter entities</termref>,
1073*7c568831SAndroid Build Coastguard Workeras described in the well-formedness and validity constraints below.
1074*7c568831SAndroid Build Coastguard WorkerFor fuller information, see
1075*7c568831SAndroid Build Coastguard Worker<specref ref="sec-physical-struct"/>.</p>
1076*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="dtd">
1077*7c568831SAndroid Build Coastguard Worker<head>Document Type Definition</head>
1078*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
1079*7c568831SAndroid Build Coastguard Worker<prod id="NT-doctypedecl"><lhs>doctypedecl</lhs>
1080*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!DOCTYPE' <nt def="NT-S">S</nt>
1081*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt>
1082*7c568831SAndroid Build Coastguard Worker<nt def="NT-ExternalID">ExternalID</nt>)?
1083*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? ('['
1084*7c568831SAndroid Build Coastguard Worker(<nt def="NT-markupdecl">markupdecl</nt>
1085*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PEReference">PEReference</nt>
1086*7c568831SAndroid Build Coastguard Worker| <nt def="NT-S">S</nt>)*
1087*7c568831SAndroid Build Coastguard Worker']'
1088*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?)? '&gt;'</rhs>
1089*7c568831SAndroid Build Coastguard Worker<vc def="vc-roottype"/>
1090*7c568831SAndroid Build Coastguard Worker</prod>
1091*7c568831SAndroid Build Coastguard Worker<prod id="NT-markupdecl"><lhs>markupdecl</lhs>
1092*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-elementdecl">elementdecl</nt>
1093*7c568831SAndroid Build Coastguard Worker| <nt def="NT-AttlistDecl">AttlistDecl</nt>
1094*7c568831SAndroid Build Coastguard Worker| <nt def="NT-EntityDecl">EntityDecl</nt>
1095*7c568831SAndroid Build Coastguard Worker| <nt def="NT-NotationDecl">NotationDecl</nt>
1096*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PI">PI</nt>
1097*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Comment">Comment</nt>
1098*7c568831SAndroid Build Coastguard Worker</rhs>
1099*7c568831SAndroid Build Coastguard Worker<vc def="vc-PEinMarkupDecl"/>
1100*7c568831SAndroid Build Coastguard Worker<wfc def="wfc-PEinInternalSubset"/>
1101*7c568831SAndroid Build Coastguard Worker</prod>
1102*7c568831SAndroid Build Coastguard Worker
1103*7c568831SAndroid Build Coastguard Worker</prodgroup>
1104*7c568831SAndroid Build Coastguard Worker</scrap>
1105*7c568831SAndroid Build Coastguard Worker
1106*7c568831SAndroid Build Coastguard Worker<p>The markup declarations may be made up in whole or in part of
1107*7c568831SAndroid Build Coastguard Workerthe <termref def="dt-repltext">replacement text</termref> of
1108*7c568831SAndroid Build Coastguard Worker<termref def="dt-PE">parameter entities</termref>.
1109*7c568831SAndroid Build Coastguard WorkerThe productions later in this specification for
1110*7c568831SAndroid Build Coastguard Workerindividual nonterminals (<nt def="NT-elementdecl">elementdecl</nt>,
1111*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttlistDecl">AttlistDecl</nt>, and so on) describe
1112*7c568831SAndroid Build Coastguard Workerthe declarations <emph>after</emph> all the parameter entities have been
1113*7c568831SAndroid Build Coastguard Worker<termref def="dt-include">included</termref>.</p>
1114*7c568831SAndroid Build Coastguard Worker
1115*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-roottype">
1116*7c568831SAndroid Build Coastguard Worker<head>Root Element Type</head>
1117*7c568831SAndroid Build Coastguard Worker<p>
1118*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> in the document type declaration must
1119*7c568831SAndroid Build Coastguard Workermatch the element type of the <termref def="dt-root">root element</termref>.
1120*7c568831SAndroid Build Coastguard Worker</p>
1121*7c568831SAndroid Build Coastguard Worker</vcnote>
1122*7c568831SAndroid Build Coastguard Worker
1123*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-PEinMarkupDecl">
1124*7c568831SAndroid Build Coastguard Worker<head>Proper Declaration/PE Nesting</head>
1125*7c568831SAndroid Build Coastguard Worker<p>Parameter-entity
1126*7c568831SAndroid Build Coastguard Worker<termref def="dt-repltext">replacement text</termref> must be properly nested
1127*7c568831SAndroid Build Coastguard Workerwith markup declarations.
1128*7c568831SAndroid Build Coastguard WorkerThat is to say, if either the first character
1129*7c568831SAndroid Build Coastguard Workeror the last character of a markup
1130*7c568831SAndroid Build Coastguard Workerdeclaration (<nt def="NT-markupdecl">markupdecl</nt> above)
1131*7c568831SAndroid Build Coastguard Workeris contained in the replacement text for a
1132*7c568831SAndroid Build Coastguard Worker<termref def="dt-PERef">parameter-entity reference</termref>,
1133*7c568831SAndroid Build Coastguard Workerboth must be contained in the same replacement text.</p>
1134*7c568831SAndroid Build Coastguard Worker</vcnote>
1135*7c568831SAndroid Build Coastguard Worker<wfcnote id="wfc-PEinInternalSubset">
1136*7c568831SAndroid Build Coastguard Worker<head>PEs in Internal Subset</head>
1137*7c568831SAndroid Build Coastguard Worker<p>In the internal DTD subset,
1138*7c568831SAndroid Build Coastguard Worker<termref def="dt-PERef">parameter-entity references</termref>
1139*7c568831SAndroid Build Coastguard Workercan occur only where markup declarations can occur, not
1140*7c568831SAndroid Build Coastguard Workerwithin markup declarations.  (This does not apply to
1141*7c568831SAndroid Build Coastguard Workerreferences that occur in
1142*7c568831SAndroid Build Coastguard Workerexternal parameter entities or to the external subset.)
1143*7c568831SAndroid Build Coastguard Worker</p>
1144*7c568831SAndroid Build Coastguard Worker</wfcnote>
1145*7c568831SAndroid Build Coastguard Worker<p>
1146*7c568831SAndroid Build Coastguard WorkerLike the internal subset, the external subset and
1147*7c568831SAndroid Build Coastguard Workerany external parameter entities referred to in the DTD
1148*7c568831SAndroid Build Coastguard Workermust consist of a series of complete markup declarations of the types
1149*7c568831SAndroid Build Coastguard Workerallowed by the non-terminal symbol
1150*7c568831SAndroid Build Coastguard Worker<nt def="NT-markupdecl">markupdecl</nt>, interspersed with white space
1151*7c568831SAndroid Build Coastguard Workeror <termref def="dt-PERef">parameter-entity references</termref>.
1152*7c568831SAndroid Build Coastguard WorkerHowever, portions of the contents
1153*7c568831SAndroid Build Coastguard Workerof the
1154*7c568831SAndroid Build Coastguard Workerexternal subset or of external parameter entities may conditionally be ignored
1155*7c568831SAndroid Build Coastguard Workerby using
1156*7c568831SAndroid Build Coastguard Workerthe <termref def="dt-cond-section">conditional section</termref>
1157*7c568831SAndroid Build Coastguard Workerconstruct; this is not allowed in the internal subset.
1158*7c568831SAndroid Build Coastguard Worker
1159*7c568831SAndroid Build Coastguard Worker<scrap id="ext-Subset">
1160*7c568831SAndroid Build Coastguard Worker<head>External Subset</head>
1161*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="17.5" pcw5="9">
1162*7c568831SAndroid Build Coastguard Worker<prod id="NT-extSubset"><lhs>extSubset</lhs>
1163*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-TextDecl">TextDecl</nt>?
1164*7c568831SAndroid Build Coastguard Worker<nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs></prod>
1165*7c568831SAndroid Build Coastguard Worker<prod id="NT-extSubsetDecl"><lhs>extSubsetDecl</lhs>
1166*7c568831SAndroid Build Coastguard Worker<rhs>(
1167*7c568831SAndroid Build Coastguard Worker<nt def="NT-markupdecl">markupdecl</nt>
1168*7c568831SAndroid Build Coastguard Worker| <nt def="NT-conditionalSect">conditionalSect</nt>
1169*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PEReference">PEReference</nt>
1170*7c568831SAndroid Build Coastguard Worker| <nt def="NT-S">S</nt>
1171*7c568831SAndroid Build Coastguard Worker)*</rhs>
1172*7c568831SAndroid Build Coastguard Worker</prod>
1173*7c568831SAndroid Build Coastguard Worker</prodgroup>
1174*7c568831SAndroid Build Coastguard Worker</scrap></p>
1175*7c568831SAndroid Build Coastguard Worker<p>The external subset and external parameter entities also differ
1176*7c568831SAndroid Build Coastguard Workerfrom the internal subset in that in them,
1177*7c568831SAndroid Build Coastguard Worker<termref def="dt-PERef">parameter-entity references</termref>
1178*7c568831SAndroid Build Coastguard Workerare permitted <emph>within</emph> markup declarations,
1179*7c568831SAndroid Build Coastguard Workernot only <emph>between</emph> markup declarations.</p>
1180*7c568831SAndroid Build Coastguard Worker<p>An example of an XML document with a document type declaration:
1181*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<?xml version="1.0"?>
1182*7c568831SAndroid Build Coastguard Worker<!DOCTYPE greeting SYSTEM "hello.dtd">
1183*7c568831SAndroid Build Coastguard Worker<greeting>Hello, world!</greeting>
1184*7c568831SAndroid Build Coastguard Worker]]></eg>
1185*7c568831SAndroid Build Coastguard WorkerThe <termref def="dt-sysid">system identifier</termref>
1186*7c568831SAndroid Build Coastguard Worker"<code>hello.dtd</code>" gives the URI of a DTD for the document.</p>
1187*7c568831SAndroid Build Coastguard Worker<p>The declarations can also be given locally, as in this
1188*7c568831SAndroid Build Coastguard Workerexample:
1189*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<?xml version="1.0" encoding="UTF-8" ?>
1190*7c568831SAndroid Build Coastguard Worker<!DOCTYPE greeting [
1191*7c568831SAndroid Build Coastguard Worker  <!ELEMENT greeting (#PCDATA)>
1192*7c568831SAndroid Build Coastguard Worker]>
1193*7c568831SAndroid Build Coastguard Worker<greeting>Hello, world!</greeting>
1194*7c568831SAndroid Build Coastguard Worker]]></eg>
1195*7c568831SAndroid Build Coastguard WorkerIf both the external and internal subsets are used, the
1196*7c568831SAndroid Build Coastguard Workerinternal subset is considered to occur before the external subset.
1197*7c568831SAndroid Build Coastguard Worker<!-- 'is considered to'? boo. whazzat mean? -->
1198*7c568831SAndroid Build Coastguard WorkerThis has the effect that entity and attribute-list declarations in the
1199*7c568831SAndroid Build Coastguard Workerinternal subset take precedence over those in the external subset.
1200*7c568831SAndroid Build Coastguard Worker</p>
1201*7c568831SAndroid Build Coastguard Worker</div2>
1202*7c568831SAndroid Build Coastguard Worker
1203*7c568831SAndroid Build Coastguard Worker<div2 id="sec-rmd">
1204*7c568831SAndroid Build Coastguard Worker<head>Standalone Document Declaration</head>
1205*7c568831SAndroid Build Coastguard Worker<p>Markup declarations can affect the content of the document,
1206*7c568831SAndroid Build Coastguard Workeras passed from an <termref def="dt-xml-proc">XML processor</termref>
1207*7c568831SAndroid Build Coastguard Workerto an application; examples are attribute defaults and entity
1208*7c568831SAndroid Build Coastguard Workerdeclarations.
1209*7c568831SAndroid Build Coastguard WorkerThe standalone document declaration,
1210*7c568831SAndroid Build Coastguard Workerwhich may appear as a component of the XML declaration, signals
1211*7c568831SAndroid Build Coastguard Workerwhether or not there are such declarations which appear external to
1212*7c568831SAndroid Build Coastguard Workerthe <termref def="dt-docent">document entity</termref>.
1213*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="fulldtd">
1214*7c568831SAndroid Build Coastguard Worker<head>Standalone Document Declaration</head>
1215*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="4" pcw4="19.5" pcw5="9">
1216*7c568831SAndroid Build Coastguard Worker<prod id="NT-SDDecl"><lhs>SDDecl</lhs>
1217*7c568831SAndroid Build Coastguard Worker<rhs>
1218*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>
1219*7c568831SAndroid Build Coastguard Worker'standalone' <nt def="NT-Eq">Eq</nt>
1220*7c568831SAndroid Build Coastguard Worker(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
1221*7c568831SAndroid Build Coastguard Worker</rhs>
1222*7c568831SAndroid Build Coastguard Worker<vc def="vc-check-rmd"/></prod>
1223*7c568831SAndroid Build Coastguard Worker</prodgroup>
1224*7c568831SAndroid Build Coastguard Worker</scrap></p>
1225*7c568831SAndroid Build Coastguard Worker<p>
1226*7c568831SAndroid Build Coastguard WorkerIn a standalone document declaration, the value "<code>yes</code>" indicates
1227*7c568831SAndroid Build Coastguard Workerthat there
1228*7c568831SAndroid Build Coastguard Workerare no markup declarations external to the <termref def="dt-docent">document
1229*7c568831SAndroid Build Coastguard Workerentity</termref> (either in the DTD external subset, or in an
1230*7c568831SAndroid Build Coastguard Workerexternal parameter entity referenced from the internal subset)
1231*7c568831SAndroid Build Coastguard Workerwhich affect the information passed from the XML processor to
1232*7c568831SAndroid Build Coastguard Workerthe application.
1233*7c568831SAndroid Build Coastguard WorkerThe value "<code>no</code>" indicates that there are or may be such
1234*7c568831SAndroid Build Coastguard Workerexternal markup declarations.
1235*7c568831SAndroid Build Coastguard WorkerNote that the standalone document declaration only
1236*7c568831SAndroid Build Coastguard Workerdenotes the presence of external <emph>declarations</emph>; the presence, in a
1237*7c568831SAndroid Build Coastguard Workerdocument, of
1238*7c568831SAndroid Build Coastguard Workerreferences to external <emph>entities</emph>, when those entities are
1239*7c568831SAndroid Build Coastguard Workerinternally declared,
1240*7c568831SAndroid Build Coastguard Workerdoes not change its standalone status.</p>
1241*7c568831SAndroid Build Coastguard Worker<p>If there are no external markup declarations, the standalone document
1242*7c568831SAndroid Build Coastguard Workerdeclaration has no meaning.
1243*7c568831SAndroid Build Coastguard WorkerIf there are external markup declarations but there is no standalone
1244*7c568831SAndroid Build Coastguard Workerdocument declaration, the value "<code>no</code>" is assumed.</p>
1245*7c568831SAndroid Build Coastguard Worker<p>Any XML document for which <code>standalone="no"</code> holds can
1246*7c568831SAndroid Build Coastguard Workerbe converted algorithmically to a standalone document,
1247*7c568831SAndroid Build Coastguard Workerwhich may be desirable for some network delivery applications.</p>
1248*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-check-rmd">
1249*7c568831SAndroid Build Coastguard Worker<head>Standalone Document Declaration</head>
1250*7c568831SAndroid Build Coastguard Worker<p>The standalone document declaration must have
1251*7c568831SAndroid Build Coastguard Workerthe value "<code>no</code>" if any external markup declarations
1252*7c568831SAndroid Build Coastguard Workercontain declarations of:</p><ulist>
1253*7c568831SAndroid Build Coastguard Worker<item><p>attributes with <termref def="dt-default">default</termref> values, if
1254*7c568831SAndroid Build Coastguard Workerelements to which
1255*7c568831SAndroid Build Coastguard Workerthese attributes apply appear in the document without
1256*7c568831SAndroid Build Coastguard Workerspecifications of values for these attributes, or</p></item>
1257*7c568831SAndroid Build Coastguard Worker<item><p>entities (other than &magicents;),
1258*7c568831SAndroid Build Coastguard Workerif <termref def="dt-entref">references</termref> to those
1259*7c568831SAndroid Build Coastguard Workerentities appear in the document, or</p>
1260*7c568831SAndroid Build Coastguard Worker</item>
1261*7c568831SAndroid Build Coastguard Worker<item><p>attributes with values subject to
1262*7c568831SAndroid Build Coastguard Worker<titleref href="AVNormalize">normalization</titleref>, where the
1263*7c568831SAndroid Build Coastguard Workerattribute appears in the document with a value which will
1264*7c568831SAndroid Build Coastguard Workerchange as a result of normalization, or</p>
1265*7c568831SAndroid Build Coastguard Worker</item>
1266*7c568831SAndroid Build Coastguard Worker<item>
1267*7c568831SAndroid Build Coastguard Worker<p>element types with <termref def="dt-elemcontent">element content</termref>,
1268*7c568831SAndroid Build Coastguard Workerif white space occurs
1269*7c568831SAndroid Build Coastguard Workerdirectly within any instance of those types.
1270*7c568831SAndroid Build Coastguard Worker</p></item>
1271*7c568831SAndroid Build Coastguard Worker</ulist>
1272*7c568831SAndroid Build Coastguard Worker
1273*7c568831SAndroid Build Coastguard Worker</vcnote>
1274*7c568831SAndroid Build Coastguard Worker<p>An example XML declaration with a standalone document declaration:<eg>&lt;?xml version="&XML.version;" standalone='yes'?&gt;</eg></p>
1275*7c568831SAndroid Build Coastguard Worker</div2>
1276*7c568831SAndroid Build Coastguard Worker<div2 id="sec-white-space">
1277*7c568831SAndroid Build Coastguard Worker<head>White Space Handling</head>
1278*7c568831SAndroid Build Coastguard Worker
1279*7c568831SAndroid Build Coastguard Worker<p>In editing XML documents, it is often convenient to use "white space"
1280*7c568831SAndroid Build Coastguard Worker(spaces, tabs, and blank lines, denoted by the nonterminal
1281*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt> in this specification) to
1282*7c568831SAndroid Build Coastguard Workerset apart the markup for greater readability.  Such white space is typically
1283*7c568831SAndroid Build Coastguard Workernot intended for inclusion in the delivered version of the document.
1284*7c568831SAndroid Build Coastguard WorkerOn the other hand, "significant" white space that should be preserved in the
1285*7c568831SAndroid Build Coastguard Workerdelivered version is common, for example in poetry and
1286*7c568831SAndroid Build Coastguard Workersource code.</p>
1287*7c568831SAndroid Build Coastguard Worker<p>An <termref def="dt-xml-proc">XML processor</termref>
1288*7c568831SAndroid Build Coastguard Workermust always pass all characters in a document that are not
1289*7c568831SAndroid Build Coastguard Workermarkup through to the application.   A <termref def="dt-validating">
1290*7c568831SAndroid Build Coastguard Workervalidating XML processor</termref> must also inform the application
1291*7c568831SAndroid Build Coastguard Workerwhich  of these characters constitute white space appearing
1292*7c568831SAndroid Build Coastguard Workerin <termref def="dt-elemcontent">element content</termref>.
1293*7c568831SAndroid Build Coastguard Worker</p>
1294*7c568831SAndroid Build Coastguard Worker<p>A special <termref def="dt-attr">attribute</termref>
1295*7c568831SAndroid Build Coastguard Workernamed <kw>xml:space</kw> may be attached to an element
1296*7c568831SAndroid Build Coastguard Workerto signal an intention that in that element,
1297*7c568831SAndroid Build Coastguard Workerwhite space should be preserved by applications.
1298*7c568831SAndroid Build Coastguard WorkerIn valid documents, this attribute, like any other, must be
1299*7c568831SAndroid Build Coastguard Worker<termref def="dt-attdecl">declared</termref> if it is used.
1300*7c568831SAndroid Build Coastguard WorkerWhen declared, it must be given as an
1301*7c568831SAndroid Build Coastguard Worker<termref def="dt-enumerated">enumerated type</termref> whose only
1302*7c568831SAndroid Build Coastguard Workerpossible values are "<code>default</code>" and "<code>preserve</code>".
1303*7c568831SAndroid Build Coastguard WorkerFor example:<eg><![CDATA[    <!ATTLIST poem   xml:space (default|preserve) 'preserve'>]]></eg></p>
1304*7c568831SAndroid Build Coastguard Worker<p>The value "<code>default</code>" signals that applications'
1305*7c568831SAndroid Build Coastguard Workerdefault white-space processing modes are acceptable for this element; the
1306*7c568831SAndroid Build Coastguard Workervalue "<code>preserve</code>" indicates the intent that applications preserve
1307*7c568831SAndroid Build Coastguard Workerall the white space.
1308*7c568831SAndroid Build Coastguard WorkerThis declared intent is considered to apply to all elements within the content
1309*7c568831SAndroid Build Coastguard Workerof the element where it is specified, unless overridden with another instance
1310*7c568831SAndroid Build Coastguard Workerof the <kw>xml:space</kw> attribute.
1311*7c568831SAndroid Build Coastguard Worker</p>
1312*7c568831SAndroid Build Coastguard Worker<p>The <termref def="dt-root">root element</termref> of any document
1313*7c568831SAndroid Build Coastguard Workeris considered to have signaled no intentions as regards application space
1314*7c568831SAndroid Build Coastguard Workerhandling, unless it provides a value for
1315*7c568831SAndroid Build Coastguard Workerthis attribute or the attribute is declared with a default value.
1316*7c568831SAndroid Build Coastguard Worker</p>
1317*7c568831SAndroid Build Coastguard Worker
1318*7c568831SAndroid Build Coastguard Worker</div2>
1319*7c568831SAndroid Build Coastguard Worker<div2 id="sec-line-ends">
1320*7c568831SAndroid Build Coastguard Worker<head>End-of-Line Handling</head>
1321*7c568831SAndroid Build Coastguard Worker<p>XML <termref def="dt-parsedent">parsed entities</termref> are often stored in
1322*7c568831SAndroid Build Coastguard Workercomputer files which, for editing convenience, are organized into lines.
1323*7c568831SAndroid Build Coastguard WorkerThese lines are typically separated by some combination of the characters
1324*7c568831SAndroid Build Coastguard Workercarriage-return (#xD) and line-feed (#xA).</p>
1325*7c568831SAndroid Build Coastguard Worker<p>To simplify the tasks of <termref def="dt-app">applications</termref>,
1326*7c568831SAndroid Build Coastguard Workerwherever an external parsed entity or the literal entity value
1327*7c568831SAndroid Build Coastguard Workerof an internal parsed entity contains either the literal
1328*7c568831SAndroid Build Coastguard Workertwo-character sequence "#xD#xA" or a standalone literal
1329*7c568831SAndroid Build Coastguard Worker#xD, an <termref def="dt-xml-proc">XML processor</termref> must
1330*7c568831SAndroid Build Coastguard Workerpass to the application the single character #xA.
1331*7c568831SAndroid Build Coastguard Worker(This behavior can
1332*7c568831SAndroid Build Coastguard Workerconveniently be produced by normalizing all
1333*7c568831SAndroid Build Coastguard Workerline breaks to #xA on input, before parsing.)
1334*7c568831SAndroid Build Coastguard Worker</p>
1335*7c568831SAndroid Build Coastguard Worker</div2>
1336*7c568831SAndroid Build Coastguard Worker<div2 id="sec-lang-tag">
1337*7c568831SAndroid Build Coastguard Worker<head>Language Identification</head>
1338*7c568831SAndroid Build Coastguard Worker<p>In document processing, it is often useful to
1339*7c568831SAndroid Build Coastguard Workeridentify the natural or formal language
1340*7c568831SAndroid Build Coastguard Workerin which the content is
1341*7c568831SAndroid Build Coastguard Workerwritten.
1342*7c568831SAndroid Build Coastguard WorkerA special <termref def="dt-attr">attribute</termref> named
1343*7c568831SAndroid Build Coastguard Worker<kw>xml:lang</kw> may be inserted in
1344*7c568831SAndroid Build Coastguard Workerdocuments to specify the
1345*7c568831SAndroid Build Coastguard Workerlanguage used in the contents and attribute values
1346*7c568831SAndroid Build Coastguard Workerof any element in an XML document.
1347*7c568831SAndroid Build Coastguard WorkerIn valid documents, this attribute, like any other, must be
1348*7c568831SAndroid Build Coastguard Worker<termref def="dt-attdecl">declared</termref> if it is used.
1349*7c568831SAndroid Build Coastguard WorkerThe values of the attribute are language identifiers as defined
1350*7c568831SAndroid Build Coastguard Workerby <bibref ref="RFC1766"/>, "Tags for the Identification of Languages":
1351*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1352*7c568831SAndroid Build Coastguard Worker<head>Language Identification</head>
1353*7c568831SAndroid Build Coastguard Worker<prod id="NT-LanguageID"><lhs>LanguageID</lhs>
1354*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Langcode">Langcode</nt>
1355*7c568831SAndroid Build Coastguard Worker('-' <nt def="NT-Subcode">Subcode</nt>)*</rhs></prod>
1356*7c568831SAndroid Build Coastguard Worker<prod id="NT-Langcode"><lhs>Langcode</lhs>
1357*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-ISO639Code">ISO639Code</nt> |
1358*7c568831SAndroid Build Coastguard Worker<nt def="NT-IanaCode">IanaCode</nt> |
1359*7c568831SAndroid Build Coastguard Worker<nt def="NT-UserCode">UserCode</nt></rhs>
1360*7c568831SAndroid Build Coastguard Worker</prod>
1361*7c568831SAndroid Build Coastguard Worker<prod id="NT-ISO639Code"><lhs>ISO639Code</lhs>
1362*7c568831SAndroid Build Coastguard Worker<rhs>([a-z] | [A-Z]) ([a-z] | [A-Z])</rhs></prod>
1363*7c568831SAndroid Build Coastguard Worker<prod id="NT-IanaCode"><lhs>IanaCode</lhs>
1364*7c568831SAndroid Build Coastguard Worker<rhs>('i' | 'I') '-' ([a-z] | [A-Z])+</rhs></prod>
1365*7c568831SAndroid Build Coastguard Worker<prod id="NT-UserCode"><lhs>UserCode</lhs>
1366*7c568831SAndroid Build Coastguard Worker<rhs>('x' | 'X') '-' ([a-z] | [A-Z])+</rhs></prod>
1367*7c568831SAndroid Build Coastguard Worker<prod id="NT-Subcode"><lhs>Subcode</lhs>
1368*7c568831SAndroid Build Coastguard Worker<rhs>([a-z] | [A-Z])+</rhs></prod>
1369*7c568831SAndroid Build Coastguard Worker</scrap>
1370*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Langcode">Langcode</nt> may be any of the following:
1371*7c568831SAndroid Build Coastguard Worker<ulist>
1372*7c568831SAndroid Build Coastguard Worker<item><p>a two-letter language code as defined by
1373*7c568831SAndroid Build Coastguard Worker<bibref ref="ISO639"/>, "Codes
1374*7c568831SAndroid Build Coastguard Workerfor the representation of names of languages"</p></item>
1375*7c568831SAndroid Build Coastguard Worker<item><p>a language identifier registered with the Internet
1376*7c568831SAndroid Build Coastguard WorkerAssigned Numbers Authority <bibref ref="IANA"/>; these begin with the
1377*7c568831SAndroid Build Coastguard Workerprefix "<code>i-</code>" (or "<code>I-</code>")</p></item>
1378*7c568831SAndroid Build Coastguard Worker<item><p>a language identifier assigned by the user, or agreed on
1379*7c568831SAndroid Build Coastguard Workerbetween parties in private use; these must begin with the
1380*7c568831SAndroid Build Coastguard Workerprefix "<code>x-</code>" or "<code>X-</code>" in order to ensure that they do not conflict
1381*7c568831SAndroid Build Coastguard Workerwith names later standardized or registered with IANA</p></item>
1382*7c568831SAndroid Build Coastguard Worker</ulist></p>
1383*7c568831SAndroid Build Coastguard Worker<p>There may be any number of <nt def="NT-Subcode">Subcode</nt> segments; if
1384*7c568831SAndroid Build Coastguard Workerthe first
1385*7c568831SAndroid Build Coastguard Workersubcode segment exists and the Subcode consists of two
1386*7c568831SAndroid Build Coastguard Workerletters, then it must be a country code from
1387*7c568831SAndroid Build Coastguard Worker<bibref ref="ISO3166"/>, "Codes
1388*7c568831SAndroid Build Coastguard Workerfor the representation of names of countries."
1389*7c568831SAndroid Build Coastguard WorkerIf the first
1390*7c568831SAndroid Build Coastguard Workersubcode consists of more than two letters, it must be
1391*7c568831SAndroid Build Coastguard Workera subcode for the language in question registered with IANA,
1392*7c568831SAndroid Build Coastguard Workerunless the <nt def="NT-Langcode">Langcode</nt> begins with the prefix
1393*7c568831SAndroid Build Coastguard Worker"<code>x-</code>" or
1394*7c568831SAndroid Build Coastguard Worker"<code>X-</code>". </p>
1395*7c568831SAndroid Build Coastguard Worker<p>It is customary to give the language code in lower case, and
1396*7c568831SAndroid Build Coastguard Workerthe country code (if any) in upper case.
1397*7c568831SAndroid Build Coastguard WorkerNote that these values, unlike other names in XML documents,
1398*7c568831SAndroid Build Coastguard Workerare case insensitive.</p>
1399*7c568831SAndroid Build Coastguard Worker<p>For example:
1400*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<p xml:lang="en">The quick brown fox jumps over the lazy dog.</p>
1401*7c568831SAndroid Build Coastguard Worker<p xml:lang="en-GB">What colour is it?</p>
1402*7c568831SAndroid Build Coastguard Worker<p xml:lang="en-US">What color is it?</p>
1403*7c568831SAndroid Build Coastguard Worker<sp who="Faust" desc='leise' xml:lang="de">
1404*7c568831SAndroid Build Coastguard Worker  <l>Habe nun, ach! Philosophie,</l>
1405*7c568831SAndroid Build Coastguard Worker  <l>Juristerei, und Medizin</l>
1406*7c568831SAndroid Build Coastguard Worker  <l>und leider auch Theologie</l>
1407*7c568831SAndroid Build Coastguard Worker  <l>durchaus studiert mit hei�em Bem�h'n.</l>
1408*7c568831SAndroid Build Coastguard Worker  </sp>]]></eg></p>
1409*7c568831SAndroid Build Coastguard Worker<!--<p>The xml:lang value is considered to apply both to the contents of an
1410*7c568831SAndroid Build Coastguard Workerelement and
1411*7c568831SAndroid Build Coastguard Worker(unless otherwise via attribute default values) to the
1412*7c568831SAndroid Build Coastguard Workervalues of all of its attributes with free-text (CDATA) values.  -->
1413*7c568831SAndroid Build Coastguard Worker<p>The intent declared with <kw>xml:lang</kw> is considered to apply to
1414*7c568831SAndroid Build Coastguard Workerall attributes and content of the element where it is specified,
1415*7c568831SAndroid Build Coastguard Workerunless overridden with an instance of <kw>xml:lang</kw>
1416*7c568831SAndroid Build Coastguard Workeron another element within that content.</p>
1417*7c568831SAndroid Build Coastguard Worker<!--
1418*7c568831SAndroid Build Coastguard WorkerIf no
1419*7c568831SAndroid Build Coastguard Workervalue is specified for xml:lang on an element, and no default value is
1420*7c568831SAndroid Build Coastguard Workerdefined for it in the DTD, then the xml:lang attribute of any element
1421*7c568831SAndroid Build Coastguard Workertakes the same value it has in the parent element, if any.  The two
1422*7c568831SAndroid Build Coastguard Workertechnical terms in the following example both have the same effective
1423*7c568831SAndroid Build Coastguard Workervalue for xml:lang:
1424*7c568831SAndroid Build Coastguard Worker
1425*7c568831SAndroid Build Coastguard Worker  <p xml:lang="en">Here the keywords are
1426*7c568831SAndroid Build Coastguard Worker  <term xml:lang="en">shift</term> and
1427*7c568831SAndroid Build Coastguard Worker  <term>reduce</term>. ...</p>
1428*7c568831SAndroid Build Coastguard Worker
1429*7c568831SAndroid Build Coastguard WorkerThe application, not the XML processor, is responsible for this '
1430*7c568831SAndroid Build Coastguard Workerinheritance' of attribute values.
1431*7c568831SAndroid Build Coastguard Worker-->
1432*7c568831SAndroid Build Coastguard Worker<p>A simple declaration for <kw>xml:lang</kw> might take
1433*7c568831SAndroid Build Coastguard Workerthe form
1434*7c568831SAndroid Build Coastguard Worker<eg>xml:lang  NMTOKEN  #IMPLIED</eg>
1435*7c568831SAndroid Build Coastguard Workerbut specific default values may also be given, if appropriate.  In a
1436*7c568831SAndroid Build Coastguard Workercollection of French poems for English students, with glosses and
1437*7c568831SAndroid Build Coastguard Workernotes in English, the xml:lang attribute might be declared this way:
1438*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[    <!ATTLIST poem   xml:lang NMTOKEN 'fr'>
1439*7c568831SAndroid Build Coastguard Worker    <!ATTLIST gloss  xml:lang NMTOKEN 'en'>
1440*7c568831SAndroid Build Coastguard Worker    <!ATTLIST note   xml:lang NMTOKEN 'en'>]]></eg>
1441*7c568831SAndroid Build Coastguard Worker</p>
1442*7c568831SAndroid Build Coastguard Worker
1443*7c568831SAndroid Build Coastguard Worker</div2>
1444*7c568831SAndroid Build Coastguard Worker</div1>
1445*7c568831SAndroid Build Coastguard Worker<!-- &Elements; -->
1446*7c568831SAndroid Build Coastguard Worker
1447*7c568831SAndroid Build Coastguard Worker<div1 id="sec-logical-struct">
1448*7c568831SAndroid Build Coastguard Worker<head>Logical Structures</head>
1449*7c568831SAndroid Build Coastguard Worker
1450*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-element" term="Element">Each <termref def="dt-xml-doc">XML document</termref> contains one or more
1451*7c568831SAndroid Build Coastguard Worker<term>elements</term>, the boundaries of which are
1452*7c568831SAndroid Build Coastguard Workereither delimited by <termref def="dt-stag">start-tags</termref>
1453*7c568831SAndroid Build Coastguard Workerand <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,
1454*7c568831SAndroid Build Coastguard Workeridentified by name, sometimes called its "generic
1455*7c568831SAndroid Build Coastguard Workeridentifier" (GI), and may have a set of
1456*7c568831SAndroid Build Coastguard Workerattribute specifications.</termdef>  Each attribute specification
1457*7c568831SAndroid Build Coastguard Workerhas a <termref def="dt-attrname">name</termref> and a <termref def="dt-attrval">value</termref>.
1458*7c568831SAndroid Build Coastguard Worker</p>
1459*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf"><head>Element</head>
1460*7c568831SAndroid Build Coastguard Worker<prod id="NT-element"><lhs>element</lhs>
1461*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-EmptyElemTag">EmptyElemTag</nt></rhs>
1462*7c568831SAndroid Build Coastguard Worker<rhs>| <nt def="NT-STag">STag</nt> <nt def="NT-content">content</nt>
1463*7c568831SAndroid Build Coastguard Worker<nt def="NT-ETag">ETag</nt></rhs>
1464*7c568831SAndroid Build Coastguard Worker<wfc def="GIMatch"/>
1465*7c568831SAndroid Build Coastguard Worker<vc def="elementvalid"/>
1466*7c568831SAndroid Build Coastguard Worker</prod>
1467*7c568831SAndroid Build Coastguard Worker</scrap>
1468*7c568831SAndroid Build Coastguard Worker<p>This specification does not constrain the semantics, use, or (beyond
1469*7c568831SAndroid Build Coastguard Workersyntax) names of the element types and attributes, except that names
1470*7c568831SAndroid Build Coastguard Workerbeginning with a match to <code>(('X'|'x')('M'|'m')('L'|'l'))</code>
1471*7c568831SAndroid Build Coastguard Workerare reserved for standardization in this or future versions of this
1472*7c568831SAndroid Build Coastguard Workerspecification.
1473*7c568831SAndroid Build Coastguard Worker</p>
1474*7c568831SAndroid Build Coastguard Worker<wfcnote id="GIMatch">
1475*7c568831SAndroid Build Coastguard Worker<head>Element Type Match</head>
1476*7c568831SAndroid Build Coastguard Worker<p>
1477*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> in an element's end-tag must match
1478*7c568831SAndroid Build Coastguard Workerthe element type in
1479*7c568831SAndroid Build Coastguard Workerthe start-tag.
1480*7c568831SAndroid Build Coastguard Worker</p>
1481*7c568831SAndroid Build Coastguard Worker</wfcnote>
1482*7c568831SAndroid Build Coastguard Worker<vcnote id="elementvalid">
1483*7c568831SAndroid Build Coastguard Worker<head>Element Valid</head>
1484*7c568831SAndroid Build Coastguard Worker<p>An element is
1485*7c568831SAndroid Build Coastguard Workervalid if
1486*7c568831SAndroid Build Coastguard Workerthere is a declaration matching
1487*7c568831SAndroid Build Coastguard Worker<nt def="NT-elementdecl">elementdecl</nt> where the
1488*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt> matches the element type, and
1489*7c568831SAndroid Build Coastguard Workerone of the following holds:</p>
1490*7c568831SAndroid Build Coastguard Worker<olist>
1491*7c568831SAndroid Build Coastguard Worker<item><p>The declaration matches <kw>EMPTY</kw> and the element has no
1492*7c568831SAndroid Build Coastguard Worker<termref def="dt-content">content</termref>.</p></item>
1493*7c568831SAndroid Build Coastguard Worker<item><p>The declaration matches <nt def="NT-children">children</nt> and
1494*7c568831SAndroid Build Coastguard Workerthe sequence of
1495*7c568831SAndroid Build Coastguard Worker<termref def="dt-parentchild">child elements</termref>
1496*7c568831SAndroid Build Coastguard Workerbelongs to the language generated by the regular expression in
1497*7c568831SAndroid Build Coastguard Workerthe content model, with optional white space (characters
1498*7c568831SAndroid Build Coastguard Workermatching the nonterminal <nt def="NT-S">S</nt>) between each pair
1499*7c568831SAndroid Build Coastguard Workerof child elements.</p></item>
1500*7c568831SAndroid Build Coastguard Worker<item><p>The declaration matches <nt def="NT-Mixed">Mixed</nt> and
1501*7c568831SAndroid Build Coastguard Workerthe content consists of <termref def="dt-chardata">character
1502*7c568831SAndroid Build Coastguard Workerdata</termref> and <termref def="dt-parentchild">child elements</termref>
1503*7c568831SAndroid Build Coastguard Workerwhose types match names in the content model.</p></item>
1504*7c568831SAndroid Build Coastguard Worker<item><p>The declaration matches <kw>ANY</kw>, and the types
1505*7c568831SAndroid Build Coastguard Workerof any <termref def="dt-parentchild">child elements</termref> have
1506*7c568831SAndroid Build Coastguard Workerbeen declared.</p></item>
1507*7c568831SAndroid Build Coastguard Worker</olist>
1508*7c568831SAndroid Build Coastguard Worker</vcnote>
1509*7c568831SAndroid Build Coastguard Worker
1510*7c568831SAndroid Build Coastguard Worker<div2 id="sec-starttags">
1511*7c568831SAndroid Build Coastguard Worker<head>Start-Tags, End-Tags, and Empty-Element Tags</head>
1512*7c568831SAndroid Build Coastguard Worker
1513*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-stag" term="Start-Tag">The beginning of every
1514*7c568831SAndroid Build Coastguard Workernon-empty XML element is marked by a <term>start-tag</term>.
1515*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1516*7c568831SAndroid Build Coastguard Worker<head>Start-tag</head>
1517*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
1518*7c568831SAndroid Build Coastguard Worker<prod id="NT-STag"><lhs>STag</lhs>
1519*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;' <nt def="NT-Name">Name</nt>
1520*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt> <nt def="NT-Attribute">Attribute</nt>)*
1521*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs>
1522*7c568831SAndroid Build Coastguard Worker<wfc def="uniqattspec"/>
1523*7c568831SAndroid Build Coastguard Worker</prod>
1524*7c568831SAndroid Build Coastguard Worker<prod id="NT-Attribute"><lhs>Attribute</lhs>
1525*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Name">Name</nt> <nt def="NT-Eq">Eq</nt>
1526*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt></rhs>
1527*7c568831SAndroid Build Coastguard Worker<vc def="ValueType"/>
1528*7c568831SAndroid Build Coastguard Worker<wfc def="NoExternalRefs"/>
1529*7c568831SAndroid Build Coastguard Worker<wfc def="CleanAttrVals"/></prod>
1530*7c568831SAndroid Build Coastguard Worker</prodgroup>
1531*7c568831SAndroid Build Coastguard Worker</scrap>
1532*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> in
1533*7c568831SAndroid Build Coastguard Workerthe start- and end-tags gives the
1534*7c568831SAndroid Build Coastguard Workerelement's <term>type</term>.</termdef>
1535*7c568831SAndroid Build Coastguard Worker<termdef id="dt-attr" term="Attribute">
1536*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt>-<nt def="NT-AttValue">AttValue</nt> pairs are
1537*7c568831SAndroid Build Coastguard Workerreferred to as
1538*7c568831SAndroid Build Coastguard Workerthe <term>attribute specifications</term> of the element</termdef>,
1539*7c568831SAndroid Build Coastguard Worker<termdef id="dt-attrname" term="Attribute Name">with the
1540*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt> in each pair
1541*7c568831SAndroid Build Coastguard Workerreferred to as the <term>attribute name</term></termdef> and
1542*7c568831SAndroid Build Coastguard Worker<termdef id="dt-attrval" term="Attribute Value">the content of the
1543*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt> (the text between the
1544*7c568831SAndroid Build Coastguard Worker<code>'</code> or <code>"</code> delimiters)
1545*7c568831SAndroid Build Coastguard Workeras the <term>attribute value</term>.</termdef>
1546*7c568831SAndroid Build Coastguard Worker</p>
1547*7c568831SAndroid Build Coastguard Worker<wfcnote id="uniqattspec">
1548*7c568831SAndroid Build Coastguard Worker<head>Unique Att Spec</head>
1549*7c568831SAndroid Build Coastguard Worker<p>
1550*7c568831SAndroid Build Coastguard WorkerNo attribute name may appear more than once in the same start-tag
1551*7c568831SAndroid Build Coastguard Workeror empty-element tag.
1552*7c568831SAndroid Build Coastguard Worker</p>
1553*7c568831SAndroid Build Coastguard Worker</wfcnote>
1554*7c568831SAndroid Build Coastguard Worker<vcnote id="ValueType">
1555*7c568831SAndroid Build Coastguard Worker<head>Attribute Value Type</head>
1556*7c568831SAndroid Build Coastguard Worker<p>
1557*7c568831SAndroid Build Coastguard WorkerThe attribute must have been declared; the value must be of the type
1558*7c568831SAndroid Build Coastguard Workerdeclared for it.
1559*7c568831SAndroid Build Coastguard Worker(For attribute types, see <specref ref="attdecls"/>.)
1560*7c568831SAndroid Build Coastguard Worker</p>
1561*7c568831SAndroid Build Coastguard Worker</vcnote>
1562*7c568831SAndroid Build Coastguard Worker<wfcnote id="NoExternalRefs">
1563*7c568831SAndroid Build Coastguard Worker<head>No External Entity References</head>
1564*7c568831SAndroid Build Coastguard Worker<p>
1565*7c568831SAndroid Build Coastguard WorkerAttribute values cannot contain direct or indirect entity references
1566*7c568831SAndroid Build Coastguard Workerto external entities.
1567*7c568831SAndroid Build Coastguard Worker</p>
1568*7c568831SAndroid Build Coastguard Worker</wfcnote>
1569*7c568831SAndroid Build Coastguard Worker<wfcnote id="CleanAttrVals">
1570*7c568831SAndroid Build Coastguard Worker<head>No <code>&lt;</code> in Attribute Values</head>
1571*7c568831SAndroid Build Coastguard Worker<p>The <termref def="dt-repltext">replacement text</termref> of any entity
1572*7c568831SAndroid Build Coastguard Workerreferred to directly or indirectly in an attribute
1573*7c568831SAndroid Build Coastguard Workervalue (other than "<code>&amp;lt;</code>") must not contain
1574*7c568831SAndroid Build Coastguard Workera <code>&lt;</code>.
1575*7c568831SAndroid Build Coastguard Worker</p></wfcnote>
1576*7c568831SAndroid Build Coastguard Worker<p>An example of a start-tag:
1577*7c568831SAndroid Build Coastguard Worker<eg>&lt;termdef id="dt-dog" term="dog"&gt;</eg></p>
1578*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-etag" term="End Tag">The end of every element
1579*7c568831SAndroid Build Coastguard Workerthat begins with a start-tag must
1580*7c568831SAndroid Build Coastguard Workerbe marked by an <term>end-tag</term>
1581*7c568831SAndroid Build Coastguard Workercontaining a name that echoes the element's type as given in the
1582*7c568831SAndroid Build Coastguard Workerstart-tag:
1583*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1584*7c568831SAndroid Build Coastguard Worker<head>End-tag</head>
1585*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
1586*7c568831SAndroid Build Coastguard Worker<prod id="NT-ETag"><lhs>ETag</lhs>
1587*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;/' <nt def="NT-Name">Name</nt>
1588*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs></prod>
1589*7c568831SAndroid Build Coastguard Worker</prodgroup>
1590*7c568831SAndroid Build Coastguard Worker</scrap>
1591*7c568831SAndroid Build Coastguard Worker</termdef></p>
1592*7c568831SAndroid Build Coastguard Worker<p>An example of an end-tag:<eg>&lt;/termdef&gt;</eg></p>
1593*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-content" term="Content">The
1594*7c568831SAndroid Build Coastguard Worker<termref def="dt-text">text</termref> between the start-tag and
1595*7c568831SAndroid Build Coastguard Workerend-tag is called the element's
1596*7c568831SAndroid Build Coastguard Worker<term>content</term>:
1597*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1598*7c568831SAndroid Build Coastguard Worker<head>Content of Elements</head>
1599*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
1600*7c568831SAndroid Build Coastguard Worker<prod id="NT-content"><lhs>content</lhs>
1601*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-element">element</nt> | <nt def="NT-CharData">CharData</nt>
1602*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Reference">Reference</nt> | <nt def="NT-CDSect">CDSect</nt>
1603*7c568831SAndroid Build Coastguard Worker| <nt def="NT-PI">PI</nt> | <nt def="NT-Comment">Comment</nt>)*</rhs>
1604*7c568831SAndroid Build Coastguard Worker</prod>
1605*7c568831SAndroid Build Coastguard Worker</prodgroup>
1606*7c568831SAndroid Build Coastguard Worker</scrap>
1607*7c568831SAndroid Build Coastguard Worker</termdef></p>
1608*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-empty" term="Empty">If an element is <term>empty</term>,
1609*7c568831SAndroid Build Coastguard Workerit must be represented either by a start-tag immediately followed
1610*7c568831SAndroid Build Coastguard Workerby an end-tag or by an empty-element tag.</termdef>
1611*7c568831SAndroid Build Coastguard Worker<termdef id="dt-eetag" term="empty-element tag">An
1612*7c568831SAndroid Build Coastguard Worker<term>empty-element tag</term> takes a special form:
1613*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1614*7c568831SAndroid Build Coastguard Worker<head>Tags for Empty Elements</head>
1615*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="6" pcw4="15" pcw5="11.5">
1616*7c568831SAndroid Build Coastguard Worker<prod id="NT-EmptyElemTag"><lhs>EmptyElemTag</lhs>
1617*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;' <nt def="NT-Name">Name</nt> (<nt def="NT-S">S</nt>
1618*7c568831SAndroid Build Coastguard Worker<nt def="NT-Attribute">Attribute</nt>)* <nt def="NT-S">S</nt>?
1619*7c568831SAndroid Build Coastguard Worker'/&gt;'</rhs>
1620*7c568831SAndroid Build Coastguard Worker<wfc def="uniqattspec"/>
1621*7c568831SAndroid Build Coastguard Worker</prod>
1622*7c568831SAndroid Build Coastguard Worker</prodgroup>
1623*7c568831SAndroid Build Coastguard Worker</scrap>
1624*7c568831SAndroid Build Coastguard Worker</termdef></p>
1625*7c568831SAndroid Build Coastguard Worker<p>Empty-element tags may be used for any element which has no
1626*7c568831SAndroid Build Coastguard Workercontent, whether or not it is declared using the keyword
1627*7c568831SAndroid Build Coastguard Worker<kw>EMPTY</kw>.
1628*7c568831SAndroid Build Coastguard Worker<termref def="dt-interop">For interoperability</termref>, the empty-element
1629*7c568831SAndroid Build Coastguard Workertag must be used, and can only be used, for elements which are
1630*7c568831SAndroid Build Coastguard Worker<termref def="dt-eldecl">declared</termref> <kw>EMPTY</kw>.</p>
1631*7c568831SAndroid Build Coastguard Worker<p>Examples of empty elements:
1632*7c568831SAndroid Build Coastguard Worker<eg>&lt;IMG align="left"
1633*7c568831SAndroid Build Coastguard Worker src="http://www.w3.org/Icons/WWW/w3c_home" /&gt;
1634*7c568831SAndroid Build Coastguard Worker&lt;br&gt;&lt;/br&gt;
1635*7c568831SAndroid Build Coastguard Worker&lt;br/&gt;</eg></p>
1636*7c568831SAndroid Build Coastguard Worker</div2>
1637*7c568831SAndroid Build Coastguard Worker
1638*7c568831SAndroid Build Coastguard Worker<div2 id="elemdecls">
1639*7c568831SAndroid Build Coastguard Worker<head>Element Type Declarations</head>
1640*7c568831SAndroid Build Coastguard Worker
1641*7c568831SAndroid Build Coastguard Worker<p>The <termref def="dt-element">element</termref> structure of an
1642*7c568831SAndroid Build Coastguard Worker<termref def="dt-xml-doc">XML document</termref> may, for
1643*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">validation</termref> purposes,
1644*7c568831SAndroid Build Coastguard Workerbe constrained
1645*7c568831SAndroid Build Coastguard Workerusing element type and attribute-list declarations.
1646*7c568831SAndroid Build Coastguard WorkerAn element type declaration constrains the element's
1647*7c568831SAndroid Build Coastguard Worker<termref def="dt-content">content</termref>.
1648*7c568831SAndroid Build Coastguard Worker</p>
1649*7c568831SAndroid Build Coastguard Worker
1650*7c568831SAndroid Build Coastguard Worker<p>Element type declarations often constrain which element types can
1651*7c568831SAndroid Build Coastguard Workerappear as <termref def="dt-parentchild">children</termref> of the element.
1652*7c568831SAndroid Build Coastguard WorkerAt user option, an XML processor may issue a warning
1653*7c568831SAndroid Build Coastguard Workerwhen a declaration mentions an element type for which no declaration
1654*7c568831SAndroid Build Coastguard Workeris provided, but this is not an error.</p>
1655*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-eldecl" term="Element Type declaration">An <term>element
1656*7c568831SAndroid Build Coastguard Workertype declaration</term> takes the form:
1657*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1658*7c568831SAndroid Build Coastguard Worker<head>Element Type Declaration</head>
1659*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="5.5" pcw4="18" pcw5="9">
1660*7c568831SAndroid Build Coastguard Worker<prod id="NT-elementdecl"><lhs>elementdecl</lhs>
1661*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!ELEMENT' <nt def="NT-S">S</nt>
1662*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt>
1663*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>
1664*7c568831SAndroid Build Coastguard Worker<nt def="NT-contentspec">contentspec</nt>
1665*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs>
1666*7c568831SAndroid Build Coastguard Worker<vc def="EDUnique"/></prod>
1667*7c568831SAndroid Build Coastguard Worker<prod id="NT-contentspec"><lhs>contentspec</lhs>
1668*7c568831SAndroid Build Coastguard Worker<rhs>'EMPTY'
1669*7c568831SAndroid Build Coastguard Worker| 'ANY'
1670*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Mixed">Mixed</nt>
1671*7c568831SAndroid Build Coastguard Worker| <nt def="NT-children">children</nt>
1672*7c568831SAndroid Build Coastguard Worker</rhs>
1673*7c568831SAndroid Build Coastguard Worker</prod>
1674*7c568831SAndroid Build Coastguard Worker</prodgroup>
1675*7c568831SAndroid Build Coastguard Worker</scrap>
1676*7c568831SAndroid Build Coastguard Workerwhere the <nt def="NT-Name">Name</nt> gives the element type
1677*7c568831SAndroid Build Coastguard Workerbeing declared.</termdef>
1678*7c568831SAndroid Build Coastguard Worker</p>
1679*7c568831SAndroid Build Coastguard Worker
1680*7c568831SAndroid Build Coastguard Worker<vcnote id="EDUnique">
1681*7c568831SAndroid Build Coastguard Worker<head>Unique Element Type Declaration</head>
1682*7c568831SAndroid Build Coastguard Worker<p>
1683*7c568831SAndroid Build Coastguard WorkerNo element type may be declared more than once.
1684*7c568831SAndroid Build Coastguard Worker</p>
1685*7c568831SAndroid Build Coastguard Worker</vcnote>
1686*7c568831SAndroid Build Coastguard Worker
1687*7c568831SAndroid Build Coastguard Worker<p>Examples of element type declarations:
1688*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ELEMENT br EMPTY&gt;
1689*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT p (#PCDATA|emph)* &gt;
1690*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT %name.para; %content.para; &gt;
1691*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT container ANY&gt;</eg></p>
1692*7c568831SAndroid Build Coastguard Worker
1693*7c568831SAndroid Build Coastguard Worker<div3 id="sec-element-content">
1694*7c568831SAndroid Build Coastguard Worker<head>Element Content</head>
1695*7c568831SAndroid Build Coastguard Worker
1696*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-elemcontent" term="Element content">An element <termref def="dt-stag">type</termref> has
1697*7c568831SAndroid Build Coastguard Worker<term>element content</term> when elements of that
1698*7c568831SAndroid Build Coastguard Workertype must contain only <termref def="dt-parentchild">child</termref>
1699*7c568831SAndroid Build Coastguard Workerelements (no character data), optionally separated by
1700*7c568831SAndroid Build Coastguard Workerwhite space (characters matching the nonterminal
1701*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>).
1702*7c568831SAndroid Build Coastguard Worker</termdef>
1703*7c568831SAndroid Build Coastguard WorkerIn this case, the
1704*7c568831SAndroid Build Coastguard Workerconstraint includes a content model, a simple grammar governing
1705*7c568831SAndroid Build Coastguard Workerthe allowed types of the child
1706*7c568831SAndroid Build Coastguard Workerelements and the order in which they are allowed to appear.
1707*7c568831SAndroid Build Coastguard WorkerThe grammar is built on
1708*7c568831SAndroid Build Coastguard Workercontent particles (<nt def="NT-cp">cp</nt>s), which consist of names,
1709*7c568831SAndroid Build Coastguard Workerchoice lists of content particles, or
1710*7c568831SAndroid Build Coastguard Workersequence lists of content particles:
1711*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1712*7c568831SAndroid Build Coastguard Worker<head>Element-content Models</head>
1713*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="5.5" pcw4="16" pcw5="11">
1714*7c568831SAndroid Build Coastguard Worker<prod id="NT-children"><lhs>children</lhs>
1715*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-choice">choice</nt>
1716*7c568831SAndroid Build Coastguard Worker| <nt def="NT-seq">seq</nt>)
1717*7c568831SAndroid Build Coastguard Worker('?' | '*' | '+')?</rhs></prod>
1718*7c568831SAndroid Build Coastguard Worker<prod id="NT-cp"><lhs>cp</lhs>
1719*7c568831SAndroid Build Coastguard Worker<rhs>(<nt def="NT-Name">Name</nt>
1720*7c568831SAndroid Build Coastguard Worker| <nt def="NT-choice">choice</nt>
1721*7c568831SAndroid Build Coastguard Worker| <nt def="NT-seq">seq</nt>)
1722*7c568831SAndroid Build Coastguard Worker('?' | '*' | '+')?</rhs></prod>
1723*7c568831SAndroid Build Coastguard Worker<prod id="NT-choice"><lhs>choice</lhs>
1724*7c568831SAndroid Build Coastguard Worker<rhs>'(' <nt def="NT-S">S</nt>? cp
1725*7c568831SAndroid Build Coastguard Worker( <nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )*
1726*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? ')'</rhs>
1727*7c568831SAndroid Build Coastguard Worker<vc def="vc-PEinGroup"/></prod>
1728*7c568831SAndroid Build Coastguard Worker<prod id="NT-seq"><lhs>seq</lhs>
1729*7c568831SAndroid Build Coastguard Worker<rhs>'(' <nt def="NT-S">S</nt>? cp
1730*7c568831SAndroid Build Coastguard Worker( <nt def="NT-S">S</nt>? ',' <nt def="NT-S">S</nt>? <nt def="NT-cp">cp</nt> )*
1731*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? ')'</rhs>
1732*7c568831SAndroid Build Coastguard Worker<vc def="vc-PEinGroup"/></prod>
1733*7c568831SAndroid Build Coastguard Worker
1734*7c568831SAndroid Build Coastguard Worker</prodgroup>
1735*7c568831SAndroid Build Coastguard Worker</scrap>
1736*7c568831SAndroid Build Coastguard Workerwhere each <nt def="NT-Name">Name</nt> is the type of an element which may
1737*7c568831SAndroid Build Coastguard Workerappear as a <termref def="dt-parentchild">child</termref>.
1738*7c568831SAndroid Build Coastguard WorkerAny content
1739*7c568831SAndroid Build Coastguard Workerparticle in a choice list may appear in the <termref def="dt-elemcontent">element content</termref> at the location where
1740*7c568831SAndroid Build Coastguard Workerthe choice list appears in the grammar;
1741*7c568831SAndroid Build Coastguard Workercontent particles occurring in a sequence list must each
1742*7c568831SAndroid Build Coastguard Workerappear in the <termref def="dt-elemcontent">element content</termref> in the
1743*7c568831SAndroid Build Coastguard Workerorder given in the list.
1744*7c568831SAndroid Build Coastguard WorkerThe optional character following a name or list governs
1745*7c568831SAndroid Build Coastguard Workerwhether the element or the content particles in the list may occur one
1746*7c568831SAndroid Build Coastguard Workeror more (<code>+</code>), zero or more (<code>*</code>), or zero or
1747*7c568831SAndroid Build Coastguard Workerone times (<code>?</code>).
1748*7c568831SAndroid Build Coastguard WorkerThe absence of such an operator means that the element or content particle
1749*7c568831SAndroid Build Coastguard Workermust appear exactly once.
1750*7c568831SAndroid Build Coastguard WorkerThis syntax
1751*7c568831SAndroid Build Coastguard Workerand meaning are identical to those used in the productions in this
1752*7c568831SAndroid Build Coastguard Workerspecification.</p>
1753*7c568831SAndroid Build Coastguard Worker<p>
1754*7c568831SAndroid Build Coastguard WorkerThe content of an element matches a content model if and only if it is
1755*7c568831SAndroid Build Coastguard Workerpossible to trace out a path through the content model, obeying the
1756*7c568831SAndroid Build Coastguard Workersequence, choice, and repetition operators and matching each element in
1757*7c568831SAndroid Build Coastguard Workerthe content against an element type in the content model.  <termref def="dt-compat">For compatibility</termref>, it is an error
1758*7c568831SAndroid Build Coastguard Workerif an element in the document can
1759*7c568831SAndroid Build Coastguard Workermatch more than one occurrence of an element type in the content model.
1760*7c568831SAndroid Build Coastguard WorkerFor more information, see <specref ref="determinism"/>.
1761*7c568831SAndroid Build Coastguard Worker<!-- appendix <specref ref="determinism"/>. -->
1762*7c568831SAndroid Build Coastguard Worker<!-- appendix on deterministic content models. -->
1763*7c568831SAndroid Build Coastguard Worker</p>
1764*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-PEinGroup">
1765*7c568831SAndroid Build Coastguard Worker<head>Proper Group/PE Nesting</head>
1766*7c568831SAndroid Build Coastguard Worker<p>Parameter-entity
1767*7c568831SAndroid Build Coastguard Worker<termref def="dt-repltext">replacement text</termref> must be properly nested
1768*7c568831SAndroid Build Coastguard Workerwith parenthetized groups.
1769*7c568831SAndroid Build Coastguard WorkerThat is to say, if either of the opening or closing parentheses
1770*7c568831SAndroid Build Coastguard Workerin a <nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or
1771*7c568831SAndroid Build Coastguard Worker<nt def="NT-Mixed">Mixed</nt> construct
1772*7c568831SAndroid Build Coastguard Workeris contained in the replacement text for a
1773*7c568831SAndroid Build Coastguard Worker<termref def="dt-PERef">parameter entity</termref>,
1774*7c568831SAndroid Build Coastguard Workerboth must be contained in the same replacement text.</p>
1775*7c568831SAndroid Build Coastguard Worker<p><termref def="dt-interop">For interoperability</termref>,
1776*7c568831SAndroid Build Coastguard Workerif a parameter-entity reference appears in a
1777*7c568831SAndroid Build Coastguard Worker<nt def="NT-choice">choice</nt>, <nt def="NT-seq">seq</nt>, or
1778*7c568831SAndroid Build Coastguard Worker<nt def="NT-Mixed">Mixed</nt> construct, its replacement text
1779*7c568831SAndroid Build Coastguard Workershould not be empty, and
1780*7c568831SAndroid Build Coastguard Workerneither the first nor last non-blank
1781*7c568831SAndroid Build Coastguard Workercharacter of the replacement text should be a connector
1782*7c568831SAndroid Build Coastguard Worker(<code>|</code> or <code>,</code>).
1783*7c568831SAndroid Build Coastguard Worker</p>
1784*7c568831SAndroid Build Coastguard Worker</vcnote>
1785*7c568831SAndroid Build Coastguard Worker<p>Examples of element-content models:
1786*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ELEMENT spec (front, body, back?)&gt;
1787*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT div1 (head, (p | list | note)*, div2*)&gt;
1788*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*&gt;</eg></p>
1789*7c568831SAndroid Build Coastguard Worker</div3>
1790*7c568831SAndroid Build Coastguard Worker
1791*7c568831SAndroid Build Coastguard Worker<div3 id="sec-mixed-content">
1792*7c568831SAndroid Build Coastguard Worker<head>Mixed Content</head>
1793*7c568831SAndroid Build Coastguard Worker
1794*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-mixed" term="Mixed Content">An element
1795*7c568831SAndroid Build Coastguard Worker<termref def="dt-stag">type</termref> has
1796*7c568831SAndroid Build Coastguard Worker<term>mixed content</term> when elements of that type may contain
1797*7c568831SAndroid Build Coastguard Workercharacter data, optionally interspersed with
1798*7c568831SAndroid Build Coastguard Worker<termref def="dt-parentchild">child</termref> elements.</termdef>
1799*7c568831SAndroid Build Coastguard WorkerIn this case, the types of the child elements
1800*7c568831SAndroid Build Coastguard Workermay be constrained, but not their order or their number of occurrences:
1801*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1802*7c568831SAndroid Build Coastguard Worker<head>Mixed-content Declaration</head>
1803*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="5.5" pcw4="16" pcw5="11">
1804*7c568831SAndroid Build Coastguard Worker<prod id="NT-Mixed"><lhs>Mixed</lhs>
1805*7c568831SAndroid Build Coastguard Worker<rhs>'(' <nt def="NT-S">S</nt>?
1806*7c568831SAndroid Build Coastguard Worker'#PCDATA'
1807*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt>?
1808*7c568831SAndroid Build Coastguard Worker'|'
1809*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
1810*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt>)*
1811*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
1812*7c568831SAndroid Build Coastguard Worker')*' </rhs>
1813*7c568831SAndroid Build Coastguard Worker<rhs>| '(' <nt def="NT-S">S</nt>? '#PCDATA' <nt def="NT-S">S</nt>? ')'
1814*7c568831SAndroid Build Coastguard Worker</rhs><vc def="vc-PEinGroup"/>
1815*7c568831SAndroid Build Coastguard Worker<vc def="vc-MixedChildrenUnique"/>
1816*7c568831SAndroid Build Coastguard Worker</prod>
1817*7c568831SAndroid Build Coastguard Worker
1818*7c568831SAndroid Build Coastguard Worker</prodgroup>
1819*7c568831SAndroid Build Coastguard Worker</scrap>
1820*7c568831SAndroid Build Coastguard Workerwhere the <nt def="NT-Name">Name</nt>s give the types of elements
1821*7c568831SAndroid Build Coastguard Workerthat may appear as children.
1822*7c568831SAndroid Build Coastguard Worker</p>
1823*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-MixedChildrenUnique">
1824*7c568831SAndroid Build Coastguard Worker<head>No Duplicate Types</head>
1825*7c568831SAndroid Build Coastguard Worker<p>The same name must not appear more than once in a single mixed-content
1826*7c568831SAndroid Build Coastguard Workerdeclaration.
1827*7c568831SAndroid Build Coastguard Worker</p></vcnote>
1828*7c568831SAndroid Build Coastguard Worker<p>Examples of mixed content declarations:
1829*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;
1830*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* &gt;
1831*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT b (#PCDATA)&gt;</eg></p>
1832*7c568831SAndroid Build Coastguard Worker</div3>
1833*7c568831SAndroid Build Coastguard Worker</div2>
1834*7c568831SAndroid Build Coastguard Worker
1835*7c568831SAndroid Build Coastguard Worker<div2 id="attdecls">
1836*7c568831SAndroid Build Coastguard Worker<head>Attribute-List Declarations</head>
1837*7c568831SAndroid Build Coastguard Worker
1838*7c568831SAndroid Build Coastguard Worker<p><termref def="dt-attr">Attributes</termref> are used to associate
1839*7c568831SAndroid Build Coastguard Workername-value pairs with <termref def="dt-element">elements</termref>.
1840*7c568831SAndroid Build Coastguard WorkerAttribute specifications may appear only within <termref def="dt-stag">start-tags</termref>
1841*7c568831SAndroid Build Coastguard Workerand <termref def="dt-eetag">empty-element tags</termref>;
1842*7c568831SAndroid Build Coastguard Workerthus, the productions used to
1843*7c568831SAndroid Build Coastguard Workerrecognize them appear in <specref ref="sec-starttags"/>.
1844*7c568831SAndroid Build Coastguard WorkerAttribute-list
1845*7c568831SAndroid Build Coastguard Workerdeclarations may be used:
1846*7c568831SAndroid Build Coastguard Worker<ulist>
1847*7c568831SAndroid Build Coastguard Worker<item><p>To define the set of attributes pertaining to a given
1848*7c568831SAndroid Build Coastguard Workerelement type.</p></item>
1849*7c568831SAndroid Build Coastguard Worker<item><p>To establish type constraints for these
1850*7c568831SAndroid Build Coastguard Workerattributes.</p></item>
1851*7c568831SAndroid Build Coastguard Worker<item><p>To provide <termref def="dt-default">default values</termref>
1852*7c568831SAndroid Build Coastguard Workerfor attributes.</p></item>
1853*7c568831SAndroid Build Coastguard Worker</ulist>
1854*7c568831SAndroid Build Coastguard Worker</p>
1855*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-attdecl" term="Attribute-List Declaration">
1856*7c568831SAndroid Build Coastguard Worker<term>Attribute-list declarations</term> specify the name, data type, and default
1857*7c568831SAndroid Build Coastguard Workervalue (if any) of each attribute associated with a given element type:
1858*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1859*7c568831SAndroid Build Coastguard Worker<head>Attribute-list Declaration</head>
1860*7c568831SAndroid Build Coastguard Worker<prod id="NT-AttlistDecl"><lhs>AttlistDecl</lhs>
1861*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!ATTLIST' <nt def="NT-S">S</nt>
1862*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt>
1863*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttDef">AttDef</nt>*
1864*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs>
1865*7c568831SAndroid Build Coastguard Worker</prod>
1866*7c568831SAndroid Build Coastguard Worker<prod id="NT-AttDef"><lhs>AttDef</lhs>
1867*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>
1868*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt> <nt def="NT-AttType">AttType</nt>
1869*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt> <nt def="NT-DefaultDecl">DefaultDecl</nt></rhs>
1870*7c568831SAndroid Build Coastguard Worker</prod>
1871*7c568831SAndroid Build Coastguard Worker</scrap>
1872*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> in the
1873*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttlistDecl">AttlistDecl</nt> rule is the type of an element.  At
1874*7c568831SAndroid Build Coastguard Workeruser option, an XML processor may issue a warning if attributes are
1875*7c568831SAndroid Build Coastguard Workerdeclared for an element type not itself declared, but this is not an
1876*7c568831SAndroid Build Coastguard Workererror.  The <nt def="NT-Name">Name</nt> in the
1877*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttDef">AttDef</nt> rule is
1878*7c568831SAndroid Build Coastguard Workerthe name of the attribute.</termdef></p>
1879*7c568831SAndroid Build Coastguard Worker<p>
1880*7c568831SAndroid Build Coastguard WorkerWhen more than one <nt def="NT-AttlistDecl">AttlistDecl</nt> is provided for a
1881*7c568831SAndroid Build Coastguard Workergiven element type, the contents of all those provided are merged.  When
1882*7c568831SAndroid Build Coastguard Workermore than one definition is provided for the same attribute of a
1883*7c568831SAndroid Build Coastguard Workergiven element type, the first declaration is binding and later
1884*7c568831SAndroid Build Coastguard Workerdeclarations are ignored.
1885*7c568831SAndroid Build Coastguard Worker<termref def="dt-interop">For interoperability,</termref> writers of DTDs
1886*7c568831SAndroid Build Coastguard Workermay choose to provide at most one attribute-list declaration
1887*7c568831SAndroid Build Coastguard Workerfor a given element type, at most one attribute definition
1888*7c568831SAndroid Build Coastguard Workerfor a given attribute name, and at least one attribute definition
1889*7c568831SAndroid Build Coastguard Workerin each attribute-list declaration.
1890*7c568831SAndroid Build Coastguard WorkerFor interoperability, an XML processor may at user option
1891*7c568831SAndroid Build Coastguard Workerissue a warning when more than one attribute-list declaration is
1892*7c568831SAndroid Build Coastguard Workerprovided for a given element type, or more than one attribute definition
1893*7c568831SAndroid Build Coastguard Workeris provided
1894*7c568831SAndroid Build Coastguard Workerfor a given attribute, but this is not an error.
1895*7c568831SAndroid Build Coastguard Worker</p>
1896*7c568831SAndroid Build Coastguard Worker
1897*7c568831SAndroid Build Coastguard Worker<div3 id="sec-attribute-types">
1898*7c568831SAndroid Build Coastguard Worker<head>Attribute Types</head>
1899*7c568831SAndroid Build Coastguard Worker
1900*7c568831SAndroid Build Coastguard Worker<p>XML attribute types are of three kinds:  a string type, a
1901*7c568831SAndroid Build Coastguard Workerset of tokenized types, and enumerated types.  The string type may take
1902*7c568831SAndroid Build Coastguard Workerany literal string as a value; the tokenized types have varying lexical
1903*7c568831SAndroid Build Coastguard Workerand semantic constraints, as noted:
1904*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1905*7c568831SAndroid Build Coastguard Worker<head>Attribute Types</head>
1906*7c568831SAndroid Build Coastguard Worker<prodgroup pcw4="14" pcw5="11.5">
1907*7c568831SAndroid Build Coastguard Worker<prod id="NT-AttType"><lhs>AttType</lhs>
1908*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-StringType">StringType</nt>
1909*7c568831SAndroid Build Coastguard Worker| <nt def="NT-TokenizedType">TokenizedType</nt>
1910*7c568831SAndroid Build Coastguard Worker| <nt def="NT-EnumeratedType">EnumeratedType</nt>
1911*7c568831SAndroid Build Coastguard Worker</rhs>
1912*7c568831SAndroid Build Coastguard Worker</prod>
1913*7c568831SAndroid Build Coastguard Worker<prod id="NT-StringType"><lhs>StringType</lhs>
1914*7c568831SAndroid Build Coastguard Worker<rhs>'CDATA'</rhs>
1915*7c568831SAndroid Build Coastguard Worker</prod>
1916*7c568831SAndroid Build Coastguard Worker<prod id="NT-TokenizedType"><lhs>TokenizedType</lhs>
1917*7c568831SAndroid Build Coastguard Worker<rhs>'ID'</rhs>
1918*7c568831SAndroid Build Coastguard Worker<vc def="id"/>
1919*7c568831SAndroid Build Coastguard Worker<vc def="one-id-per-el"/>
1920*7c568831SAndroid Build Coastguard Worker<vc def="id-default"/>
1921*7c568831SAndroid Build Coastguard Worker<rhs>| 'IDREF'</rhs>
1922*7c568831SAndroid Build Coastguard Worker<vc def="idref"/>
1923*7c568831SAndroid Build Coastguard Worker<rhs>| 'IDREFS'</rhs>
1924*7c568831SAndroid Build Coastguard Worker<vc def="idref"/>
1925*7c568831SAndroid Build Coastguard Worker<rhs>| 'ENTITY'</rhs>
1926*7c568831SAndroid Build Coastguard Worker<vc def="entname"/>
1927*7c568831SAndroid Build Coastguard Worker<rhs>| 'ENTITIES'</rhs>
1928*7c568831SAndroid Build Coastguard Worker<vc def="entname"/>
1929*7c568831SAndroid Build Coastguard Worker<rhs>| 'NMTOKEN'</rhs>
1930*7c568831SAndroid Build Coastguard Worker<vc def="nmtok"/>
1931*7c568831SAndroid Build Coastguard Worker<rhs>| 'NMTOKENS'</rhs>
1932*7c568831SAndroid Build Coastguard Worker<vc def="nmtok"/></prod>
1933*7c568831SAndroid Build Coastguard Worker</prodgroup>
1934*7c568831SAndroid Build Coastguard Worker</scrap>
1935*7c568831SAndroid Build Coastguard Worker</p>
1936*7c568831SAndroid Build Coastguard Worker<vcnote id="id">
1937*7c568831SAndroid Build Coastguard Worker<head>ID</head>
1938*7c568831SAndroid Build Coastguard Worker<p>
1939*7c568831SAndroid Build Coastguard WorkerValues of type <kw>ID</kw> must match the
1940*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt> production.
1941*7c568831SAndroid Build Coastguard WorkerA name must not appear more than once in
1942*7c568831SAndroid Build Coastguard Workeran XML document as a value of this type; i.e., ID values must uniquely
1943*7c568831SAndroid Build Coastguard Workeridentify the elements which bear them.
1944*7c568831SAndroid Build Coastguard Worker</p>
1945*7c568831SAndroid Build Coastguard Worker</vcnote>
1946*7c568831SAndroid Build Coastguard Worker<vcnote id="one-id-per-el">
1947*7c568831SAndroid Build Coastguard Worker<head>One ID per Element Type</head>
1948*7c568831SAndroid Build Coastguard Worker<p>No element type may have more than one ID attribute specified.</p>
1949*7c568831SAndroid Build Coastguard Worker</vcnote>
1950*7c568831SAndroid Build Coastguard Worker<vcnote id="id-default">
1951*7c568831SAndroid Build Coastguard Worker<head>ID Attribute Default</head>
1952*7c568831SAndroid Build Coastguard Worker<p>An ID attribute must have a declared default of <kw>#IMPLIED</kw> or
1953*7c568831SAndroid Build Coastguard Worker<kw>#REQUIRED</kw>.</p>
1954*7c568831SAndroid Build Coastguard Worker</vcnote>
1955*7c568831SAndroid Build Coastguard Worker<vcnote id="idref">
1956*7c568831SAndroid Build Coastguard Worker<head>IDREF</head>
1957*7c568831SAndroid Build Coastguard Worker<p>
1958*7c568831SAndroid Build Coastguard WorkerValues of type <kw>IDREF</kw> must match
1959*7c568831SAndroid Build Coastguard Workerthe <nt def="NT-Name">Name</nt> production, and
1960*7c568831SAndroid Build Coastguard Workervalues of type <kw>IDREFS</kw> must match
1961*7c568831SAndroid Build Coastguard Worker<nt def="NT-Names">Names</nt>;
1962*7c568831SAndroid Build Coastguard Workereach <nt def="NT-Name">Name</nt> must match the value of an ID attribute on
1963*7c568831SAndroid Build Coastguard Workersome element in the XML document; i.e. <kw>IDREF</kw> values must
1964*7c568831SAndroid Build Coastguard Workermatch the value of some ID attribute.
1965*7c568831SAndroid Build Coastguard Worker</p>
1966*7c568831SAndroid Build Coastguard Worker</vcnote>
1967*7c568831SAndroid Build Coastguard Worker<vcnote id="entname">
1968*7c568831SAndroid Build Coastguard Worker<head>Entity Name</head>
1969*7c568831SAndroid Build Coastguard Worker<p>
1970*7c568831SAndroid Build Coastguard WorkerValues of type <kw>ENTITY</kw>
1971*7c568831SAndroid Build Coastguard Workermust match the <nt def="NT-Name">Name</nt> production,
1972*7c568831SAndroid Build Coastguard Workervalues of type <kw>ENTITIES</kw> must match
1973*7c568831SAndroid Build Coastguard Worker<nt def="NT-Names">Names</nt>;
1974*7c568831SAndroid Build Coastguard Workereach <nt def="NT-Name">Name</nt> must
1975*7c568831SAndroid Build Coastguard Workermatch the
1976*7c568831SAndroid Build Coastguard Workername of an <termref def="dt-unparsed">unparsed entity</termref> declared in the
1977*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">DTD</termref>.
1978*7c568831SAndroid Build Coastguard Worker</p>
1979*7c568831SAndroid Build Coastguard Worker</vcnote>
1980*7c568831SAndroid Build Coastguard Worker<vcnote id="nmtok">
1981*7c568831SAndroid Build Coastguard Worker<head>Name Token</head>
1982*7c568831SAndroid Build Coastguard Worker<p>
1983*7c568831SAndroid Build Coastguard WorkerValues of type <kw>NMTOKEN</kw> must match the
1984*7c568831SAndroid Build Coastguard Worker<nt def="NT-Nmtoken">Nmtoken</nt> production;
1985*7c568831SAndroid Build Coastguard Workervalues of type <kw>NMTOKENS</kw> must
1986*7c568831SAndroid Build Coastguard Workermatch <termref def="NT-Nmtokens">Nmtokens</termref>.
1987*7c568831SAndroid Build Coastguard Worker</p>
1988*7c568831SAndroid Build Coastguard Worker</vcnote>
1989*7c568831SAndroid Build Coastguard Worker<!-- why?
1990*7c568831SAndroid Build Coastguard Worker<p>The XML processor must normalize attribute values before
1991*7c568831SAndroid Build Coastguard Workerpassing them to the application, as described in
1992*7c568831SAndroid Build Coastguard Worker<specref ref="AVNormalize"/>.</p>-->
1993*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-enumerated" term="Enumerated Attribute Values"><term>Enumerated attributes</term> can take one
1994*7c568831SAndroid Build Coastguard Workerof a list of values provided in the declaration</termdef>. There are two
1995*7c568831SAndroid Build Coastguard Workerkinds of enumerated types:
1996*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
1997*7c568831SAndroid Build Coastguard Worker<head>Enumerated Attribute Types</head>
1998*7c568831SAndroid Build Coastguard Worker<prod id="NT-EnumeratedType"><lhs>EnumeratedType</lhs>
1999*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-NotationType">NotationType</nt>
2000*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Enumeration">Enumeration</nt>
2001*7c568831SAndroid Build Coastguard Worker</rhs></prod>
2002*7c568831SAndroid Build Coastguard Worker<prod id="NT-NotationType"><lhs>NotationType</lhs>
2003*7c568831SAndroid Build Coastguard Worker<rhs>'NOTATION'
2004*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>
2005*7c568831SAndroid Build Coastguard Worker'('
2006*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
2007*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt>
2008*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt>? '|' <nt def="NT-S">S</nt>?
2009*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt>)*
2010*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? ')'
2011*7c568831SAndroid Build Coastguard Worker</rhs>
2012*7c568831SAndroid Build Coastguard Worker<vc def="notatn"/></prod>
2013*7c568831SAndroid Build Coastguard Worker<prod id="NT-Enumeration"><lhs>Enumeration</lhs>
2014*7c568831SAndroid Build Coastguard Worker<rhs>'(' <nt def="NT-S">S</nt>?
2015*7c568831SAndroid Build Coastguard Worker<nt def="NT-Nmtoken">Nmtoken</nt>
2016*7c568831SAndroid Build Coastguard Worker(<nt def="NT-S">S</nt>? '|'
2017*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
2018*7c568831SAndroid Build Coastguard Worker<nt def="NT-Nmtoken">Nmtoken</nt>)*
2019*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>?
2020*7c568831SAndroid Build Coastguard Worker')'</rhs>
2021*7c568831SAndroid Build Coastguard Worker<vc def="enum"/></prod>
2022*7c568831SAndroid Build Coastguard Worker</scrap>
2023*7c568831SAndroid Build Coastguard WorkerA <kw>NOTATION</kw> attribute identifies a
2024*7c568831SAndroid Build Coastguard Worker<termref def="dt-notation">notation</termref>, declared in the
2025*7c568831SAndroid Build Coastguard WorkerDTD with associated system and/or public identifiers, to
2026*7c568831SAndroid Build Coastguard Workerbe used in interpreting the element to which the attribute
2027*7c568831SAndroid Build Coastguard Workeris attached.
2028*7c568831SAndroid Build Coastguard Worker</p>
2029*7c568831SAndroid Build Coastguard Worker
2030*7c568831SAndroid Build Coastguard Worker<vcnote id="notatn">
2031*7c568831SAndroid Build Coastguard Worker<head>Notation Attributes</head>
2032*7c568831SAndroid Build Coastguard Worker<p>
2033*7c568831SAndroid Build Coastguard WorkerValues of this type must match
2034*7c568831SAndroid Build Coastguard Workerone of the <titleref href="Notations">notation</titleref> names included in
2035*7c568831SAndroid Build Coastguard Workerthe declaration; all notation names in the declaration must
2036*7c568831SAndroid Build Coastguard Workerbe declared.
2037*7c568831SAndroid Build Coastguard Worker</p>
2038*7c568831SAndroid Build Coastguard Worker</vcnote>
2039*7c568831SAndroid Build Coastguard Worker<vcnote id="enum">
2040*7c568831SAndroid Build Coastguard Worker<head>Enumeration</head>
2041*7c568831SAndroid Build Coastguard Worker<p>
2042*7c568831SAndroid Build Coastguard WorkerValues of this type
2043*7c568831SAndroid Build Coastguard Workermust match one of the <nt def="NT-Nmtoken">Nmtoken</nt> tokens in the
2044*7c568831SAndroid Build Coastguard Workerdeclaration.
2045*7c568831SAndroid Build Coastguard Worker</p>
2046*7c568831SAndroid Build Coastguard Worker</vcnote>
2047*7c568831SAndroid Build Coastguard Worker<p><termref def="dt-interop">For interoperability,</termref> the same
2048*7c568831SAndroid Build Coastguard Worker<nt def="NT-Nmtoken">Nmtoken</nt> should not occur more than once in the
2049*7c568831SAndroid Build Coastguard Workerenumerated attribute types of a single element type.
2050*7c568831SAndroid Build Coastguard Worker</p>
2051*7c568831SAndroid Build Coastguard Worker</div3>
2052*7c568831SAndroid Build Coastguard Worker
2053*7c568831SAndroid Build Coastguard Worker<div3 id="sec-attr-defaults">
2054*7c568831SAndroid Build Coastguard Worker<head>Attribute Defaults</head>
2055*7c568831SAndroid Build Coastguard Worker
2056*7c568831SAndroid Build Coastguard Worker<p>An <termref def="dt-attdecl">attribute declaration</termref> provides
2057*7c568831SAndroid Build Coastguard Workerinformation on whether
2058*7c568831SAndroid Build Coastguard Workerthe attribute's presence is required, and if not, how an XML processor should
2059*7c568831SAndroid Build Coastguard Workerreact if a declared attribute is absent in a document.
2060*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2061*7c568831SAndroid Build Coastguard Worker<head>Attribute Defaults</head>
2062*7c568831SAndroid Build Coastguard Worker<prodgroup pcw4="14" pcw5="11.5">
2063*7c568831SAndroid Build Coastguard Worker<prod id="NT-DefaultDecl"><lhs>DefaultDecl</lhs>
2064*7c568831SAndroid Build Coastguard Worker<rhs>'#REQUIRED'
2065*7c568831SAndroid Build Coastguard Worker|&nbsp;'#IMPLIED' </rhs>
2066*7c568831SAndroid Build Coastguard Worker<rhs>| (('#FIXED' S)? <nt def="NT-AttValue">AttValue</nt>)</rhs>
2067*7c568831SAndroid Build Coastguard Worker<vc def="RequiredAttr"/>
2068*7c568831SAndroid Build Coastguard Worker<vc def="defattrvalid"/>
2069*7c568831SAndroid Build Coastguard Worker<wfc def="CleanAttrVals"/>
2070*7c568831SAndroid Build Coastguard Worker<vc def="FixedAttr"/>
2071*7c568831SAndroid Build Coastguard Worker</prod>
2072*7c568831SAndroid Build Coastguard Worker</prodgroup>
2073*7c568831SAndroid Build Coastguard Worker</scrap>
2074*7c568831SAndroid Build Coastguard Worker
2075*7c568831SAndroid Build Coastguard Worker</p>
2076*7c568831SAndroid Build Coastguard Worker<p>In an attribute declaration, <kw>#REQUIRED</kw> means that the
2077*7c568831SAndroid Build Coastguard Workerattribute must always be provided, <kw>#IMPLIED</kw> that no default
2078*7c568831SAndroid Build Coastguard Workervalue is provided.
2079*7c568831SAndroid Build Coastguard Worker<!-- not any more!!
2080*7c568831SAndroid Build Coastguard Worker<kw>#IMPLIED</kw> means that if the attribute is omitted
2081*7c568831SAndroid Build Coastguard Workerfrom an element of this type,
2082*7c568831SAndroid Build Coastguard Workerthe XML processor must inform the application
2083*7c568831SAndroid Build Coastguard Workerthat no value was specified; no constraint is placed on the behavior
2084*7c568831SAndroid Build Coastguard Workerof the application. -->
2085*7c568831SAndroid Build Coastguard Worker<termdef id="dt-default" term="Attribute Default">If the
2086*7c568831SAndroid Build Coastguard Workerdeclaration
2087*7c568831SAndroid Build Coastguard Workeris neither <kw>#REQUIRED</kw> nor <kw>#IMPLIED</kw>, then the
2088*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt> value contains the declared
2089*7c568831SAndroid Build Coastguard Worker<term>default</term> value; the <kw>#FIXED</kw> keyword states that
2090*7c568831SAndroid Build Coastguard Workerthe attribute must always have the default value.
2091*7c568831SAndroid Build Coastguard WorkerIf a default value
2092*7c568831SAndroid Build Coastguard Workeris declared, when an XML processor encounters an omitted attribute, it
2093*7c568831SAndroid Build Coastguard Workeris to behave as though the attribute were present with
2094*7c568831SAndroid Build Coastguard Workerthe declared default value.</termdef></p>
2095*7c568831SAndroid Build Coastguard Worker<vcnote id="RequiredAttr">
2096*7c568831SAndroid Build Coastguard Worker<head>Required Attribute</head>
2097*7c568831SAndroid Build Coastguard Worker<p>If the default declaration is the keyword <kw>#REQUIRED</kw>, then
2098*7c568831SAndroid Build Coastguard Workerthe attribute must be specified for
2099*7c568831SAndroid Build Coastguard Workerall elements of the type in the attribute-list declaration.
2100*7c568831SAndroid Build Coastguard Worker</p></vcnote>
2101*7c568831SAndroid Build Coastguard Worker<vcnote id="defattrvalid">
2102*7c568831SAndroid Build Coastguard Worker<head>Attribute Default Legal</head>
2103*7c568831SAndroid Build Coastguard Worker<p>
2104*7c568831SAndroid Build Coastguard WorkerThe declared
2105*7c568831SAndroid Build Coastguard Workerdefault value must meet the lexical constraints of the declared attribute type.
2106*7c568831SAndroid Build Coastguard Worker</p>
2107*7c568831SAndroid Build Coastguard Worker</vcnote>
2108*7c568831SAndroid Build Coastguard Worker<vcnote id="FixedAttr">
2109*7c568831SAndroid Build Coastguard Worker<head>Fixed Attribute Default</head>
2110*7c568831SAndroid Build Coastguard Worker<p>If an attribute has a default value declared with the
2111*7c568831SAndroid Build Coastguard Worker<kw>#FIXED</kw> keyword, instances of that attribute must
2112*7c568831SAndroid Build Coastguard Workermatch the default value.
2113*7c568831SAndroid Build Coastguard Worker</p></vcnote>
2114*7c568831SAndroid Build Coastguard Worker
2115*7c568831SAndroid Build Coastguard Worker<p>Examples of attribute-list declarations:
2116*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ATTLIST termdef
2117*7c568831SAndroid Build Coastguard Worker          id      ID      #REQUIRED
2118*7c568831SAndroid Build Coastguard Worker          name    CDATA   #IMPLIED&gt;
2119*7c568831SAndroid Build Coastguard Worker&lt;!ATTLIST list
2120*7c568831SAndroid Build Coastguard Worker          type    (bullets|ordered|glossary)  "ordered"&gt;
2121*7c568831SAndroid Build Coastguard Worker&lt;!ATTLIST form
2122*7c568831SAndroid Build Coastguard Worker          method  CDATA   #FIXED "POST"&gt;</eg></p>
2123*7c568831SAndroid Build Coastguard Worker</div3>
2124*7c568831SAndroid Build Coastguard Worker<div3 id="AVNormalize">
2125*7c568831SAndroid Build Coastguard Worker<head>Attribute-Value Normalization</head>
2126*7c568831SAndroid Build Coastguard Worker<p>Before the value of an attribute is passed to the application
2127*7c568831SAndroid Build Coastguard Workeror checked for validity, the
2128*7c568831SAndroid Build Coastguard WorkerXML processor must normalize it as follows:
2129*7c568831SAndroid Build Coastguard Worker<ulist>
2130*7c568831SAndroid Build Coastguard Worker<item><p>a character reference is processed by appending the referenced
2131*7c568831SAndroid Build Coastguard Workercharacter to the attribute value</p></item>
2132*7c568831SAndroid Build Coastguard Worker<item><p>an entity reference is processed by recursively processing the
2133*7c568831SAndroid Build Coastguard Workerreplacement text of the entity</p></item>
2134*7c568831SAndroid Build Coastguard Worker<item><p>a whitespace character (#x20, #xD, #xA, #x9) is processed by
2135*7c568831SAndroid Build Coastguard Workerappending #x20 to the normalized value, except that only a single #x20
2136*7c568831SAndroid Build Coastguard Workeris appended for a "#xD#xA" sequence that is part of an external
2137*7c568831SAndroid Build Coastguard Workerparsed entity or the literal entity value of an internal parsed
2138*7c568831SAndroid Build Coastguard Workerentity</p></item>
2139*7c568831SAndroid Build Coastguard Worker<item><p>other characters are processed by appending them to the normalized
2140*7c568831SAndroid Build Coastguard Workervalue</p>
2141*7c568831SAndroid Build Coastguard Worker</item></ulist>
2142*7c568831SAndroid Build Coastguard Worker</p>
2143*7c568831SAndroid Build Coastguard Worker<p>If the declared value is not CDATA, then the XML processor must
2144*7c568831SAndroid Build Coastguard Workerfurther process the normalized attribute value by discarding any
2145*7c568831SAndroid Build Coastguard Workerleading and trailing space (#x20) characters, and by replacing
2146*7c568831SAndroid Build Coastguard Workersequences of space (#x20) characters by a single space (#x20)
2147*7c568831SAndroid Build Coastguard Workercharacter.</p>
2148*7c568831SAndroid Build Coastguard Worker<p>
2149*7c568831SAndroid Build Coastguard WorkerAll attributes for which no declaration has been read should be treated
2150*7c568831SAndroid Build Coastguard Workerby a non-validating parser as if declared
2151*7c568831SAndroid Build Coastguard Worker<kw>CDATA</kw>.
2152*7c568831SAndroid Build Coastguard Worker</p>
2153*7c568831SAndroid Build Coastguard Worker</div3>
2154*7c568831SAndroid Build Coastguard Worker</div2>
2155*7c568831SAndroid Build Coastguard Worker<div2 id="sec-condition-sect">
2156*7c568831SAndroid Build Coastguard Worker<head>Conditional Sections</head>
2157*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-cond-section" term="conditional section">
2158*7c568831SAndroid Build Coastguard Worker<term>Conditional sections</term> are portions of the
2159*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">document type declaration external subset</termref>
2160*7c568831SAndroid Build Coastguard Workerwhich are
2161*7c568831SAndroid Build Coastguard Workerincluded in, or excluded from, the logical structure of the DTD based on
2162*7c568831SAndroid Build Coastguard Workerthe keyword which governs them.</termdef>
2163*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2164*7c568831SAndroid Build Coastguard Worker<head>Conditional Section</head>
2165*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="9" pcw4="14.5">
2166*7c568831SAndroid Build Coastguard Worker<prod id="NT-conditionalSect"><lhs>conditionalSect</lhs>
2167*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-includeSect">includeSect</nt>
2168*7c568831SAndroid Build Coastguard Worker| <nt def="NT-ignoreSect">ignoreSect</nt>
2169*7c568831SAndroid Build Coastguard Worker</rhs>
2170*7c568831SAndroid Build Coastguard Worker</prod>
2171*7c568831SAndroid Build Coastguard Worker<prod id="NT-includeSect"><lhs>includeSect</lhs>
2172*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;![' S? 'INCLUDE' S? '['
2173*7c568831SAndroid Build Coastguard Worker
2174*7c568831SAndroid Build Coastguard Worker<nt def="NT-extSubsetDecl">extSubsetDecl</nt>
2175*7c568831SAndroid Build Coastguard Worker']]&gt;'
2176*7c568831SAndroid Build Coastguard Worker</rhs>
2177*7c568831SAndroid Build Coastguard Worker</prod>
2178*7c568831SAndroid Build Coastguard Worker<prod id="NT-ignoreSect"><lhs>ignoreSect</lhs>
2179*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;![' S? 'IGNORE' S? '['
2180*7c568831SAndroid Build Coastguard Worker<nt def="NT-ignoreSectContents">ignoreSectContents</nt>*
2181*7c568831SAndroid Build Coastguard Worker']]&gt;'</rhs>
2182*7c568831SAndroid Build Coastguard Worker</prod>
2183*7c568831SAndroid Build Coastguard Worker
2184*7c568831SAndroid Build Coastguard Worker<prod id="NT-ignoreSectContents"><lhs>ignoreSectContents</lhs>
2185*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Ignore">Ignore</nt>
2186*7c568831SAndroid Build Coastguard Worker('&lt;![' <nt def="NT-ignoreSectContents">ignoreSectContents</nt> ']]&gt;'
2187*7c568831SAndroid Build Coastguard Worker<nt def="NT-Ignore">Ignore</nt>)*</rhs></prod>
2188*7c568831SAndroid Build Coastguard Worker<prod id="NT-Ignore"><lhs>Ignore</lhs>
2189*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-Char">Char</nt>* -
2190*7c568831SAndroid Build Coastguard Worker(<nt def="NT-Char">Char</nt>* ('&lt;![' | ']]&gt;')
2191*7c568831SAndroid Build Coastguard Worker<nt def="NT-Char">Char</nt>*)
2192*7c568831SAndroid Build Coastguard Worker</rhs></prod>
2193*7c568831SAndroid Build Coastguard Worker
2194*7c568831SAndroid Build Coastguard Worker</prodgroup>
2195*7c568831SAndroid Build Coastguard Worker</scrap>
2196*7c568831SAndroid Build Coastguard Worker</p>
2197*7c568831SAndroid Build Coastguard Worker<p>Like the internal and external DTD subsets, a conditional section
2198*7c568831SAndroid Build Coastguard Workermay contain one or more complete declarations,
2199*7c568831SAndroid Build Coastguard Workercomments, processing instructions,
2200*7c568831SAndroid Build Coastguard Workeror nested conditional sections, intermingled with white space.
2201*7c568831SAndroid Build Coastguard Worker</p>
2202*7c568831SAndroid Build Coastguard Worker<p>If the keyword of the
2203*7c568831SAndroid Build Coastguard Workerconditional section is <kw>INCLUDE</kw>, then the contents of the conditional
2204*7c568831SAndroid Build Coastguard Workersection are part of the DTD.
2205*7c568831SAndroid Build Coastguard WorkerIf the keyword of the conditional
2206*7c568831SAndroid Build Coastguard Workersection is <kw>IGNORE</kw>, then the contents of the conditional section are
2207*7c568831SAndroid Build Coastguard Workernot logically part of the DTD.
2208*7c568831SAndroid Build Coastguard WorkerNote that for reliable parsing, the contents of even ignored
2209*7c568831SAndroid Build Coastguard Workerconditional sections must be read in order to
2210*7c568831SAndroid Build Coastguard Workerdetect nested conditional sections and ensure that the end of the
2211*7c568831SAndroid Build Coastguard Workeroutermost (ignored) conditional section is properly detected.
2212*7c568831SAndroid Build Coastguard WorkerIf a conditional section with a
2213*7c568831SAndroid Build Coastguard Workerkeyword of <kw>INCLUDE</kw> occurs within a larger conditional
2214*7c568831SAndroid Build Coastguard Workersection with a keyword of <kw>IGNORE</kw>, both the outer and the
2215*7c568831SAndroid Build Coastguard Workerinner conditional sections are ignored.</p>
2216*7c568831SAndroid Build Coastguard Worker<p>If the keyword of the conditional section is a
2217*7c568831SAndroid Build Coastguard Workerparameter-entity reference, the parameter entity must be replaced by its
2218*7c568831SAndroid Build Coastguard Workercontent before the processor decides whether to
2219*7c568831SAndroid Build Coastguard Workerinclude or ignore the conditional section.</p>
2220*7c568831SAndroid Build Coastguard Worker<p>An example:
2221*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ENTITY % draft 'INCLUDE' &gt;
2222*7c568831SAndroid Build Coastguard Worker&lt;!ENTITY % final 'IGNORE' &gt;
2223*7c568831SAndroid Build Coastguard Worker
2224*7c568831SAndroid Build Coastguard Worker&lt;![%draft;[
2225*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT book (comments*, title, body, supplements?)&gt;
2226*7c568831SAndroid Build Coastguard Worker]]&gt;
2227*7c568831SAndroid Build Coastguard Worker&lt;![%final;[
2228*7c568831SAndroid Build Coastguard Worker&lt;!ELEMENT book (title, body, supplements?)&gt;
2229*7c568831SAndroid Build Coastguard Worker]]&gt;
2230*7c568831SAndroid Build Coastguard Worker</eg>
2231*7c568831SAndroid Build Coastguard Worker</p>
2232*7c568831SAndroid Build Coastguard Worker</div2>
2233*7c568831SAndroid Build Coastguard Worker
2234*7c568831SAndroid Build Coastguard Worker
2235*7c568831SAndroid Build Coastguard Worker<!--
2236*7c568831SAndroid Build Coastguard Worker<div2 id='sec-pass-to-app'>
2237*7c568831SAndroid Build Coastguard Worker<head>XML Processor Treatment of Logical Structure</head>
2238*7c568831SAndroid Build Coastguard Worker<p>When an XML processor encounters a start-tag, it must make
2239*7c568831SAndroid Build Coastguard Workerat least the following information available to the application:
2240*7c568831SAndroid Build Coastguard Worker<ulist>
2241*7c568831SAndroid Build Coastguard Worker<item>
2242*7c568831SAndroid Build Coastguard Worker<p>the element type's generic identifier</p>
2243*7c568831SAndroid Build Coastguard Worker</item>
2244*7c568831SAndroid Build Coastguard Worker<item>
2245*7c568831SAndroid Build Coastguard Worker<p>the names of attributes known to apply to this element type
2246*7c568831SAndroid Build Coastguard Worker(validating processors must make available names of all attributes
2247*7c568831SAndroid Build Coastguard Workerdeclared for the element type; non-validating processors must
2248*7c568831SAndroid Build Coastguard Workermake available at least the names of the attributes for which
2249*7c568831SAndroid Build Coastguard Workervalues are specified.
2250*7c568831SAndroid Build Coastguard Worker</p>
2251*7c568831SAndroid Build Coastguard Worker</item>
2252*7c568831SAndroid Build Coastguard Worker</ulist>
2253*7c568831SAndroid Build Coastguard Worker</p>
2254*7c568831SAndroid Build Coastguard Worker</div2>
2255*7c568831SAndroid Build Coastguard Worker-->
2256*7c568831SAndroid Build Coastguard Worker
2257*7c568831SAndroid Build Coastguard Worker</div1>
2258*7c568831SAndroid Build Coastguard Worker<!-- &Entities; -->
2259*7c568831SAndroid Build Coastguard Worker
2260*7c568831SAndroid Build Coastguard Worker<div1 id="sec-physical-struct">
2261*7c568831SAndroid Build Coastguard Worker<head>Physical Structures</head>
2262*7c568831SAndroid Build Coastguard Worker
2263*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-entity" term="Entity">An XML document may consist
2264*7c568831SAndroid Build Coastguard Workerof one or many storage units.   These are called
2265*7c568831SAndroid Build Coastguard Worker<term>entities</term>; they all have <term>content</term> and are all
2266*7c568831SAndroid Build Coastguard Worker(except for the document entity, see below, and
2267*7c568831SAndroid Build Coastguard Workerthe <termref def="dt-doctype">external DTD subset</termref>)
2268*7c568831SAndroid Build Coastguard Workeridentified by <term>name</term>.
2269*7c568831SAndroid Build Coastguard Worker</termdef>
2270*7c568831SAndroid Build Coastguard WorkerEach XML document has one entity
2271*7c568831SAndroid Build Coastguard Workercalled the <termref def="dt-docent">document entity</termref>, which serves
2272*7c568831SAndroid Build Coastguard Workeras the starting point for the <termref def="dt-xml-proc">XML
2273*7c568831SAndroid Build Coastguard Workerprocessor</termref> and may contain the whole document.</p>
2274*7c568831SAndroid Build Coastguard Worker<p>Entities may be either parsed or unparsed.
2275*7c568831SAndroid Build Coastguard Worker<termdef id="dt-parsedent" term="Text Entity">A <term>parsed entity's</term>
2276*7c568831SAndroid Build Coastguard Workercontents are referred to as its
2277*7c568831SAndroid Build Coastguard Worker<termref def="dt-repltext">replacement text</termref>;
2278*7c568831SAndroid Build Coastguard Workerthis <termref def="dt-text">text</termref> is considered an
2279*7c568831SAndroid Build Coastguard Workerintegral part of the document.</termdef></p>
2280*7c568831SAndroid Build Coastguard Worker
2281*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-unparsed" term="Unparsed Entity">An
2282*7c568831SAndroid Build Coastguard Worker<term>unparsed entity</term>
2283*7c568831SAndroid Build Coastguard Workeris a resource whose contents may or may not be
2284*7c568831SAndroid Build Coastguard Worker<termref def="dt-text">text</termref>, and if text, may not be XML.
2285*7c568831SAndroid Build Coastguard WorkerEach unparsed entity
2286*7c568831SAndroid Build Coastguard Workerhas an associated <termref def="dt-notation">notation</termref>, identified by name.
2287*7c568831SAndroid Build Coastguard WorkerBeyond a requirement
2288*7c568831SAndroid Build Coastguard Workerthat an XML processor make the identifiers for the entity and
2289*7c568831SAndroid Build Coastguard Workernotation available to the application,
2290*7c568831SAndroid Build Coastguard WorkerXML places no constraints on the contents of unparsed entities.</termdef>
2291*7c568831SAndroid Build Coastguard Worker</p>
2292*7c568831SAndroid Build Coastguard Worker<p>
2293*7c568831SAndroid Build Coastguard WorkerParsed entities are invoked by name using entity references;
2294*7c568831SAndroid Build Coastguard Workerunparsed entities by name, given in the value of <kw>ENTITY</kw>
2295*7c568831SAndroid Build Coastguard Workeror <kw>ENTITIES</kw>
2296*7c568831SAndroid Build Coastguard Workerattributes.</p>
2297*7c568831SAndroid Build Coastguard Worker<p><termdef id="gen-entity" term="general entity"><term>General entities</term>
2298*7c568831SAndroid Build Coastguard Workerare entities for use within the document content.
2299*7c568831SAndroid Build Coastguard WorkerIn this specification, general entities are sometimes referred
2300*7c568831SAndroid Build Coastguard Workerto with the unqualified term <emph>entity</emph> when this leads
2301*7c568831SAndroid Build Coastguard Workerto no ambiguity.</termdef>
2302*7c568831SAndroid Build Coastguard Worker<termdef id="dt-PE" term="Parameter entity">Parameter entities
2303*7c568831SAndroid Build Coastguard Workerare parsed entities for use within the DTD.</termdef>
2304*7c568831SAndroid Build Coastguard WorkerThese two types of entities use different forms of reference and
2305*7c568831SAndroid Build Coastguard Workerare recognized in different contexts.
2306*7c568831SAndroid Build Coastguard WorkerFurthermore, they occupy different namespaces; a parameter entity and
2307*7c568831SAndroid Build Coastguard Workera general entity with the same name are two distinct entities.
2308*7c568831SAndroid Build Coastguard Worker</p>
2309*7c568831SAndroid Build Coastguard Worker
2310*7c568831SAndroid Build Coastguard Worker<div2 id="sec-references">
2311*7c568831SAndroid Build Coastguard Worker<head>Character and Entity References</head>
2312*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-charref" term="Character Reference">
2313*7c568831SAndroid Build Coastguard WorkerA <term>character reference</term> refers to a specific character in the
2314*7c568831SAndroid Build Coastguard WorkerISO/IEC 10646 character set, for example one not directly accessible from
2315*7c568831SAndroid Build Coastguard Workeravailable input devices.
2316*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2317*7c568831SAndroid Build Coastguard Worker<head>Character Reference</head>
2318*7c568831SAndroid Build Coastguard Worker<prod id="NT-CharRef"><lhs>CharRef</lhs>
2319*7c568831SAndroid Build Coastguard Worker<rhs>'&amp;#' [0-9]+ ';' </rhs>
2320*7c568831SAndroid Build Coastguard Worker<rhs>| '&hcro;' [0-9a-fA-F]+ ';'</rhs>
2321*7c568831SAndroid Build Coastguard Worker<wfc def="wf-Legalchar"/>
2322*7c568831SAndroid Build Coastguard Worker</prod>
2323*7c568831SAndroid Build Coastguard Worker</scrap>
2324*7c568831SAndroid Build Coastguard Worker<wfcnote id="wf-Legalchar">
2325*7c568831SAndroid Build Coastguard Worker<head>Legal Character</head>
2326*7c568831SAndroid Build Coastguard Worker<p>Characters referred to using character references must
2327*7c568831SAndroid Build Coastguard Workermatch the production for
2328*7c568831SAndroid Build Coastguard Worker<termref def="NT-Char">Char</termref>.</p>
2329*7c568831SAndroid Build Coastguard Worker</wfcnote>
2330*7c568831SAndroid Build Coastguard WorkerIf the character reference begins with "<code>&amp;#x</code>", the digits and
2331*7c568831SAndroid Build Coastguard Workerletters up to the terminating <code>;</code> provide a hexadecimal
2332*7c568831SAndroid Build Coastguard Workerrepresentation of the character's code point in ISO/IEC 10646.
2333*7c568831SAndroid Build Coastguard WorkerIf it begins just with "<code>&amp;#</code>", the digits up to the terminating
2334*7c568831SAndroid Build Coastguard Worker<code>;</code> provide a decimal representation of the character's
2335*7c568831SAndroid Build Coastguard Workercode point.
2336*7c568831SAndroid Build Coastguard Worker</termdef>
2337*7c568831SAndroid Build Coastguard Worker</p>
2338*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-entref" term="Entity Reference">An <term>entity
2339*7c568831SAndroid Build Coastguard Workerreference</term> refers to the content of a named entity.</termdef>
2340*7c568831SAndroid Build Coastguard Worker<termdef id="dt-GERef" term="General Entity Reference">References to
2341*7c568831SAndroid Build Coastguard Workerparsed general entities
2342*7c568831SAndroid Build Coastguard Workeruse ampersand (<code>&amp;</code>) and semicolon (<code>;</code>) as
2343*7c568831SAndroid Build Coastguard Workerdelimiters.</termdef>
2344*7c568831SAndroid Build Coastguard Worker<termdef id="dt-PERef" term="Parameter-entity reference">
2345*7c568831SAndroid Build Coastguard Worker<term>Parameter-entity references</term> use percent-sign (<code>%</code>) and
2346*7c568831SAndroid Build Coastguard Workersemicolon
2347*7c568831SAndroid Build Coastguard Worker(<code>;</code>) as delimiters.</termdef>
2348*7c568831SAndroid Build Coastguard Worker</p>
2349*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2350*7c568831SAndroid Build Coastguard Worker<head>Entity Reference</head>
2351*7c568831SAndroid Build Coastguard Worker<prod id="NT-Reference"><lhs>Reference</lhs>
2352*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-EntityRef">EntityRef</nt>
2353*7c568831SAndroid Build Coastguard Worker| <nt def="NT-CharRef">CharRef</nt></rhs></prod>
2354*7c568831SAndroid Build Coastguard Worker<prod id="NT-EntityRef"><lhs>EntityRef</lhs>
2355*7c568831SAndroid Build Coastguard Worker<rhs>'&amp;' <nt def="NT-Name">Name</nt> ';'</rhs>
2356*7c568831SAndroid Build Coastguard Worker<wfc def="wf-entdeclared"/>
2357*7c568831SAndroid Build Coastguard Worker<vc def="vc-entdeclared"/>
2358*7c568831SAndroid Build Coastguard Worker<wfc def="textent"/>
2359*7c568831SAndroid Build Coastguard Worker<wfc def="norecursion"/>
2360*7c568831SAndroid Build Coastguard Worker</prod>
2361*7c568831SAndroid Build Coastguard Worker<prod id="NT-PEReference"><lhs>PEReference</lhs>
2362*7c568831SAndroid Build Coastguard Worker<rhs>'%' <nt def="NT-Name">Name</nt> ';'</rhs>
2363*7c568831SAndroid Build Coastguard Worker<vc def="vc-entdeclared"/>
2364*7c568831SAndroid Build Coastguard Worker<wfc def="norecursion"/>
2365*7c568831SAndroid Build Coastguard Worker<wfc def="indtd"/>
2366*7c568831SAndroid Build Coastguard Worker</prod>
2367*7c568831SAndroid Build Coastguard Worker</scrap>
2368*7c568831SAndroid Build Coastguard Worker
2369*7c568831SAndroid Build Coastguard Worker<wfcnote id="wf-entdeclared">
2370*7c568831SAndroid Build Coastguard Worker<head>Entity Declared</head>
2371*7c568831SAndroid Build Coastguard Worker<p>In a document without any DTD, a document with only an internal
2372*7c568831SAndroid Build Coastguard WorkerDTD subset which contains no parameter entity references, or a document with
2373*7c568831SAndroid Build Coastguard Worker"<code>standalone='yes'</code>",
2374*7c568831SAndroid Build Coastguard Workerthe <nt def="NT-Name">Name</nt> given in the entity reference must
2375*7c568831SAndroid Build Coastguard Worker<termref def="dt-match">match</termref> that in an
2376*7c568831SAndroid Build Coastguard Worker<titleref href="sec-entity-decl">entity declaration</titleref>, except that
2377*7c568831SAndroid Build Coastguard Workerwell-formed documents need not declare
2378*7c568831SAndroid Build Coastguard Workerany of the following entities: &magicents;.
2379*7c568831SAndroid Build Coastguard WorkerThe declaration of a parameter entity must precede any reference to it.
2380*7c568831SAndroid Build Coastguard WorkerSimilarly, the declaration of a general entity must precede any
2381*7c568831SAndroid Build Coastguard Workerreference to it which appears in a default value in an attribute-list
2382*7c568831SAndroid Build Coastguard Workerdeclaration.</p>
2383*7c568831SAndroid Build Coastguard Worker<p>Note that if entities are declared in the external subset or in
2384*7c568831SAndroid Build Coastguard Workerexternal parameter entities, a non-validating processor is
2385*7c568831SAndroid Build Coastguard Worker<titleref href="include-if-valid">not obligated to</titleref> read
2386*7c568831SAndroid Build Coastguard Workerand process their declarations; for such documents, the rule that
2387*7c568831SAndroid Build Coastguard Workeran entity must be declared is a well-formedness constraint only
2388*7c568831SAndroid Build Coastguard Workerif <titleref href="sec-rmd">standalone='yes'</titleref>.</p>
2389*7c568831SAndroid Build Coastguard Worker</wfcnote>
2390*7c568831SAndroid Build Coastguard Worker<vcnote id="vc-entdeclared">
2391*7c568831SAndroid Build Coastguard Worker<head>Entity Declared</head>
2392*7c568831SAndroid Build Coastguard Worker<p>In a document with an external subset or external parameter
2393*7c568831SAndroid Build Coastguard Workerentities with "<code>standalone='no'</code>",
2394*7c568831SAndroid Build Coastguard Workerthe <nt def="NT-Name">Name</nt> given in the entity reference must <termref def="dt-match">match</termref> that in an
2395*7c568831SAndroid Build Coastguard Worker<titleref href="sec-entity-decl">entity declaration</titleref>.
2396*7c568831SAndroid Build Coastguard WorkerFor interoperability, valid documents should declare the entities
2397*7c568831SAndroid Build Coastguard Worker&magicents;, in the form
2398*7c568831SAndroid Build Coastguard Workerspecified in <specref ref="sec-predefined-ent"/>.
2399*7c568831SAndroid Build Coastguard WorkerThe declaration of a parameter entity must precede any reference to it.
2400*7c568831SAndroid Build Coastguard WorkerSimilarly, the declaration of a general entity must precede any
2401*7c568831SAndroid Build Coastguard Workerreference to it which appears in a default value in an attribute-list
2402*7c568831SAndroid Build Coastguard Workerdeclaration.</p>
2403*7c568831SAndroid Build Coastguard Worker</vcnote>
2404*7c568831SAndroid Build Coastguard Worker<!-- FINAL EDIT:  is this duplication too clumsy? -->
2405*7c568831SAndroid Build Coastguard Worker<wfcnote id="textent">
2406*7c568831SAndroid Build Coastguard Worker<head>Parsed Entity</head>
2407*7c568831SAndroid Build Coastguard Worker<p>
2408*7c568831SAndroid Build Coastguard WorkerAn entity reference must not contain the name of an <termref def="dt-unparsed">unparsed entity</termref>. Unparsed entities may be referred
2409*7c568831SAndroid Build Coastguard Workerto only in <termref def="dt-attrval">attribute values</termref> declared to
2410*7c568831SAndroid Build Coastguard Workerbe of type <kw>ENTITY</kw> or <kw>ENTITIES</kw>.
2411*7c568831SAndroid Build Coastguard Worker</p>
2412*7c568831SAndroid Build Coastguard Worker</wfcnote>
2413*7c568831SAndroid Build Coastguard Worker<wfcnote id="norecursion">
2414*7c568831SAndroid Build Coastguard Worker<head>No Recursion</head>
2415*7c568831SAndroid Build Coastguard Worker<p>
2416*7c568831SAndroid Build Coastguard WorkerA parsed entity must not contain a recursive reference to itself,
2417*7c568831SAndroid Build Coastguard Workereither directly or indirectly.
2418*7c568831SAndroid Build Coastguard Worker</p>
2419*7c568831SAndroid Build Coastguard Worker</wfcnote>
2420*7c568831SAndroid Build Coastguard Worker<wfcnote id="indtd">
2421*7c568831SAndroid Build Coastguard Worker<head>In DTD</head>
2422*7c568831SAndroid Build Coastguard Worker<p>
2423*7c568831SAndroid Build Coastguard WorkerParameter-entity references may only appear in the
2424*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">DTD</termref>.
2425*7c568831SAndroid Build Coastguard Worker</p>
2426*7c568831SAndroid Build Coastguard Worker</wfcnote>
2427*7c568831SAndroid Build Coastguard Worker<p>Examples of character and entity references:
2428*7c568831SAndroid Build Coastguard Worker<eg>Type &lt;key&gt;less-than&lt;/key&gt; (&hcro;3C;) to save options.
2429*7c568831SAndroid Build Coastguard WorkerThis document was prepared on &amp;docdate; and
2430*7c568831SAndroid Build Coastguard Workeris classified &amp;security-level;.</eg></p>
2431*7c568831SAndroid Build Coastguard Worker<p>Example of a parameter-entity reference:
2432*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<!-- declare the parameter entity "ISOLat2"... -->
2433*7c568831SAndroid Build Coastguard Worker<!ENTITY % ISOLat2
2434*7c568831SAndroid Build Coastguard Worker         SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
2435*7c568831SAndroid Build Coastguard Worker<!-- ... now reference it. -->
2436*7c568831SAndroid Build Coastguard Worker%ISOLat2;]]></eg></p>
2437*7c568831SAndroid Build Coastguard Worker</div2>
2438*7c568831SAndroid Build Coastguard Worker
2439*7c568831SAndroid Build Coastguard Worker<div2 id="sec-entity-decl">
2440*7c568831SAndroid Build Coastguard Worker<head>Entity Declarations</head>
2441*7c568831SAndroid Build Coastguard Worker
2442*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-entdecl" term="entity declaration">
2443*7c568831SAndroid Build Coastguard WorkerEntities are declared thus:
2444*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2445*7c568831SAndroid Build Coastguard Worker<head>Entity Declaration</head>
2446*7c568831SAndroid Build Coastguard Worker<prodgroup pcw2="5" pcw4="18.5">
2447*7c568831SAndroid Build Coastguard Worker<prod id="NT-EntityDecl"><lhs>EntityDecl</lhs>
2448*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-GEDecl">GEDecl</nt><!--</rhs><com>General entities</com>
2449*7c568831SAndroid Build Coastguard Worker<rhs>--> | <nt def="NT-PEDecl">PEDecl</nt></rhs>
2450*7c568831SAndroid Build Coastguard Worker<!--<com>Parameter entities</com>-->
2451*7c568831SAndroid Build Coastguard Worker</prod>
2452*7c568831SAndroid Build Coastguard Worker<prod id="NT-GEDecl"><lhs>GEDecl</lhs>
2453*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>
2454*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt> <nt def="NT-EntityDef">EntityDef</nt>
2455*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs>
2456*7c568831SAndroid Build Coastguard Worker</prod>
2457*7c568831SAndroid Build Coastguard Worker<prod id="NT-PEDecl"><lhs>PEDecl</lhs>
2458*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!ENTITY' <nt def="NT-S">S</nt> '%' <nt def="NT-S">S</nt>
2459*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt> <nt def="NT-S">S</nt>
2460*7c568831SAndroid Build Coastguard Worker<nt def="NT-PEDef">PEDef</nt> <nt def="NT-S">S</nt>? '&gt;'</rhs>
2461*7c568831SAndroid Build Coastguard Worker<!--<com>Parameter entities</com>-->
2462*7c568831SAndroid Build Coastguard Worker</prod>
2463*7c568831SAndroid Build Coastguard Worker<prod id="NT-EntityDef"><lhs>EntityDef</lhs>
2464*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-EntityValue">EntityValue</nt>
2465*7c568831SAndroid Build Coastguard Worker<!--</rhs>
2466*7c568831SAndroid Build Coastguard Worker<rhs>-->| (<nt def="NT-ExternalID">ExternalID</nt>
2467*7c568831SAndroid Build Coastguard Worker<nt def="NT-NDataDecl">NDataDecl</nt>?)</rhs>
2468*7c568831SAndroid Build Coastguard Worker<!-- <nt def='NT-ExternalDef'>ExternalDef</nt></rhs> -->
2469*7c568831SAndroid Build Coastguard Worker</prod>
2470*7c568831SAndroid Build Coastguard Worker<!-- FINAL EDIT: what happened to WFs here? -->
2471*7c568831SAndroid Build Coastguard Worker<prod id="NT-PEDef"><lhs>PEDef</lhs>
2472*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-EntityValue">EntityValue</nt>
2473*7c568831SAndroid Build Coastguard Worker| <nt def="NT-ExternalID">ExternalID</nt></rhs></prod>
2474*7c568831SAndroid Build Coastguard Worker</prodgroup>
2475*7c568831SAndroid Build Coastguard Worker</scrap>
2476*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> identifies the entity in an
2477*7c568831SAndroid Build Coastguard Worker<termref def="dt-entref">entity reference</termref> or, in the case of an
2478*7c568831SAndroid Build Coastguard Workerunparsed entity, in the value of an <kw>ENTITY</kw> or <kw>ENTITIES</kw>
2479*7c568831SAndroid Build Coastguard Workerattribute.
2480*7c568831SAndroid Build Coastguard WorkerIf the same entity is declared more than once, the first declaration
2481*7c568831SAndroid Build Coastguard Workerencountered is binding; at user option, an XML processor may issue a
2482*7c568831SAndroid Build Coastguard Workerwarning if entities are declared multiple times.</termdef>
2483*7c568831SAndroid Build Coastguard Worker</p>
2484*7c568831SAndroid Build Coastguard Worker
2485*7c568831SAndroid Build Coastguard Worker<div3 id="sec-internal-ent">
2486*7c568831SAndroid Build Coastguard Worker<head>Internal Entities</head>
2487*7c568831SAndroid Build Coastguard Worker
2488*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-internent" term="Internal Entity Replacement Text">If
2489*7c568831SAndroid Build Coastguard Workerthe entity definition is an
2490*7c568831SAndroid Build Coastguard Worker<nt def="NT-EntityValue">EntityValue</nt>,
2491*7c568831SAndroid Build Coastguard Workerthe defined entity is called an <term>internal entity</term>.
2492*7c568831SAndroid Build Coastguard WorkerThere is no separate physical
2493*7c568831SAndroid Build Coastguard Workerstorage object, and the content of the entity is given in the
2494*7c568831SAndroid Build Coastguard Workerdeclaration. </termdef>
2495*7c568831SAndroid Build Coastguard WorkerNote that some processing of entity and character references in the
2496*7c568831SAndroid Build Coastguard Worker<termref def="dt-litentval">literal entity value</termref> may be required to
2497*7c568831SAndroid Build Coastguard Workerproduce the correct <termref def="dt-repltext">replacement
2498*7c568831SAndroid Build Coastguard Workertext</termref>: see <specref ref="intern-replacement"/>.
2499*7c568831SAndroid Build Coastguard Worker</p>
2500*7c568831SAndroid Build Coastguard Worker<p>An internal entity is a <termref def="dt-parsedent">parsed
2501*7c568831SAndroid Build Coastguard Workerentity</termref>.</p>
2502*7c568831SAndroid Build Coastguard Worker<p>Example of an internal entity declaration:
2503*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ENTITY Pub-Status "This is a pre-release of the
2504*7c568831SAndroid Build Coastguard Worker specification."&gt;</eg></p>
2505*7c568831SAndroid Build Coastguard Worker</div3>
2506*7c568831SAndroid Build Coastguard Worker
2507*7c568831SAndroid Build Coastguard Worker<div3 id="sec-external-ent">
2508*7c568831SAndroid Build Coastguard Worker<head>External Entities</head>
2509*7c568831SAndroid Build Coastguard Worker
2510*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-extent" term="External Entity">If the entity is not
2511*7c568831SAndroid Build Coastguard Workerinternal, it is an <term>external
2512*7c568831SAndroid Build Coastguard Workerentity</term>, declared as follows:
2513*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2514*7c568831SAndroid Build Coastguard Worker<head>External Entity Declaration</head>
2515*7c568831SAndroid Build Coastguard Worker<!--
2516*7c568831SAndroid Build Coastguard Worker<prod id='NT-ExternalDef'><lhs>ExternalDef</lhs>
2517*7c568831SAndroid Build Coastguard Worker<rhs></prod> -->
2518*7c568831SAndroid Build Coastguard Worker<prod id="NT-ExternalID"><lhs>ExternalID</lhs>
2519*7c568831SAndroid Build Coastguard Worker<rhs>'SYSTEM' <nt def="NT-S">S</nt>
2520*7c568831SAndroid Build Coastguard Worker<nt def="NT-SystemLiteral">SystemLiteral</nt></rhs>
2521*7c568831SAndroid Build Coastguard Worker<rhs>| 'PUBLIC' <nt def="NT-S">S</nt>
2522*7c568831SAndroid Build Coastguard Worker<nt def="NT-PubidLiteral">PubidLiteral</nt>
2523*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>
2524*7c568831SAndroid Build Coastguard Worker<nt def="NT-SystemLiteral">SystemLiteral</nt>
2525*7c568831SAndroid Build Coastguard Worker</rhs>
2526*7c568831SAndroid Build Coastguard Worker</prod>
2527*7c568831SAndroid Build Coastguard Worker<prod id="NT-NDataDecl"><lhs>NDataDecl</lhs>
2528*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-S">S</nt> 'NDATA' <nt def="NT-S">S</nt>
2529*7c568831SAndroid Build Coastguard Worker<nt def="NT-Name">Name</nt></rhs>
2530*7c568831SAndroid Build Coastguard Worker<vc def="not-declared"/></prod>
2531*7c568831SAndroid Build Coastguard Worker</scrap>
2532*7c568831SAndroid Build Coastguard WorkerIf the <nt def="NT-NDataDecl">NDataDecl</nt> is present, this is a
2533*7c568831SAndroid Build Coastguard Workergeneral <termref def="dt-unparsed">unparsed
2534*7c568831SAndroid Build Coastguard Workerentity</termref>; otherwise it is a parsed entity.</termdef></p>
2535*7c568831SAndroid Build Coastguard Worker<vcnote id="not-declared">
2536*7c568831SAndroid Build Coastguard Worker<head>Notation Declared</head>
2537*7c568831SAndroid Build Coastguard Worker<p>
2538*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-Name">Name</nt> must match the declared name of a
2539*7c568831SAndroid Build Coastguard Worker<termref def="dt-notation">notation</termref>.
2540*7c568831SAndroid Build Coastguard Worker</p>
2541*7c568831SAndroid Build Coastguard Worker</vcnote>
2542*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-sysid" term="System Identifier">The
2543*7c568831SAndroid Build Coastguard Worker<nt def="NT-SystemLiteral">SystemLiteral</nt>
2544*7c568831SAndroid Build Coastguard Workeris called the entity's <term>system identifier</term>. It is a URI,
2545*7c568831SAndroid Build Coastguard Workerwhich may be used to retrieve the entity.</termdef>
2546*7c568831SAndroid Build Coastguard WorkerNote that the hash mark (<code>#</code>) and fragment identifier
2547*7c568831SAndroid Build Coastguard Workerfrequently used with URIs are not, formally, part of the URI itself;
2548*7c568831SAndroid Build Coastguard Workeran XML processor may signal an error if a fragment identifier is
2549*7c568831SAndroid Build Coastguard Workergiven as part of a system identifier.
2550*7c568831SAndroid Build Coastguard WorkerUnless otherwise provided by information outside the scope of this
2551*7c568831SAndroid Build Coastguard Workerspecification (e.g. a special XML element type defined by a particular
2552*7c568831SAndroid Build Coastguard WorkerDTD, or a processing instruction defined by a particular application
2553*7c568831SAndroid Build Coastguard Workerspecification), relative URIs are relative to the location of the
2554*7c568831SAndroid Build Coastguard Workerresource within which the entity declaration occurs.
2555*7c568831SAndroid Build Coastguard WorkerA URI might thus be relative to the
2556*7c568831SAndroid Build Coastguard Worker<termref def="dt-docent">document entity</termref>, to the entity
2557*7c568831SAndroid Build Coastguard Workercontaining the <termref def="dt-doctype">external DTD subset</termref>,
2558*7c568831SAndroid Build Coastguard Workeror to some other <termref def="dt-extent">external parameter entity</termref>.
2559*7c568831SAndroid Build Coastguard Worker</p>
2560*7c568831SAndroid Build Coastguard Worker<p>An XML processor should handle a non-ASCII character in a URI by
2561*7c568831SAndroid Build Coastguard Workerrepresenting the character in UTF-8 as one or more bytes, and then
2562*7c568831SAndroid Build Coastguard Workerescaping these bytes with the URI escaping mechanism (i.e., by
2563*7c568831SAndroid Build Coastguard Workerconverting each byte to %HH, where HH is the hexadecimal notation of the
2564*7c568831SAndroid Build Coastguard Workerbyte value).</p>
2565*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-pubid" term="Public identifier">
2566*7c568831SAndroid Build Coastguard WorkerIn addition to a system identifier, an external identifier may
2567*7c568831SAndroid Build Coastguard Workerinclude a <term>public identifier</term>.</termdef>
2568*7c568831SAndroid Build Coastguard WorkerAn XML processor attempting to retrieve the entity's content may use the public
2569*7c568831SAndroid Build Coastguard Workeridentifier to try to generate an alternative URI.  If the processor
2570*7c568831SAndroid Build Coastguard Workeris unable to do so, it must use the URI specified in the system
2571*7c568831SAndroid Build Coastguard Workerliteral.  Before a match is attempted, all strings
2572*7c568831SAndroid Build Coastguard Workerof white space in the public identifier must be normalized to single space characters (#x20),
2573*7c568831SAndroid Build Coastguard Workerand leading and trailing white space must be removed.</p>
2574*7c568831SAndroid Build Coastguard Worker<p>Examples of external entity declarations:
2575*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ENTITY open-hatch
2576*7c568831SAndroid Build Coastguard Worker         SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
2577*7c568831SAndroid Build Coastguard Worker&lt;!ENTITY open-hatch
2578*7c568831SAndroid Build Coastguard Worker         PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
2579*7c568831SAndroid Build Coastguard Worker         "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
2580*7c568831SAndroid Build Coastguard Worker&lt;!ENTITY hatch-pic
2581*7c568831SAndroid Build Coastguard Worker         SYSTEM "../grafix/OpenHatch.gif"
2582*7c568831SAndroid Build Coastguard Worker         NDATA gif &gt;</eg></p>
2583*7c568831SAndroid Build Coastguard Worker</div3>
2584*7c568831SAndroid Build Coastguard Worker
2585*7c568831SAndroid Build Coastguard Worker</div2>
2586*7c568831SAndroid Build Coastguard Worker
2587*7c568831SAndroid Build Coastguard Worker<div2 id="TextEntities">
2588*7c568831SAndroid Build Coastguard Worker<head>Parsed Entities</head>
2589*7c568831SAndroid Build Coastguard Worker<div3 id="sec-TextDecl">
2590*7c568831SAndroid Build Coastguard Worker<head>The Text Declaration</head>
2591*7c568831SAndroid Build Coastguard Worker<p>External parsed entities may each begin with a <term>text
2592*7c568831SAndroid Build Coastguard Workerdeclaration</term>.
2593*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2594*7c568831SAndroid Build Coastguard Worker<head>Text Declaration</head>
2595*7c568831SAndroid Build Coastguard Worker<prodgroup pcw4="12.5" pcw5="13">
2596*7c568831SAndroid Build Coastguard Worker<prod id="NT-TextDecl"><lhs>TextDecl</lhs>
2597*7c568831SAndroid Build Coastguard Worker<rhs>&xmlpio;
2598*7c568831SAndroid Build Coastguard Worker<nt def="NT-VersionInfo">VersionInfo</nt>?
2599*7c568831SAndroid Build Coastguard Worker<nt def="NT-EncodingDecl">EncodingDecl</nt>
2600*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? &pic;</rhs>
2601*7c568831SAndroid Build Coastguard Worker</prod>
2602*7c568831SAndroid Build Coastguard Worker</prodgroup>
2603*7c568831SAndroid Build Coastguard Worker</scrap>
2604*7c568831SAndroid Build Coastguard Worker</p>
2605*7c568831SAndroid Build Coastguard Worker<p>The text declaration must be provided literally, not
2606*7c568831SAndroid Build Coastguard Workerby reference to a parsed entity.
2607*7c568831SAndroid Build Coastguard WorkerNo text declaration may appear at any position other than the beginning of
2608*7c568831SAndroid Build Coastguard Workeran external parsed entity.</p>
2609*7c568831SAndroid Build Coastguard Worker</div3>
2610*7c568831SAndroid Build Coastguard Worker<div3 id="wf-entities">
2611*7c568831SAndroid Build Coastguard Worker<head>Well-Formed Parsed Entities</head>
2612*7c568831SAndroid Build Coastguard Worker<p>The document entity is well-formed if it matches the production labeled
2613*7c568831SAndroid Build Coastguard Worker<nt def="NT-document">document</nt>.
2614*7c568831SAndroid Build Coastguard WorkerAn external general
2615*7c568831SAndroid Build Coastguard Workerparsed entity is well-formed if it matches the production labeled
2616*7c568831SAndroid Build Coastguard Worker<nt def="NT-extParsedEnt">extParsedEnt</nt>.
2617*7c568831SAndroid Build Coastguard WorkerAn external parameter
2618*7c568831SAndroid Build Coastguard Workerentity is well-formed if it matches the production labeled
2619*7c568831SAndroid Build Coastguard Worker<nt def="NT-extPE">extPE</nt>.
2620*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2621*7c568831SAndroid Build Coastguard Worker<head>Well-Formed External Parsed Entity</head>
2622*7c568831SAndroid Build Coastguard Worker<prod id="NT-extParsedEnt"><lhs>extParsedEnt</lhs>
2623*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-TextDecl">TextDecl</nt>?
2624*7c568831SAndroid Build Coastguard Worker<nt def="NT-content">content</nt></rhs>
2625*7c568831SAndroid Build Coastguard Worker</prod>
2626*7c568831SAndroid Build Coastguard Worker<prod id="NT-extPE"><lhs>extPE</lhs>
2627*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-TextDecl">TextDecl</nt>?
2628*7c568831SAndroid Build Coastguard Worker<nt def="NT-extSubsetDecl">extSubsetDecl</nt></rhs>
2629*7c568831SAndroid Build Coastguard Worker</prod>
2630*7c568831SAndroid Build Coastguard Worker</scrap>
2631*7c568831SAndroid Build Coastguard WorkerAn internal general parsed entity is well-formed if its replacement text
2632*7c568831SAndroid Build Coastguard Workermatches the production labeled
2633*7c568831SAndroid Build Coastguard Worker<nt def="NT-content">content</nt>.
2634*7c568831SAndroid Build Coastguard WorkerAll internal parameter entities are well-formed by definition.
2635*7c568831SAndroid Build Coastguard Worker</p>
2636*7c568831SAndroid Build Coastguard Worker<p>A consequence of well-formedness in entities is that the logical
2637*7c568831SAndroid Build Coastguard Workerand physical structures in an XML document are properly nested; no
2638*7c568831SAndroid Build Coastguard Worker<termref def="dt-stag">start-tag</termref>,
2639*7c568831SAndroid Build Coastguard Worker<termref def="dt-etag">end-tag</termref>,
2640*7c568831SAndroid Build Coastguard Worker<termref def="dt-empty">empty-element tag</termref>,
2641*7c568831SAndroid Build Coastguard Worker<termref def="dt-element">element</termref>,
2642*7c568831SAndroid Build Coastguard Worker<termref def="dt-comment">comment</termref>,
2643*7c568831SAndroid Build Coastguard Worker<termref def="dt-pi">processing instruction</termref>,
2644*7c568831SAndroid Build Coastguard Worker<termref def="dt-charref">character
2645*7c568831SAndroid Build Coastguard Workerreference</termref>, or
2646*7c568831SAndroid Build Coastguard Worker<termref def="dt-entref">entity reference</termref>
2647*7c568831SAndroid Build Coastguard Workercan begin in one entity and end in another.</p>
2648*7c568831SAndroid Build Coastguard Worker</div3>
2649*7c568831SAndroid Build Coastguard Worker<div3 id="charencoding">
2650*7c568831SAndroid Build Coastguard Worker<head>Character Encoding in Entities</head>
2651*7c568831SAndroid Build Coastguard Worker
2652*7c568831SAndroid Build Coastguard Worker<p>Each external parsed entity in an XML document may use a different
2653*7c568831SAndroid Build Coastguard Workerencoding for its characters. All XML processors must be able to read
2654*7c568831SAndroid Build Coastguard Workerentities in either UTF-8 or UTF-16.
2655*7c568831SAndroid Build Coastguard Worker
2656*7c568831SAndroid Build Coastguard Worker</p>
2657*7c568831SAndroid Build Coastguard Worker<p>Entities encoded in UTF-16 must
2658*7c568831SAndroid Build Coastguard Workerbegin with the Byte Order Mark described by ISO/IEC 10646 Annex E and
2659*7c568831SAndroid Build Coastguard WorkerUnicode Appendix B (the ZERO WIDTH NO-BREAK SPACE character, #xFEFF).
2660*7c568831SAndroid Build Coastguard WorkerThis is an encoding signature, not part of either the markup or the
2661*7c568831SAndroid Build Coastguard Workercharacter data of the XML document.
2662*7c568831SAndroid Build Coastguard WorkerXML processors must be able to use this character to
2663*7c568831SAndroid Build Coastguard Workerdifferentiate between UTF-8 and UTF-16 encoded documents.</p>
2664*7c568831SAndroid Build Coastguard Worker<p>Although an XML processor is required to read only entities in
2665*7c568831SAndroid Build Coastguard Workerthe UTF-8 and UTF-16 encodings, it is recognized that other encodings are
2666*7c568831SAndroid Build Coastguard Workerused around the world, and it may be desired for XML processors
2667*7c568831SAndroid Build Coastguard Workerto read entities that use them.
2668*7c568831SAndroid Build Coastguard WorkerParsed entities which are stored in an encoding other than
2669*7c568831SAndroid Build Coastguard WorkerUTF-8 or UTF-16 must begin with a <titleref href="TextDecl">text
2670*7c568831SAndroid Build Coastguard Workerdeclaration</titleref> containing an encoding declaration:
2671*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
2672*7c568831SAndroid Build Coastguard Worker<head>Encoding Declaration</head>
2673*7c568831SAndroid Build Coastguard Worker<prod id="NT-EncodingDecl"><lhs>EncodingDecl</lhs>
2674*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-S">S</nt>
2675*7c568831SAndroid Build Coastguard Worker'encoding' <nt def="NT-Eq">Eq</nt>
2676*7c568831SAndroid Build Coastguard Worker('"' <nt def="NT-EncName">EncName</nt> '"' |
2677*7c568831SAndroid Build Coastguard Worker"'" <nt def="NT-EncName">EncName</nt> "'" )
2678*7c568831SAndroid Build Coastguard Worker</rhs>
2679*7c568831SAndroid Build Coastguard Worker</prod>
2680*7c568831SAndroid Build Coastguard Worker<prod id="NT-EncName"><lhs>EncName</lhs>
2681*7c568831SAndroid Build Coastguard Worker<rhs>[A-Za-z] ([A-Za-z0-9._] | '-')*</rhs>
2682*7c568831SAndroid Build Coastguard Worker<com>Encoding name contains only Latin characters</com>
2683*7c568831SAndroid Build Coastguard Worker</prod>
2684*7c568831SAndroid Build Coastguard Worker</scrap>
2685*7c568831SAndroid Build Coastguard WorkerIn the <termref def="dt-docent">document entity</termref>, the encoding
2686*7c568831SAndroid Build Coastguard Workerdeclaration is part of the <termref def="dt-xmldecl">XML declaration</termref>.
2687*7c568831SAndroid Build Coastguard WorkerThe <nt def="NT-EncName">EncName</nt> is the name of the encoding used.
2688*7c568831SAndroid Build Coastguard Worker</p>
2689*7c568831SAndroid Build Coastguard Worker<!-- FINAL EDIT:  check name of IANA and charset names -->
2690*7c568831SAndroid Build Coastguard Worker<p>In an encoding declaration, the values
2691*7c568831SAndroid Build Coastguard Worker"<code>UTF-8</code>",
2692*7c568831SAndroid Build Coastguard Worker"<code>UTF-16</code>",
2693*7c568831SAndroid Build Coastguard Worker"<code>ISO-10646-UCS-2</code>", and
2694*7c568831SAndroid Build Coastguard Worker"<code>ISO-10646-UCS-4</code>" should be
2695*7c568831SAndroid Build Coastguard Workerused for the various encodings and transformations of Unicode /
2696*7c568831SAndroid Build Coastguard WorkerISO/IEC 10646, the values
2697*7c568831SAndroid Build Coastguard Worker"<code>ISO-8859-1</code>",
2698*7c568831SAndroid Build Coastguard Worker"<code>ISO-8859-2</code>", ...
2699*7c568831SAndroid Build Coastguard Worker"<code>ISO-8859-9</code>" should be used for the parts of ISO 8859, and
2700*7c568831SAndroid Build Coastguard Workerthe values
2701*7c568831SAndroid Build Coastguard Worker"<code>ISO-2022-JP</code>",
2702*7c568831SAndroid Build Coastguard Worker"<code>Shift_JIS</code>", and
2703*7c568831SAndroid Build Coastguard Worker"<code>EUC-JP</code>"
2704*7c568831SAndroid Build Coastguard Workershould be used for the various encoded forms of JIS X-0208-1997.  XML
2705*7c568831SAndroid Build Coastguard Workerprocessors may recognize other encodings; it is recommended that
2706*7c568831SAndroid Build Coastguard Workercharacter encodings registered (as <emph>charset</emph>s)
2707*7c568831SAndroid Build Coastguard Workerwith the Internet Assigned Numbers
2708*7c568831SAndroid Build Coastguard WorkerAuthority <bibref ref="IANA"/>, other than those just listed, should be
2709*7c568831SAndroid Build Coastguard Workerreferred to
2710*7c568831SAndroid Build Coastguard Workerusing their registered names.
2711*7c568831SAndroid Build Coastguard WorkerNote that these registered names are defined to be
2712*7c568831SAndroid Build Coastguard Workercase-insensitive, so processors wishing to match against them
2713*7c568831SAndroid Build Coastguard Workershould do so in a case-insensitive
2714*7c568831SAndroid Build Coastguard Workerway.</p>
2715*7c568831SAndroid Build Coastguard Worker<p>In the absence of information provided by an external
2716*7c568831SAndroid Build Coastguard Workertransport protocol (e.g. HTTP or MIME),
2717*7c568831SAndroid Build Coastguard Workerit is an <termref def="dt-error">error</termref> for an entity including
2718*7c568831SAndroid Build Coastguard Workeran encoding declaration to be presented to the XML processor
2719*7c568831SAndroid Build Coastguard Workerin an encoding other than that named in the declaration,
2720*7c568831SAndroid Build Coastguard Workerfor an encoding declaration to occur other than at the beginning
2721*7c568831SAndroid Build Coastguard Workerof an external entity, or for
2722*7c568831SAndroid Build Coastguard Workeran entity which begins with neither a Byte Order Mark nor an encoding
2723*7c568831SAndroid Build Coastguard Workerdeclaration to use an encoding other than UTF-8.
2724*7c568831SAndroid Build Coastguard WorkerNote that since ASCII
2725*7c568831SAndroid Build Coastguard Workeris a subset of UTF-8, ordinary ASCII entities do not strictly need
2726*7c568831SAndroid Build Coastguard Workeran encoding declaration.</p>
2727*7c568831SAndroid Build Coastguard Worker
2728*7c568831SAndroid Build Coastguard Worker<p>It is a <termref def="dt-fatal">fatal error</termref> when an XML processor
2729*7c568831SAndroid Build Coastguard Workerencounters an entity with an encoding that it is unable to process.</p>
2730*7c568831SAndroid Build Coastguard Worker<p>Examples of encoding declarations:
2731*7c568831SAndroid Build Coastguard Worker<eg>&lt;?xml encoding='UTF-8'?&gt;
2732*7c568831SAndroid Build Coastguard Worker&lt;?xml encoding='EUC-JP'?&gt;</eg></p>
2733*7c568831SAndroid Build Coastguard Worker</div3>
2734*7c568831SAndroid Build Coastguard Worker</div2>
2735*7c568831SAndroid Build Coastguard Worker<div2 id="entproc">
2736*7c568831SAndroid Build Coastguard Worker<head>XML Processor Treatment of Entities and References</head>
2737*7c568831SAndroid Build Coastguard Worker<p>The table below summarizes the contexts in which character references,
2738*7c568831SAndroid Build Coastguard Workerentity references, and invocations of unparsed entities might appear and the
2739*7c568831SAndroid Build Coastguard Workerrequired behavior of an <termref def="dt-xml-proc">XML processor</termref> in
2740*7c568831SAndroid Build Coastguard Workereach case.
2741*7c568831SAndroid Build Coastguard WorkerThe labels in the leftmost column describe the recognition context:
2742*7c568831SAndroid Build Coastguard Worker<glist>
2743*7c568831SAndroid Build Coastguard Worker<gitem><label>Reference in Content</label>
2744*7c568831SAndroid Build Coastguard Worker<def><p>as a reference
2745*7c568831SAndroid Build Coastguard Workeranywhere after the <termref def="dt-stag">start-tag</termref> and
2746*7c568831SAndroid Build Coastguard Workerbefore the <termref def="dt-etag">end-tag</termref> of an element; corresponds
2747*7c568831SAndroid Build Coastguard Workerto the nonterminal <nt def="NT-content">content</nt>.</p></def>
2748*7c568831SAndroid Build Coastguard Worker</gitem>
2749*7c568831SAndroid Build Coastguard Worker<gitem>
2750*7c568831SAndroid Build Coastguard Worker<label>Reference in Attribute Value</label>
2751*7c568831SAndroid Build Coastguard Worker<def><p>as a reference within either the value of an attribute in a
2752*7c568831SAndroid Build Coastguard Worker<termref def="dt-stag">start-tag</termref>, or a default
2753*7c568831SAndroid Build Coastguard Workervalue in an <termref def="dt-attdecl">attribute declaration</termref>;
2754*7c568831SAndroid Build Coastguard Workercorresponds to the nonterminal
2755*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt>.</p></def></gitem>
2756*7c568831SAndroid Build Coastguard Worker<gitem>
2757*7c568831SAndroid Build Coastguard Worker<label>Occurs as Attribute Value</label>
2758*7c568831SAndroid Build Coastguard Worker<def><p>as a <nt def="NT-Name">Name</nt>, not a reference, appearing either as
2759*7c568831SAndroid Build Coastguard Workerthe value of an
2760*7c568831SAndroid Build Coastguard Workerattribute which has been declared as type <kw>ENTITY</kw>, or as one of
2761*7c568831SAndroid Build Coastguard Workerthe space-separated tokens in the value of an attribute which has been
2762*7c568831SAndroid Build Coastguard Workerdeclared as type <kw>ENTITIES</kw>.</p>
2763*7c568831SAndroid Build Coastguard Worker</def></gitem>
2764*7c568831SAndroid Build Coastguard Worker<gitem><label>Reference in Entity Value</label>
2765*7c568831SAndroid Build Coastguard Worker<def><p>as a reference
2766*7c568831SAndroid Build Coastguard Workerwithin a parameter or internal entity's
2767*7c568831SAndroid Build Coastguard Worker<termref def="dt-litentval">literal entity value</termref> in
2768*7c568831SAndroid Build Coastguard Workerthe entity's declaration; corresponds to the nonterminal
2769*7c568831SAndroid Build Coastguard Worker<nt def="NT-EntityValue">EntityValue</nt>.</p></def></gitem>
2770*7c568831SAndroid Build Coastguard Worker<gitem><label>Reference in DTD</label>
2771*7c568831SAndroid Build Coastguard Worker<def><p>as a reference within either the internal or external subsets of the
2772*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">DTD</termref>, but outside
2773*7c568831SAndroid Build Coastguard Workerof an <nt def="NT-EntityValue">EntityValue</nt> or
2774*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt>.</p></def>
2775*7c568831SAndroid Build Coastguard Worker</gitem>
2776*7c568831SAndroid Build Coastguard Worker</glist></p>
2777*7c568831SAndroid Build Coastguard Worker<htable border="1" cellpadding="7" align="center">
2778*7c568831SAndroid Build Coastguard Worker<htbody>
2779*7c568831SAndroid Build Coastguard Worker<tr><td bgcolor="&cellback;" rowspan="2" colspan="1"/>
2780*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="center" valign="bottom" colspan="4">Entity Type</td>
2781*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" rowspan="2" align="center">Character</td>
2782*7c568831SAndroid Build Coastguard Worker</tr>
2783*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="bottom">
2784*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;">Parameter</td>
2785*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;">Internal
2786*7c568831SAndroid Build Coastguard WorkerGeneral</td>
2787*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;">External Parsed
2788*7c568831SAndroid Build Coastguard WorkerGeneral</td>
2789*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;">Unparsed</td>
2790*7c568831SAndroid Build Coastguard Worker</tr>
2791*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="middle">
2792*7c568831SAndroid Build Coastguard Worker
2793*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="right">Reference
2794*7c568831SAndroid Build Coastguard Workerin Content</td>
2795*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not-recognized">Not recognized</titleref></td>
2796*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="included">Included</titleref></td>
2797*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="include-if-valid">Included if validating</titleref></td>
2798*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2799*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="included">Included</titleref></td>
2800*7c568831SAndroid Build Coastguard Worker</tr>
2801*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="middle">
2802*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="right">Reference
2803*7c568831SAndroid Build Coastguard Workerin Attribute Value</td>
2804*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not-recognized">Not recognized</titleref></td>
2805*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="inliteral">Included in literal</titleref></td>
2806*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2807*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2808*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="included">Included</titleref></td>
2809*7c568831SAndroid Build Coastguard Worker</tr>
2810*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="middle">
2811*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="right">Occurs as
2812*7c568831SAndroid Build Coastguard WorkerAttribute Value</td>
2813*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not-recognized">Not recognized</titleref></td>
2814*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not-recognized">Forbidden</titleref></td>
2815*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not-recognized">Forbidden</titleref></td>
2816*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="notify">Notify</titleref></td>
2817*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="not recognized">Not recognized</titleref></td>
2818*7c568831SAndroid Build Coastguard Worker</tr>
2819*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="middle">
2820*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="right">Reference
2821*7c568831SAndroid Build Coastguard Workerin EntityValue</td>
2822*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="inliteral">Included in literal</titleref></td>
2823*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="bypass">Bypassed</titleref></td>
2824*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="bypass">Bypassed</titleref></td>
2825*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2826*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="included">Included</titleref></td>
2827*7c568831SAndroid Build Coastguard Worker</tr>
2828*7c568831SAndroid Build Coastguard Worker<tr align="center" valign="middle">
2829*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;" align="right">Reference
2830*7c568831SAndroid Build Coastguard Workerin DTD</td>
2831*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="as-PE">Included as PE</titleref></td>
2832*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2833*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2834*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2835*7c568831SAndroid Build Coastguard Worker<td bgcolor="&cellback;"><titleref href="forbidden">Forbidden</titleref></td>
2836*7c568831SAndroid Build Coastguard Worker</tr>
2837*7c568831SAndroid Build Coastguard Worker</htbody>
2838*7c568831SAndroid Build Coastguard Worker</htable>
2839*7c568831SAndroid Build Coastguard Worker<div3 id="not-recognized">
2840*7c568831SAndroid Build Coastguard Worker<head>Not Recognized</head>
2841*7c568831SAndroid Build Coastguard Worker<p>Outside the DTD, the <code>%</code> character has no
2842*7c568831SAndroid Build Coastguard Workerspecial significance; thus, what would be parameter entity references in the
2843*7c568831SAndroid Build Coastguard WorkerDTD are not recognized as markup in <nt def="NT-content">content</nt>.
2844*7c568831SAndroid Build Coastguard WorkerSimilarly, the names of unparsed entities are not recognized except
2845*7c568831SAndroid Build Coastguard Workerwhen they appear in the value of an appropriately declared attribute.
2846*7c568831SAndroid Build Coastguard Worker</p>
2847*7c568831SAndroid Build Coastguard Worker</div3>
2848*7c568831SAndroid Build Coastguard Worker<div3 id="included">
2849*7c568831SAndroid Build Coastguard Worker<head>Included</head>
2850*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-include" term="Include">An entity is
2851*7c568831SAndroid Build Coastguard Worker<term>included</term> when its
2852*7c568831SAndroid Build Coastguard Worker<termref def="dt-repltext">replacement text</termref> is retrieved
2853*7c568831SAndroid Build Coastguard Workerand processed, in place of the reference itself,
2854*7c568831SAndroid Build Coastguard Workeras though it were part of the document at the location the
2855*7c568831SAndroid Build Coastguard Workerreference was recognized.
2856*7c568831SAndroid Build Coastguard WorkerThe replacement text may contain both
2857*7c568831SAndroid Build Coastguard Worker<termref def="dt-chardata">character data</termref>
2858*7c568831SAndroid Build Coastguard Workerand (except for parameter entities) <termref def="dt-markup">markup</termref>,
2859*7c568831SAndroid Build Coastguard Workerwhich must be recognized in
2860*7c568831SAndroid Build Coastguard Workerthe usual way, except that the replacement text of entities used to escape
2861*7c568831SAndroid Build Coastguard Workermarkup delimiters (the entities &magicents;) is always treated as
2862*7c568831SAndroid Build Coastguard Workerdata.  (The string "<code>AT&amp;amp;T;</code>" expands to
2863*7c568831SAndroid Build Coastguard Worker"<code>AT&amp;T;</code>" and the remaining ampersand is not recognized
2864*7c568831SAndroid Build Coastguard Workeras an entity-reference delimiter.)
2865*7c568831SAndroid Build Coastguard WorkerA character reference is <term>included</term> when the indicated
2866*7c568831SAndroid Build Coastguard Workercharacter is processed in place of the reference itself.
2867*7c568831SAndroid Build Coastguard Worker</termdef></p>
2868*7c568831SAndroid Build Coastguard Worker</div3>
2869*7c568831SAndroid Build Coastguard Worker<div3 id="include-if-valid">
2870*7c568831SAndroid Build Coastguard Worker<head>Included If Validating</head>
2871*7c568831SAndroid Build Coastguard Worker<p>When an XML processor recognizes a reference to a parsed entity, in order
2872*7c568831SAndroid Build Coastguard Workerto <termref def="dt-valid">validate</termref>
2873*7c568831SAndroid Build Coastguard Workerthe document, the processor must
2874*7c568831SAndroid Build Coastguard Worker<termref def="dt-include">include</termref> its
2875*7c568831SAndroid Build Coastguard Workerreplacement text.
2876*7c568831SAndroid Build Coastguard WorkerIf the entity is external, and the processor is not
2877*7c568831SAndroid Build Coastguard Workerattempting to validate the XML document, the
2878*7c568831SAndroid Build Coastguard Workerprocessor <termref def="dt-may">may</termref>, but need not,
2879*7c568831SAndroid Build Coastguard Workerinclude the entity's replacement text.
2880*7c568831SAndroid Build Coastguard WorkerIf a non-validating parser does not include the replacement text,
2881*7c568831SAndroid Build Coastguard Workerit must inform the application that it recognized, but did not
2882*7c568831SAndroid Build Coastguard Workerread, the entity.</p>
2883*7c568831SAndroid Build Coastguard Worker<p>This rule is based on the recognition that the automatic inclusion
2884*7c568831SAndroid Build Coastguard Workerprovided by the SGML and XML entity mechanism, primarily designed
2885*7c568831SAndroid Build Coastguard Workerto support modularity in authoring, is not necessarily
2886*7c568831SAndroid Build Coastguard Workerappropriate for other applications, in particular document browsing.
2887*7c568831SAndroid Build Coastguard WorkerBrowsers, for example, when encountering an external parsed entity reference,
2888*7c568831SAndroid Build Coastguard Workermight choose to provide a visual indication of the entity's
2889*7c568831SAndroid Build Coastguard Workerpresence and retrieve it for display only on demand.
2890*7c568831SAndroid Build Coastguard Worker</p>
2891*7c568831SAndroid Build Coastguard Worker</div3>
2892*7c568831SAndroid Build Coastguard Worker<div3 id="forbidden">
2893*7c568831SAndroid Build Coastguard Worker<head>Forbidden</head>
2894*7c568831SAndroid Build Coastguard Worker<p>The following are forbidden, and constitute
2895*7c568831SAndroid Build Coastguard Worker<termref def="dt-fatal">fatal</termref> errors:
2896*7c568831SAndroid Build Coastguard Worker<ulist>
2897*7c568831SAndroid Build Coastguard Worker<item><p>the appearance of a reference to an
2898*7c568831SAndroid Build Coastguard Worker<termref def="dt-unparsed">unparsed entity</termref>.
2899*7c568831SAndroid Build Coastguard Worker</p></item>
2900*7c568831SAndroid Build Coastguard Worker<item><p>the appearance of any character or general-entity reference in the
2901*7c568831SAndroid Build Coastguard WorkerDTD except within an <nt def="NT-EntityValue">EntityValue</nt> or
2902*7c568831SAndroid Build Coastguard Worker<nt def="NT-AttValue">AttValue</nt>.</p></item>
2903*7c568831SAndroid Build Coastguard Worker<item><p>a reference to an external entity in an attribute value.</p>
2904*7c568831SAndroid Build Coastguard Worker</item>
2905*7c568831SAndroid Build Coastguard Worker</ulist>
2906*7c568831SAndroid Build Coastguard Worker</p>
2907*7c568831SAndroid Build Coastguard Worker</div3>
2908*7c568831SAndroid Build Coastguard Worker<div3 id="inliteral">
2909*7c568831SAndroid Build Coastguard Worker<head>Included in Literal</head>
2910*7c568831SAndroid Build Coastguard Worker<p>When an <termref def="dt-entref">entity reference</termref> appears in an
2911*7c568831SAndroid Build Coastguard Workerattribute value, or a parameter entity reference appears in a literal entity
2912*7c568831SAndroid Build Coastguard Workervalue, its <termref def="dt-repltext">replacement text</termref> is
2913*7c568831SAndroid Build Coastguard Workerprocessed in place of the reference itself as though it
2914*7c568831SAndroid Build Coastguard Workerwere part of the document at the location the reference was recognized,
2915*7c568831SAndroid Build Coastguard Workerexcept that a single or double quote character in the replacement text
2916*7c568831SAndroid Build Coastguard Workeris always treated as a normal data character and will not terminate the
2917*7c568831SAndroid Build Coastguard Workerliteral.
2918*7c568831SAndroid Build Coastguard WorkerFor example, this is well-formed:
2919*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<!ENTITY % YN '"Yes"' >
2920*7c568831SAndroid Build Coastguard Worker<!ENTITY WhatHeSaid "He said &YN;" >]]></eg>
2921*7c568831SAndroid Build Coastguard Workerwhile this is not:
2922*7c568831SAndroid Build Coastguard Worker<eg>&lt;!ENTITY EndAttr "27'" &gt;
2923*7c568831SAndroid Build Coastguard Worker&lt;element attribute='a-&amp;EndAttr;&gt;</eg>
2924*7c568831SAndroid Build Coastguard Worker</p></div3>
2925*7c568831SAndroid Build Coastguard Worker<div3 id="notify">
2926*7c568831SAndroid Build Coastguard Worker<head>Notify</head>
2927*7c568831SAndroid Build Coastguard Worker<p>When the name of an <termref def="dt-unparsed">unparsed
2928*7c568831SAndroid Build Coastguard Workerentity</termref> appears as a token in the
2929*7c568831SAndroid Build Coastguard Workervalue of an attribute of declared type <kw>ENTITY</kw> or <kw>ENTITIES</kw>,
2930*7c568831SAndroid Build Coastguard Workera validating processor must inform the
2931*7c568831SAndroid Build Coastguard Workerapplication of the <termref def="dt-sysid">system</termref>
2932*7c568831SAndroid Build Coastguard Workerand <termref def="dt-pubid">public</termref> (if any)
2933*7c568831SAndroid Build Coastguard Workeridentifiers for both the entity and its associated
2934*7c568831SAndroid Build Coastguard Worker<termref def="dt-notation">notation</termref>.</p>
2935*7c568831SAndroid Build Coastguard Worker</div3>
2936*7c568831SAndroid Build Coastguard Worker<div3 id="bypass">
2937*7c568831SAndroid Build Coastguard Worker<head>Bypassed</head>
2938*7c568831SAndroid Build Coastguard Worker<p>When a general entity reference appears in the
2939*7c568831SAndroid Build Coastguard Worker<nt def="NT-EntityValue">EntityValue</nt> in an entity declaration,
2940*7c568831SAndroid Build Coastguard Workerit is bypassed and left as is.</p>
2941*7c568831SAndroid Build Coastguard Worker</div3>
2942*7c568831SAndroid Build Coastguard Worker<div3 id="as-PE">
2943*7c568831SAndroid Build Coastguard Worker<head>Included as PE</head>
2944*7c568831SAndroid Build Coastguard Worker<p>Just as with external parsed entities, parameter entities
2945*7c568831SAndroid Build Coastguard Workerneed only be <titleref href="include-if-valid">included if
2946*7c568831SAndroid Build Coastguard Workervalidating</titleref>.
2947*7c568831SAndroid Build Coastguard WorkerWhen a parameter-entity reference is recognized in the DTD
2948*7c568831SAndroid Build Coastguard Workerand included, its
2949*7c568831SAndroid Build Coastguard Worker<termref def="dt-repltext">replacement
2950*7c568831SAndroid Build Coastguard Workertext</termref> is enlarged by the attachment of one leading and one following
2951*7c568831SAndroid Build Coastguard Workerspace (#x20) character; the intent is to constrain the replacement
2952*7c568831SAndroid Build Coastguard Workertext of parameter
2953*7c568831SAndroid Build Coastguard Workerentities to contain an integral number of grammatical tokens in the DTD.
2954*7c568831SAndroid Build Coastguard Worker</p>
2955*7c568831SAndroid Build Coastguard Worker</div3>
2956*7c568831SAndroid Build Coastguard Worker
2957*7c568831SAndroid Build Coastguard Worker</div2>
2958*7c568831SAndroid Build Coastguard Worker<div2 id="intern-replacement">
2959*7c568831SAndroid Build Coastguard Worker<head>Construction of Internal Entity Replacement Text</head>
2960*7c568831SAndroid Build Coastguard Worker<p>In discussing the treatment
2961*7c568831SAndroid Build Coastguard Workerof internal entities, it is
2962*7c568831SAndroid Build Coastguard Workeruseful to distinguish two forms of the entity's value.
2963*7c568831SAndroid Build Coastguard Worker<termdef id="dt-litentval" term="Literal Entity Value">The <term>literal
2964*7c568831SAndroid Build Coastguard Workerentity value</term> is the quoted string actually
2965*7c568831SAndroid Build Coastguard Workerpresent in the entity declaration, corresponding to the
2966*7c568831SAndroid Build Coastguard Workernon-terminal <nt def="NT-EntityValue">EntityValue</nt>.</termdef>
2967*7c568831SAndroid Build Coastguard Worker<termdef id="dt-repltext" term="Replacement Text">The <term>replacement
2968*7c568831SAndroid Build Coastguard Workertext</term> is the content of the entity, after
2969*7c568831SAndroid Build Coastguard Workerreplacement of character references and parameter-entity
2970*7c568831SAndroid Build Coastguard Workerreferences.
2971*7c568831SAndroid Build Coastguard Worker</termdef></p>
2972*7c568831SAndroid Build Coastguard Worker
2973*7c568831SAndroid Build Coastguard Worker<p>The literal entity value
2974*7c568831SAndroid Build Coastguard Workeras given in an internal entity declaration
2975*7c568831SAndroid Build Coastguard Worker(<nt def="NT-EntityValue">EntityValue</nt>) may contain character,
2976*7c568831SAndroid Build Coastguard Workerparameter-entity, and general-entity references.
2977*7c568831SAndroid Build Coastguard WorkerSuch references must be contained entirely within the
2978*7c568831SAndroid Build Coastguard Workerliteral entity value.
2979*7c568831SAndroid Build Coastguard WorkerThe actual replacement text that is
2980*7c568831SAndroid Build Coastguard Worker<termref def="dt-include">included</termref> as described above
2981*7c568831SAndroid Build Coastguard Workermust contain the <emph>replacement text</emph> of any
2982*7c568831SAndroid Build Coastguard Workerparameter entities referred to, and must contain the character
2983*7c568831SAndroid Build Coastguard Workerreferred to, in place of any character references in the
2984*7c568831SAndroid Build Coastguard Workerliteral entity value; however,
2985*7c568831SAndroid Build Coastguard Workergeneral-entity references must be left as-is, unexpanded.
2986*7c568831SAndroid Build Coastguard WorkerFor example, given the following declarations:
2987*7c568831SAndroid Build Coastguard Worker
2988*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<!ENTITY % pub    "&#xc9;ditions Gallimard" >
2989*7c568831SAndroid Build Coastguard Worker<!ENTITY   rights "All rights reserved" >
2990*7c568831SAndroid Build Coastguard Worker<!ENTITY   book   "La Peste: Albert Camus,
2991*7c568831SAndroid Build Coastguard Worker&#xA9; 1947 %pub;. &rights;" >]]></eg>
2992*7c568831SAndroid Build Coastguard Workerthen the replacement text for the entity "<code>book</code>" is:
2993*7c568831SAndroid Build Coastguard Worker<eg>La Peste: Albert Camus,
2994*7c568831SAndroid Build Coastguard Worker� 1947 �ditions Gallimard. &amp;rights;</eg>
2995*7c568831SAndroid Build Coastguard WorkerThe general-entity reference "<code>&amp;rights;</code>" would be expanded
2996*7c568831SAndroid Build Coastguard Workershould the reference "<code>&amp;book;</code>" appear in the document's
2997*7c568831SAndroid Build Coastguard Workercontent or an attribute value.</p>
2998*7c568831SAndroid Build Coastguard Worker<p>These simple rules may have complex interactions; for a detailed
2999*7c568831SAndroid Build Coastguard Workerdiscussion of a difficult example, see
3000*7c568831SAndroid Build Coastguard Worker<specref ref="sec-entexpand"/>.
3001*7c568831SAndroid Build Coastguard Worker</p>
3002*7c568831SAndroid Build Coastguard Worker
3003*7c568831SAndroid Build Coastguard Worker</div2>
3004*7c568831SAndroid Build Coastguard Worker<div2 id="sec-predefined-ent">
3005*7c568831SAndroid Build Coastguard Worker<head>Predefined Entities</head>
3006*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-escape" term="escape">Entity and character
3007*7c568831SAndroid Build Coastguard Workerreferences can both be used to <term>escape</term> the left angle bracket,
3008*7c568831SAndroid Build Coastguard Workerampersand, and other delimiters.   A set of general entities
3009*7c568831SAndroid Build Coastguard Worker(&magicents;) is specified for this purpose.
3010*7c568831SAndroid Build Coastguard WorkerNumeric character references may also be used; they are
3011*7c568831SAndroid Build Coastguard Workerexpanded immediately when recognized and must be treated as
3012*7c568831SAndroid Build Coastguard Workercharacter data, so the numeric character references
3013*7c568831SAndroid Build Coastguard Worker"<code>&amp;#60;</code>" and "<code>&amp;#38;</code>" may be used to
3014*7c568831SAndroid Build Coastguard Workerescape <code>&lt;</code> and <code>&amp;</code> when they occur
3015*7c568831SAndroid Build Coastguard Workerin character data.</termdef></p>
3016*7c568831SAndroid Build Coastguard Worker<p>All XML processors must recognize these entities whether they
3017*7c568831SAndroid Build Coastguard Workerare declared or not.
3018*7c568831SAndroid Build Coastguard Worker<termref def="dt-interop">For interoperability</termref>,
3019*7c568831SAndroid Build Coastguard Workervalid XML documents should declare these
3020*7c568831SAndroid Build Coastguard Workerentities, like any others, before using them.
3021*7c568831SAndroid Build Coastguard WorkerIf the entities in question are declared, they must be declared
3022*7c568831SAndroid Build Coastguard Workeras internal entities whose replacement text is the single
3023*7c568831SAndroid Build Coastguard Workercharacter being escaped or a character reference to
3024*7c568831SAndroid Build Coastguard Workerthat character, as shown below.
3025*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<!ENTITY lt     "&#38;#60;">
3026*7c568831SAndroid Build Coastguard Worker<!ENTITY gt     "&#62;">
3027*7c568831SAndroid Build Coastguard Worker<!ENTITY amp    "&#38;#38;">
3028*7c568831SAndroid Build Coastguard Worker<!ENTITY apos   "&#39;">
3029*7c568831SAndroid Build Coastguard Worker<!ENTITY quot   "&#34;">
3030*7c568831SAndroid Build Coastguard Worker]]></eg>
3031*7c568831SAndroid Build Coastguard WorkerNote that the <code>&lt;</code> and <code>&amp;</code> characters
3032*7c568831SAndroid Build Coastguard Workerin the declarations of "<code>lt</code>" and "<code>amp</code>"
3033*7c568831SAndroid Build Coastguard Workerare doubly escaped to meet the requirement that entity replacement
3034*7c568831SAndroid Build Coastguard Workerbe well-formed.
3035*7c568831SAndroid Build Coastguard Worker</p>
3036*7c568831SAndroid Build Coastguard Worker</div2>
3037*7c568831SAndroid Build Coastguard Worker
3038*7c568831SAndroid Build Coastguard Worker<div2 id="Notations">
3039*7c568831SAndroid Build Coastguard Worker<head>Notation Declarations</head>
3040*7c568831SAndroid Build Coastguard Worker
3041*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-notation" term="Notation"><term>Notations</term> identify by
3042*7c568831SAndroid Build Coastguard Workername the format of <termref def="dt-extent">unparsed
3043*7c568831SAndroid Build Coastguard Workerentities</termref>, the
3044*7c568831SAndroid Build Coastguard Workerformat of elements which bear a notation attribute,
3045*7c568831SAndroid Build Coastguard Workeror the application to which
3046*7c568831SAndroid Build Coastguard Workera <termref def="dt-pi">processing instruction</termref> is
3047*7c568831SAndroid Build Coastguard Workeraddressed.</termdef></p>
3048*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-notdecl" term="Notation Declaration">
3049*7c568831SAndroid Build Coastguard Worker<term>Notation declarations</term>
3050*7c568831SAndroid Build Coastguard Workerprovide a name for the notation, for use in
3051*7c568831SAndroid Build Coastguard Workerentity and attribute-list declarations and in attribute specifications,
3052*7c568831SAndroid Build Coastguard Workerand an external identifier for the notation which may allow an XML
3053*7c568831SAndroid Build Coastguard Workerprocessor or its client application to locate a helper application
3054*7c568831SAndroid Build Coastguard Workercapable of processing data in the given notation.
3055*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf">
3056*7c568831SAndroid Build Coastguard Worker<head>Notation Declarations</head>
3057*7c568831SAndroid Build Coastguard Worker<prod id="NT-NotationDecl"><lhs>NotationDecl</lhs>
3058*7c568831SAndroid Build Coastguard Worker<rhs>'&lt;!NOTATION' <nt def="NT-S">S</nt> <nt def="NT-Name">Name</nt>
3059*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>
3060*7c568831SAndroid Build Coastguard Worker(<nt def="NT-ExternalID">ExternalID</nt> |
3061*7c568831SAndroid Build Coastguard Worker<nt def="NT-PublicID">PublicID</nt>)
3062*7c568831SAndroid Build Coastguard Worker<nt def="NT-S">S</nt>? '&gt;'</rhs></prod>
3063*7c568831SAndroid Build Coastguard Worker<prod id="NT-PublicID"><lhs>PublicID</lhs>
3064*7c568831SAndroid Build Coastguard Worker<rhs>'PUBLIC' <nt def="NT-S">S</nt>
3065*7c568831SAndroid Build Coastguard Worker<nt def="NT-PubidLiteral">PubidLiteral</nt>
3066*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3067*7c568831SAndroid Build Coastguard Worker</scrap>
3068*7c568831SAndroid Build Coastguard Worker</termdef></p>
3069*7c568831SAndroid Build Coastguard Worker<p>XML processors must provide applications with the name and external
3070*7c568831SAndroid Build Coastguard Workeridentifier(s) of any notation declared and referred to in an attribute
3071*7c568831SAndroid Build Coastguard Workervalue, attribute definition, or entity declaration.  They may
3072*7c568831SAndroid Build Coastguard Workeradditionally resolve the external identifier into the
3073*7c568831SAndroid Build Coastguard Worker<termref def="dt-sysid">system identifier</termref>,
3074*7c568831SAndroid Build Coastguard Workerfile name, or other information needed to allow the
3075*7c568831SAndroid Build Coastguard Workerapplication to call a processor for data in the notation described.  (It
3076*7c568831SAndroid Build Coastguard Workeris not an error, however, for XML documents to declare and refer to
3077*7c568831SAndroid Build Coastguard Workernotations for which notation-specific applications are not available on
3078*7c568831SAndroid Build Coastguard Workerthe system where the XML processor or application is running.)</p>
3079*7c568831SAndroid Build Coastguard Worker</div2>
3080*7c568831SAndroid Build Coastguard Worker
3081*7c568831SAndroid Build Coastguard Worker
3082*7c568831SAndroid Build Coastguard Worker<div2 id="sec-doc-entity">
3083*7c568831SAndroid Build Coastguard Worker<head>Document Entity</head>
3084*7c568831SAndroid Build Coastguard Worker
3085*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-docent" term="Document Entity">The <term>document
3086*7c568831SAndroid Build Coastguard Workerentity</term> serves as the root of the entity
3087*7c568831SAndroid Build Coastguard Workertree and a starting-point for an <termref def="dt-xml-proc">XML
3088*7c568831SAndroid Build Coastguard Workerprocessor</termref>.</termdef>
3089*7c568831SAndroid Build Coastguard WorkerThis specification does
3090*7c568831SAndroid Build Coastguard Workernot specify how the document entity is to be located by an XML
3091*7c568831SAndroid Build Coastguard Workerprocessor; unlike other entities, the document entity has no name and might
3092*7c568831SAndroid Build Coastguard Workerwell appear on a processor input stream
3093*7c568831SAndroid Build Coastguard Workerwithout any identification at all.</p>
3094*7c568831SAndroid Build Coastguard Worker</div2>
3095*7c568831SAndroid Build Coastguard Worker
3096*7c568831SAndroid Build Coastguard Worker
3097*7c568831SAndroid Build Coastguard Worker</div1>
3098*7c568831SAndroid Build Coastguard Worker<!-- &Conformance; -->
3099*7c568831SAndroid Build Coastguard Worker
3100*7c568831SAndroid Build Coastguard Worker<div1 id="sec-conformance">
3101*7c568831SAndroid Build Coastguard Worker<head>Conformance</head>
3102*7c568831SAndroid Build Coastguard Worker
3103*7c568831SAndroid Build Coastguard Worker<div2 id="proc-types">
3104*7c568831SAndroid Build Coastguard Worker<head>Validating and Non-Validating Processors</head>
3105*7c568831SAndroid Build Coastguard Worker<p>Conforming <termref def="dt-xml-proc">XML processors</termref> fall into two
3106*7c568831SAndroid Build Coastguard Workerclasses: validating and non-validating.</p>
3107*7c568831SAndroid Build Coastguard Worker<p>Validating and non-validating processors alike must report
3108*7c568831SAndroid Build Coastguard Workerviolations of this specification's well-formedness constraints
3109*7c568831SAndroid Build Coastguard Workerin the content of the
3110*7c568831SAndroid Build Coastguard Worker<termref def="dt-docent">document entity</termref> and any
3111*7c568831SAndroid Build Coastguard Workerother <termref def="dt-parsedent">parsed entities</termref> that
3112*7c568831SAndroid Build Coastguard Workerthey read.</p>
3113*7c568831SAndroid Build Coastguard Worker<p><termdef id="dt-validating" term="Validating Processor">
3114*7c568831SAndroid Build Coastguard Worker<term>Validating processors</term> must report
3115*7c568831SAndroid Build Coastguard Workerviolations of the constraints expressed by the declarations in the
3116*7c568831SAndroid Build Coastguard Worker<termref def="dt-doctype">DTD</termref>, and
3117*7c568831SAndroid Build Coastguard Workerfailures to fulfill the validity constraints given
3118*7c568831SAndroid Build Coastguard Workerin this specification.
3119*7c568831SAndroid Build Coastguard Worker</termdef>
3120*7c568831SAndroid Build Coastguard WorkerTo accomplish this, validating XML processors must read and process the entire
3121*7c568831SAndroid Build Coastguard WorkerDTD and all external parsed entities referenced in the document.
3122*7c568831SAndroid Build Coastguard Worker</p>
3123*7c568831SAndroid Build Coastguard Worker<p>Non-validating processors are required to check only the
3124*7c568831SAndroid Build Coastguard Worker<termref def="dt-docent">document entity</termref>, including
3125*7c568831SAndroid Build Coastguard Workerthe entire internal DTD subset, for well-formedness.
3126*7c568831SAndroid Build Coastguard Worker<termdef id="dt-use-mdecl" term="Process Declarations">
3127*7c568831SAndroid Build Coastguard WorkerWhile they are not required to check the document for validity,
3128*7c568831SAndroid Build Coastguard Workerthey are required to
3129*7c568831SAndroid Build Coastguard Worker<term>process</term> all the declarations they read in the
3130*7c568831SAndroid Build Coastguard Workerinternal DTD subset and in any parameter entity that they
3131*7c568831SAndroid Build Coastguard Workerread, up to the first reference
3132*7c568831SAndroid Build Coastguard Workerto a parameter entity that they do <emph>not</emph> read; that is to
3133*7c568831SAndroid Build Coastguard Workersay, they must
3134*7c568831SAndroid Build Coastguard Workeruse the information in those declarations to
3135*7c568831SAndroid Build Coastguard Worker<titleref href="AVNormalize">normalize</titleref> attribute values,
3136*7c568831SAndroid Build Coastguard Worker<titleref href="included">include</titleref> the replacement text of
3137*7c568831SAndroid Build Coastguard Workerinternal entities, and supply
3138*7c568831SAndroid Build Coastguard Worker<titleref href="sec-attr-defaults">default attribute values</titleref>.
3139*7c568831SAndroid Build Coastguard Worker</termdef>
3140*7c568831SAndroid Build Coastguard WorkerThey must not <termref def="dt-use-mdecl">process</termref>
3141*7c568831SAndroid Build Coastguard Worker<termref def="dt-entdecl">entity declarations</termref> or
3142*7c568831SAndroid Build Coastguard Worker<termref def="dt-attdecl">attribute-list declarations</termref>
3143*7c568831SAndroid Build Coastguard Workerencountered after a reference to a parameter entity that is not
3144*7c568831SAndroid Build Coastguard Workerread, since the entity may have contained overriding declarations.
3145*7c568831SAndroid Build Coastguard Worker</p>
3146*7c568831SAndroid Build Coastguard Worker</div2>
3147*7c568831SAndroid Build Coastguard Worker<div2 id="safe-behavior">
3148*7c568831SAndroid Build Coastguard Worker<head>Using XML Processors</head>
3149*7c568831SAndroid Build Coastguard Worker<p>The behavior of a validating XML processor is highly predictable; it
3150*7c568831SAndroid Build Coastguard Workermust read every piece of a document and report all well-formedness and
3151*7c568831SAndroid Build Coastguard Workervalidity violations.
3152*7c568831SAndroid Build Coastguard WorkerLess is required of a non-validating processor; it need not read any
3153*7c568831SAndroid Build Coastguard Workerpart of the document other than the document entity.
3154*7c568831SAndroid Build Coastguard WorkerThis has two effects that may be important to users of XML processors:
3155*7c568831SAndroid Build Coastguard Worker<ulist>
3156*7c568831SAndroid Build Coastguard Worker<item><p>Certain well-formedness errors, specifically those that require
3157*7c568831SAndroid Build Coastguard Workerreading external entities, may not be detected by a non-validating processor.
3158*7c568831SAndroid Build Coastguard WorkerExamples include the constraints entitled
3159*7c568831SAndroid Build Coastguard Worker<titleref href="wf-entdeclared">Entity Declared</titleref>,
3160*7c568831SAndroid Build Coastguard Worker<titleref href="wf-textent">Parsed Entity</titleref>, and
3161*7c568831SAndroid Build Coastguard Worker<titleref href="wf-norecursion">No Recursion</titleref>, as well
3162*7c568831SAndroid Build Coastguard Workeras some of the cases described as
3163*7c568831SAndroid Build Coastguard Worker<titleref href="forbidden">forbidden</titleref> in
3164*7c568831SAndroid Build Coastguard Worker<specref ref="entproc"/>.</p></item>
3165*7c568831SAndroid Build Coastguard Worker<item><p>The information passed from the processor to the application may
3166*7c568831SAndroid Build Coastguard Workervary, depending on whether the processor reads
3167*7c568831SAndroid Build Coastguard Workerparameter and external entities.
3168*7c568831SAndroid Build Coastguard WorkerFor example, a non-validating processor may not
3169*7c568831SAndroid Build Coastguard Worker<titleref href="AVNormalize">normalize</titleref> attribute values,
3170*7c568831SAndroid Build Coastguard Worker<titleref href="included">include</titleref> the replacement text of
3171*7c568831SAndroid Build Coastguard Workerinternal entities, or supply
3172*7c568831SAndroid Build Coastguard Worker<titleref href="sec-attr-defaults">default attribute values</titleref>,
3173*7c568831SAndroid Build Coastguard Workerwhere doing so depends on having read declarations in
3174*7c568831SAndroid Build Coastguard Workerexternal or parameter entities.</p></item>
3175*7c568831SAndroid Build Coastguard Worker</ulist>
3176*7c568831SAndroid Build Coastguard Worker</p>
3177*7c568831SAndroid Build Coastguard Worker<p>For maximum reliability in interoperating between different XML
3178*7c568831SAndroid Build Coastguard Workerprocessors, applications which use non-validating processors should not
3179*7c568831SAndroid Build Coastguard Workerrely on any behaviors not required of such processors.
3180*7c568831SAndroid Build Coastguard WorkerApplications which require facilities such as the use of default
3181*7c568831SAndroid Build Coastguard Workerattributes or internal entities which are declared in external
3182*7c568831SAndroid Build Coastguard Workerentities should use validating XML processors.</p>
3183*7c568831SAndroid Build Coastguard Worker</div2>
3184*7c568831SAndroid Build Coastguard Worker</div1>
3185*7c568831SAndroid Build Coastguard Worker
3186*7c568831SAndroid Build Coastguard Worker<div1 id="sec-notation">
3187*7c568831SAndroid Build Coastguard Worker<head>Notation</head>
3188*7c568831SAndroid Build Coastguard Worker
3189*7c568831SAndroid Build Coastguard Worker<p>The formal grammar of XML is given in this specification using a simple
3190*7c568831SAndroid Build Coastguard WorkerExtended Backus-Naur Form (EBNF) notation.  Each rule in the grammar defines
3191*7c568831SAndroid Build Coastguard Workerone symbol, in the form
3192*7c568831SAndroid Build Coastguard Worker<eg>symbol ::= expression</eg></p>
3193*7c568831SAndroid Build Coastguard Worker<p>Symbols are written with an initial capital letter if they are
3194*7c568831SAndroid Build Coastguard Workerdefined by a regular expression, or with an initial lower case letter
3195*7c568831SAndroid Build Coastguard Workerotherwise.
3196*7c568831SAndroid Build Coastguard WorkerLiteral strings are quoted.
3197*7c568831SAndroid Build Coastguard Worker
3198*7c568831SAndroid Build Coastguard Worker</p>
3199*7c568831SAndroid Build Coastguard Worker
3200*7c568831SAndroid Build Coastguard Worker<p>Within the expression on the right-hand side of a rule, the following
3201*7c568831SAndroid Build Coastguard Workerexpressions are used to match strings of one or more characters:
3202*7c568831SAndroid Build Coastguard Worker<glist>
3203*7c568831SAndroid Build Coastguard Worker<gitem>
3204*7c568831SAndroid Build Coastguard Worker<label><code>#xN</code></label>
3205*7c568831SAndroid Build Coastguard Worker<def><p>where <code>N</code> is a hexadecimal integer, the
3206*7c568831SAndroid Build Coastguard Workerexpression matches the character in ISO/IEC 10646 whose canonical
3207*7c568831SAndroid Build Coastguard Worker(UCS-4)
3208*7c568831SAndroid Build Coastguard Workercode value, when interpreted as an unsigned binary number, has
3209*7c568831SAndroid Build Coastguard Workerthe value indicated.  The number of leading zeros in the
3210*7c568831SAndroid Build Coastguard Worker<code>#xN</code> form is insignificant; the number of leading
3211*7c568831SAndroid Build Coastguard Workerzeros in the corresponding code value
3212*7c568831SAndroid Build Coastguard Workeris governed by the character
3213*7c568831SAndroid Build Coastguard Workerencoding in use and is not significant for XML.</p></def>
3214*7c568831SAndroid Build Coastguard Worker</gitem>
3215*7c568831SAndroid Build Coastguard Worker<gitem>
3216*7c568831SAndroid Build Coastguard Worker<label><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></label>
3217*7c568831SAndroid Build Coastguard Worker<def><p>matches any <termref def="dt-character">character</termref>
3218*7c568831SAndroid Build Coastguard Workerwith a value in the range(s) indicated (inclusive).</p></def>
3219*7c568831SAndroid Build Coastguard Worker</gitem>
3220*7c568831SAndroid Build Coastguard Worker<gitem>
3221*7c568831SAndroid Build Coastguard Worker<label><code>[^a-z]</code>, <code>[^#xN-#xN]</code></label>
3222*7c568831SAndroid Build Coastguard Worker<def><p>matches any <termref def="dt-character">character</termref>
3223*7c568831SAndroid Build Coastguard Workerwith a value <emph>outside</emph> the
3224*7c568831SAndroid Build Coastguard Workerrange indicated.</p></def>
3225*7c568831SAndroid Build Coastguard Worker</gitem>
3226*7c568831SAndroid Build Coastguard Worker<gitem>
3227*7c568831SAndroid Build Coastguard Worker<label><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></label>
3228*7c568831SAndroid Build Coastguard Worker<def><p>matches any <termref def="dt-character">character</termref>
3229*7c568831SAndroid Build Coastguard Workerwith a value not among the characters given.</p></def>
3230*7c568831SAndroid Build Coastguard Worker</gitem>
3231*7c568831SAndroid Build Coastguard Worker<gitem>
3232*7c568831SAndroid Build Coastguard Worker<label><code>"string"</code></label>
3233*7c568831SAndroid Build Coastguard Worker<def><p>matches a literal string <termref def="dt-match">matching</termref>
3234*7c568831SAndroid Build Coastguard Workerthat given inside the double quotes.</p></def>
3235*7c568831SAndroid Build Coastguard Worker</gitem>
3236*7c568831SAndroid Build Coastguard Worker<gitem>
3237*7c568831SAndroid Build Coastguard Worker<label><code>'string'</code></label>
3238*7c568831SAndroid Build Coastguard Worker<def><p>matches a literal string <termref def="dt-match">matching</termref>
3239*7c568831SAndroid Build Coastguard Workerthat given inside the single quotes.</p></def>
3240*7c568831SAndroid Build Coastguard Worker</gitem>
3241*7c568831SAndroid Build Coastguard Worker</glist>
3242*7c568831SAndroid Build Coastguard WorkerThese symbols may be combined to match more complex patterns as follows,
3243*7c568831SAndroid Build Coastguard Workerwhere <code>A</code> and <code>B</code> represent simple expressions:
3244*7c568831SAndroid Build Coastguard Worker<glist>
3245*7c568831SAndroid Build Coastguard Worker<gitem>
3246*7c568831SAndroid Build Coastguard Worker<label>(<code>expression</code>)</label>
3247*7c568831SAndroid Build Coastguard Worker<def><p><code>expression</code> is treated as a unit
3248*7c568831SAndroid Build Coastguard Workerand may be combined as described in this list.</p></def>
3249*7c568831SAndroid Build Coastguard Worker</gitem>
3250*7c568831SAndroid Build Coastguard Worker<gitem>
3251*7c568831SAndroid Build Coastguard Worker<label><code>A?</code></label>
3252*7c568831SAndroid Build Coastguard Worker<def><p>matches <code>A</code> or nothing; optional <code>A</code>.</p></def>
3253*7c568831SAndroid Build Coastguard Worker</gitem>
3254*7c568831SAndroid Build Coastguard Worker<gitem>
3255*7c568831SAndroid Build Coastguard Worker<label><code>A B</code></label>
3256*7c568831SAndroid Build Coastguard Worker<def><p>matches <code>A</code> followed by <code>B</code>.</p></def>
3257*7c568831SAndroid Build Coastguard Worker</gitem>
3258*7c568831SAndroid Build Coastguard Worker<gitem>
3259*7c568831SAndroid Build Coastguard Worker<label><code>A | B</code></label>
3260*7c568831SAndroid Build Coastguard Worker<def><p>matches <code>A</code> or <code>B</code> but not both.</p></def>
3261*7c568831SAndroid Build Coastguard Worker</gitem>
3262*7c568831SAndroid Build Coastguard Worker<gitem>
3263*7c568831SAndroid Build Coastguard Worker<label><code>A - B</code></label>
3264*7c568831SAndroid Build Coastguard Worker<def><p>matches any string that matches <code>A</code> but does not match
3265*7c568831SAndroid Build Coastguard Worker<code>B</code>.
3266*7c568831SAndroid Build Coastguard Worker</p></def>
3267*7c568831SAndroid Build Coastguard Worker</gitem>
3268*7c568831SAndroid Build Coastguard Worker<gitem>
3269*7c568831SAndroid Build Coastguard Worker<label><code>A+</code></label>
3270*7c568831SAndroid Build Coastguard Worker<def><p>matches one or more occurrences of <code>A</code>.</p></def>
3271*7c568831SAndroid Build Coastguard Worker</gitem>
3272*7c568831SAndroid Build Coastguard Worker<gitem>
3273*7c568831SAndroid Build Coastguard Worker<label><code>A*</code></label>
3274*7c568831SAndroid Build Coastguard Worker<def><p>matches zero or more occurrences of <code>A</code>.</p></def>
3275*7c568831SAndroid Build Coastguard Worker</gitem>
3276*7c568831SAndroid Build Coastguard Worker
3277*7c568831SAndroid Build Coastguard Worker</glist>
3278*7c568831SAndroid Build Coastguard WorkerOther notations used in the productions are:
3279*7c568831SAndroid Build Coastguard Worker<glist>
3280*7c568831SAndroid Build Coastguard Worker<gitem>
3281*7c568831SAndroid Build Coastguard Worker<label><code>/* ... */</code></label>
3282*7c568831SAndroid Build Coastguard Worker<def><p>comment.</p></def>
3283*7c568831SAndroid Build Coastguard Worker</gitem>
3284*7c568831SAndroid Build Coastguard Worker<gitem>
3285*7c568831SAndroid Build Coastguard Worker<label><code>[ wfc: ... ]</code></label>
3286*7c568831SAndroid Build Coastguard Worker<def><p>well-formedness constraint; this identifies by name a
3287*7c568831SAndroid Build Coastguard Workerconstraint on
3288*7c568831SAndroid Build Coastguard Worker<termref def="dt-wellformed">well-formed</termref> documents
3289*7c568831SAndroid Build Coastguard Workerassociated with a production.</p></def>
3290*7c568831SAndroid Build Coastguard Worker</gitem>
3291*7c568831SAndroid Build Coastguard Worker<gitem>
3292*7c568831SAndroid Build Coastguard Worker<label><code>[ vc: ... ]</code></label>
3293*7c568831SAndroid Build Coastguard Worker<def><p>validity constraint; this identifies by name a constraint on
3294*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">valid</termref> documents associated with
3295*7c568831SAndroid Build Coastguard Workera production.</p></def>
3296*7c568831SAndroid Build Coastguard Worker</gitem>
3297*7c568831SAndroid Build Coastguard Worker</glist>
3298*7c568831SAndroid Build Coastguard Worker</p></div1>
3299*7c568831SAndroid Build Coastguard Worker
3300*7c568831SAndroid Build Coastguard Worker</body>
3301*7c568831SAndroid Build Coastguard Worker<back>
3302*7c568831SAndroid Build Coastguard Worker<!-- &SGML; -->
3303*7c568831SAndroid Build Coastguard Worker
3304*7c568831SAndroid Build Coastguard Worker
3305*7c568831SAndroid Build Coastguard Worker<!-- &Biblio; -->
3306*7c568831SAndroid Build Coastguard Worker<div1 id="sec-bibliography">
3307*7c568831SAndroid Build Coastguard Worker
3308*7c568831SAndroid Build Coastguard Worker<head>References</head>
3309*7c568831SAndroid Build Coastguard Worker<div2 id="sec-existing-stds">
3310*7c568831SAndroid Build Coastguard Worker<head>Normative References</head>
3311*7c568831SAndroid Build Coastguard Worker
3312*7c568831SAndroid Build Coastguard Worker<blist>
3313*7c568831SAndroid Build Coastguard Worker<bibl id="IANA" key="IANA">
3314*7c568831SAndroid Build Coastguard Worker(Internet Assigned Numbers Authority) <emph>Official Names for
3315*7c568831SAndroid Build Coastguard WorkerCharacter Sets</emph>,
3316*7c568831SAndroid Build Coastguard Workered. Keld Simonsen et al.
3317*7c568831SAndroid Build Coastguard WorkerSee <loc href="ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets">ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets</loc>.
3318*7c568831SAndroid Build Coastguard Worker</bibl>
3319*7c568831SAndroid Build Coastguard Worker
3320*7c568831SAndroid Build Coastguard Worker<bibl id="RFC1766" key="IETF RFC 1766">
3321*7c568831SAndroid Build Coastguard WorkerIETF (Internet Engineering Task Force).
3322*7c568831SAndroid Build Coastguard Worker<emph>RFC 1766:  Tags for the Identification of Languages</emph>,
3323*7c568831SAndroid Build Coastguard Workered. H. Alvestrand.
3324*7c568831SAndroid Build Coastguard Worker1995.
3325*7c568831SAndroid Build Coastguard Worker</bibl>
3326*7c568831SAndroid Build Coastguard Worker
3327*7c568831SAndroid Build Coastguard Worker<bibl id="ISO639" key="ISO 639">
3328*7c568831SAndroid Build Coastguard Worker(International Organization for Standardization).
3329*7c568831SAndroid Build Coastguard Worker<emph>ISO 639:1988 (E).
3330*7c568831SAndroid Build Coastguard WorkerCode for the representation of names of languages.</emph>
3331*7c568831SAndroid Build Coastguard Worker[Geneva]:  International Organization for
3332*7c568831SAndroid Build Coastguard WorkerStandardization, 1988.</bibl>
3333*7c568831SAndroid Build Coastguard Worker
3334*7c568831SAndroid Build Coastguard Worker<bibl id="ISO3166" key="ISO 3166">
3335*7c568831SAndroid Build Coastguard Worker(International Organization for Standardization).
3336*7c568831SAndroid Build Coastguard Worker<emph>ISO 3166-1:1997 (E).
3337*7c568831SAndroid Build Coastguard WorkerCodes for the representation of names of countries and their subdivisions
3338*7c568831SAndroid Build Coastguard Worker&mdash; Part 1: Country codes</emph>
3339*7c568831SAndroid Build Coastguard Worker[Geneva]:  International Organization for
3340*7c568831SAndroid Build Coastguard WorkerStandardization, 1997.</bibl>
3341*7c568831SAndroid Build Coastguard Worker
3342*7c568831SAndroid Build Coastguard Worker<bibl id="ISO10646" key="ISO/IEC 10646">ISO
3343*7c568831SAndroid Build Coastguard Worker(International Organization for Standardization).
3344*7c568831SAndroid Build Coastguard Worker<emph>ISO/IEC 10646-1993 (E).  Information technology &mdash; Universal
3345*7c568831SAndroid Build Coastguard WorkerMultiple-Octet Coded Character Set (UCS) &mdash; Part 1:
3346*7c568831SAndroid Build Coastguard WorkerArchitecture and Basic Multilingual Plane.</emph>
3347*7c568831SAndroid Build Coastguard Worker[Geneva]:  International Organization for
3348*7c568831SAndroid Build Coastguard WorkerStandardization, 1993 (plus amendments AM 1 through AM 7).
3349*7c568831SAndroid Build Coastguard Worker</bibl>
3350*7c568831SAndroid Build Coastguard Worker
3351*7c568831SAndroid Build Coastguard Worker<bibl id="Unicode" key="Unicode">The Unicode Consortium.
3352*7c568831SAndroid Build Coastguard Worker<emph>The Unicode Standard, Version 2.0.</emph>
3353*7c568831SAndroid Build Coastguard WorkerReading, Mass.:  Addison-Wesley Developers Press, 1996.</bibl>
3354*7c568831SAndroid Build Coastguard Worker
3355*7c568831SAndroid Build Coastguard Worker</blist>
3356*7c568831SAndroid Build Coastguard Worker
3357*7c568831SAndroid Build Coastguard Worker</div2>
3358*7c568831SAndroid Build Coastguard Worker
3359*7c568831SAndroid Build Coastguard Worker<div2><head>Other References</head>
3360*7c568831SAndroid Build Coastguard Worker
3361*7c568831SAndroid Build Coastguard Worker<blist>
3362*7c568831SAndroid Build Coastguard Worker
3363*7c568831SAndroid Build Coastguard Worker<bibl id="Aho" key="Aho/Ullman">Aho, Alfred V.,
3364*7c568831SAndroid Build Coastguard WorkerRavi Sethi, and Jeffrey D. Ullman.
3365*7c568831SAndroid Build Coastguard Worker<emph>Compilers:  Principles, Techniques, and Tools</emph>.
3366*7c568831SAndroid Build Coastguard WorkerReading:  Addison-Wesley, 1986, rpt. corr. 1988.</bibl>
3367*7c568831SAndroid Build Coastguard Worker
3368*7c568831SAndroid Build Coastguard Worker<bibl id="Berners-Lee" xml-link="simple" key="Berners-Lee et al.">
3369*7c568831SAndroid Build Coastguard WorkerBerners-Lee, T., R. Fielding, and L. Masinter.
3370*7c568831SAndroid Build Coastguard Worker<emph>Uniform Resource Identifiers (URI):  Generic Syntax and
3371*7c568831SAndroid Build Coastguard WorkerSemantics</emph>.
3372*7c568831SAndroid Build Coastguard Worker1997.
3373*7c568831SAndroid Build Coastguard Worker(Work in progress; see updates to RFC1738.)</bibl>
3374*7c568831SAndroid Build Coastguard Worker
3375*7c568831SAndroid Build Coastguard Worker<bibl id="ABK" key="Br�ggemann-Klein">Br�ggemann-Klein, Anne.
3376*7c568831SAndroid Build Coastguard Worker<emph>Regular Expressions into Finite Automata</emph>.
3377*7c568831SAndroid Build Coastguard WorkerExtended abstract in I. Simon, Hrsg., LATIN 1992,
3378*7c568831SAndroid Build Coastguard WorkerS. 97-98. Springer-Verlag, Berlin 1992.
3379*7c568831SAndroid Build Coastguard WorkerFull Version in Theoretical Computer Science 120: 197-213, 1993.
3380*7c568831SAndroid Build Coastguard Worker
3381*7c568831SAndroid Build Coastguard Worker</bibl>
3382*7c568831SAndroid Build Coastguard Worker
3383*7c568831SAndroid Build Coastguard Worker<bibl id="ABKDW" key="Br�ggemann-Klein and Wood">Br�ggemann-Klein, Anne,
3384*7c568831SAndroid Build Coastguard Workerand Derick Wood.
3385*7c568831SAndroid Build Coastguard Worker<emph>Deterministic Regular Languages</emph>.
3386*7c568831SAndroid Build Coastguard WorkerUniversit�t Freiburg, Institut f�r Informatik,
3387*7c568831SAndroid Build Coastguard WorkerBericht 38, Oktober 1991.
3388*7c568831SAndroid Build Coastguard Worker</bibl>
3389*7c568831SAndroid Build Coastguard Worker
3390*7c568831SAndroid Build Coastguard Worker<bibl id="Clark" key="Clark">James Clark.
3391*7c568831SAndroid Build Coastguard WorkerComparison of SGML and XML. See
3392*7c568831SAndroid Build Coastguard Worker<loc href="http://www.w3.org/TR/NOTE-sgml-xml-971215">http://www.w3.org/TR/NOTE-sgml-xml-971215</loc>.
3393*7c568831SAndroid Build Coastguard Worker</bibl>
3394*7c568831SAndroid Build Coastguard Worker<bibl id="RFC1738" xml-link="simple" key="IETF RFC1738">
3395*7c568831SAndroid Build Coastguard WorkerIETF (Internet Engineering Task Force).
3396*7c568831SAndroid Build Coastguard Worker<emph>RFC 1738:  Uniform Resource Locators (URL)</emph>,
3397*7c568831SAndroid Build Coastguard Workered. T. Berners-Lee, L. Masinter, M. McCahill.
3398*7c568831SAndroid Build Coastguard Worker1994.
3399*7c568831SAndroid Build Coastguard Worker</bibl>
3400*7c568831SAndroid Build Coastguard Worker
3401*7c568831SAndroid Build Coastguard Worker<bibl id="RFC1808" xml-link="simple" key="IETF RFC1808">
3402*7c568831SAndroid Build Coastguard WorkerIETF (Internet Engineering Task Force).
3403*7c568831SAndroid Build Coastguard Worker<emph>RFC 1808:  Relative Uniform Resource Locators</emph>,
3404*7c568831SAndroid Build Coastguard Workered. R. Fielding.
3405*7c568831SAndroid Build Coastguard Worker1995.
3406*7c568831SAndroid Build Coastguard Worker</bibl>
3407*7c568831SAndroid Build Coastguard Worker
3408*7c568831SAndroid Build Coastguard Worker<bibl id="RFC2141" xml-link="simple" key="IETF RFC2141">
3409*7c568831SAndroid Build Coastguard WorkerIETF (Internet Engineering Task Force).
3410*7c568831SAndroid Build Coastguard Worker<emph>RFC 2141:  URN Syntax</emph>,
3411*7c568831SAndroid Build Coastguard Workered. R. Moats.
3412*7c568831SAndroid Build Coastguard Worker1997.
3413*7c568831SAndroid Build Coastguard Worker</bibl>
3414*7c568831SAndroid Build Coastguard Worker
3415*7c568831SAndroid Build Coastguard Worker<bibl id="ISO8879" key="ISO 8879">ISO
3416*7c568831SAndroid Build Coastguard Worker(International Organization for Standardization).
3417*7c568831SAndroid Build Coastguard Worker<emph>ISO 8879:1986(E).  Information processing &mdash; Text and Office
3418*7c568831SAndroid Build Coastguard WorkerSystems &mdash; Standard Generalized Markup Language (SGML).</emph>  First
3419*7c568831SAndroid Build Coastguard Workeredition &mdash; 1986-10-15.  [Geneva]:  International Organization for
3420*7c568831SAndroid Build Coastguard WorkerStandardization, 1986.
3421*7c568831SAndroid Build Coastguard Worker</bibl>
3422*7c568831SAndroid Build Coastguard Worker
3423*7c568831SAndroid Build Coastguard Worker
3424*7c568831SAndroid Build Coastguard Worker<bibl id="ISO10744" key="ISO/IEC 10744">ISO
3425*7c568831SAndroid Build Coastguard Worker(International Organization for Standardization).
3426*7c568831SAndroid Build Coastguard Worker<emph>ISO/IEC 10744-1992 (E).  Information technology &mdash;
3427*7c568831SAndroid Build Coastguard WorkerHypermedia/Time-based Structuring Language (HyTime).
3428*7c568831SAndroid Build Coastguard Worker</emph>
3429*7c568831SAndroid Build Coastguard Worker[Geneva]:  International Organization for
3430*7c568831SAndroid Build Coastguard WorkerStandardization, 1992.
3431*7c568831SAndroid Build Coastguard Worker<emph>Extended Facilities Annexe.</emph>
3432*7c568831SAndroid Build Coastguard Worker[Geneva]:  International Organization for
3433*7c568831SAndroid Build Coastguard WorkerStandardization, 1996.
3434*7c568831SAndroid Build Coastguard Worker</bibl>
3435*7c568831SAndroid Build Coastguard Worker
3436*7c568831SAndroid Build Coastguard Worker
3437*7c568831SAndroid Build Coastguard Worker
3438*7c568831SAndroid Build Coastguard Worker</blist>
3439*7c568831SAndroid Build Coastguard Worker</div2>
3440*7c568831SAndroid Build Coastguard Worker</div1>
3441*7c568831SAndroid Build Coastguard Worker<div1 id="CharClasses">
3442*7c568831SAndroid Build Coastguard Worker<head>Character Classes</head>
3443*7c568831SAndroid Build Coastguard Worker<p>Following the characteristics defined in the Unicode standard,
3444*7c568831SAndroid Build Coastguard Workercharacters are classed as base characters (among others, these
3445*7c568831SAndroid Build Coastguard Workercontain the alphabetic characters of the Latin alphabet, without
3446*7c568831SAndroid Build Coastguard Workerdiacritics), ideographic characters, and combining characters (among
3447*7c568831SAndroid Build Coastguard Workerothers, this class contains most diacritics); these classes combine
3448*7c568831SAndroid Build Coastguard Workerto form the class of letters.  Digits and extenders are
3449*7c568831SAndroid Build Coastguard Workeralso distinguished.
3450*7c568831SAndroid Build Coastguard Worker<scrap lang="ebnf" id="CHARACTERS">
3451*7c568831SAndroid Build Coastguard Worker<head>Characters</head>
3452*7c568831SAndroid Build Coastguard Worker<prodgroup pcw3="3" pcw4="15">
3453*7c568831SAndroid Build Coastguard Worker<prod id="NT-Letter"><lhs>Letter</lhs>
3454*7c568831SAndroid Build Coastguard Worker<rhs><nt def="NT-BaseChar">BaseChar</nt>
3455*7c568831SAndroid Build Coastguard Worker| <nt def="NT-Ideographic">Ideographic</nt></rhs> </prod>
3456*7c568831SAndroid Build Coastguard Worker<prod id="NT-BaseChar"><lhs>BaseChar</lhs>
3457*7c568831SAndroid Build Coastguard Worker<rhs>[#x0041-#x005A]
3458*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0061-#x007A]
3459*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x00C0-#x00D6]
3460*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x00D8-#x00F6]
3461*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x00F8-#x00FF]
3462*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0100-#x0131]
3463*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0134-#x013E]
3464*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0141-#x0148]
3465*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x014A-#x017E]
3466*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0180-#x01C3]
3467*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x01CD-#x01F0]
3468*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x01F4-#x01F5]
3469*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x01FA-#x0217]
3470*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0250-#x02A8]
3471*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x02BB-#x02C1]
3472*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0386
3473*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0388-#x038A]
3474*7c568831SAndroid Build Coastguard Worker|&nbsp;#x038C
3475*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x038E-#x03A1]
3476*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x03A3-#x03CE]
3477*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x03D0-#x03D6]
3478*7c568831SAndroid Build Coastguard Worker|&nbsp;#x03DA
3479*7c568831SAndroid Build Coastguard Worker|&nbsp;#x03DC
3480*7c568831SAndroid Build Coastguard Worker|&nbsp;#x03DE
3481*7c568831SAndroid Build Coastguard Worker|&nbsp;#x03E0
3482*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x03E2-#x03F3]
3483*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0401-#x040C]
3484*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x040E-#x044F]
3485*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0451-#x045C]
3486*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x045E-#x0481]
3487*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0490-#x04C4]
3488*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x04C7-#x04C8]
3489*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x04CB-#x04CC]
3490*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x04D0-#x04EB]
3491*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x04EE-#x04F5]
3492*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x04F8-#x04F9]
3493*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0531-#x0556]
3494*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0559
3495*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0561-#x0586]
3496*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x05D0-#x05EA]
3497*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x05F0-#x05F2]
3498*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0621-#x063A]
3499*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0641-#x064A]
3500*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0671-#x06B7]
3501*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06BA-#x06BE]
3502*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06C0-#x06CE]
3503*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06D0-#x06D3]
3504*7c568831SAndroid Build Coastguard Worker|&nbsp;#x06D5
3505*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06E5-#x06E6]
3506*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0905-#x0939]
3507*7c568831SAndroid Build Coastguard Worker|&nbsp;#x093D
3508*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0958-#x0961]
3509*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0985-#x098C]
3510*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x098F-#x0990]
3511*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0993-#x09A8]
3512*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09AA-#x09B0]
3513*7c568831SAndroid Build Coastguard Worker|&nbsp;#x09B2
3514*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09B6-#x09B9]
3515*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09DC-#x09DD]
3516*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09DF-#x09E1]
3517*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09F0-#x09F1]
3518*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A05-#x0A0A]
3519*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A0F-#x0A10]
3520*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A13-#x0A28]
3521*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A2A-#x0A30]
3522*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A32-#x0A33]
3523*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A35-#x0A36]
3524*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A38-#x0A39]
3525*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A59-#x0A5C]
3526*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A5E
3527*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A72-#x0A74]
3528*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A85-#x0A8B]
3529*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A8D
3530*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A8F-#x0A91]
3531*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A93-#x0AA8]
3532*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0AAA-#x0AB0]
3533*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0AB2-#x0AB3]
3534*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0AB5-#x0AB9]
3535*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0ABD
3536*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0AE0
3537*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B05-#x0B0C]
3538*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B0F-#x0B10]
3539*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B13-#x0B28]
3540*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B2A-#x0B30]
3541*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B32-#x0B33]
3542*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B36-#x0B39]
3543*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0B3D
3544*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B5C-#x0B5D]
3545*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B5F-#x0B61]
3546*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B85-#x0B8A]
3547*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B8E-#x0B90]
3548*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B92-#x0B95]
3549*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B99-#x0B9A]
3550*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0B9C
3551*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B9E-#x0B9F]
3552*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BA3-#x0BA4]
3553*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BA8-#x0BAA]
3554*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BAE-#x0BB5]
3555*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BB7-#x0BB9]
3556*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C05-#x0C0C]
3557*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C0E-#x0C10]
3558*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C12-#x0C28]
3559*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C2A-#x0C33]
3560*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C35-#x0C39]
3561*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C60-#x0C61]
3562*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C85-#x0C8C]
3563*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C8E-#x0C90]
3564*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C92-#x0CA8]
3565*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CAA-#x0CB3]
3566*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CB5-#x0CB9]
3567*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0CDE
3568*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CE0-#x0CE1]
3569*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D05-#x0D0C]
3570*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D0E-#x0D10]
3571*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D12-#x0D28]
3572*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D2A-#x0D39]
3573*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D60-#x0D61]
3574*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E01-#x0E2E]
3575*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E30
3576*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E32-#x0E33]
3577*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E40-#x0E45]
3578*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E81-#x0E82]
3579*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E84
3580*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E87-#x0E88]
3581*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E8A
3582*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E8D
3583*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E94-#x0E97]
3584*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E99-#x0E9F]
3585*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EA1-#x0EA3]
3586*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EA5
3587*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EA7
3588*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EAA-#x0EAB]
3589*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EAD-#x0EAE]
3590*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EB0
3591*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EB2-#x0EB3]
3592*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EBD
3593*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EC0-#x0EC4]
3594*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F40-#x0F47]
3595*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F49-#x0F69]
3596*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x10A0-#x10C5]
3597*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x10D0-#x10F6]
3598*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1100
3599*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1102-#x1103]
3600*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1105-#x1107]
3601*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1109
3602*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x110B-#x110C]
3603*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x110E-#x1112]
3604*7c568831SAndroid Build Coastguard Worker|&nbsp;#x113C
3605*7c568831SAndroid Build Coastguard Worker|&nbsp;#x113E
3606*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1140
3607*7c568831SAndroid Build Coastguard Worker|&nbsp;#x114C
3608*7c568831SAndroid Build Coastguard Worker|&nbsp;#x114E
3609*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1150
3610*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1154-#x1155]
3611*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1159
3612*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x115F-#x1161]
3613*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1163
3614*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1165
3615*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1167
3616*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1169
3617*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x116D-#x116E]
3618*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1172-#x1173]
3619*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1175
3620*7c568831SAndroid Build Coastguard Worker|&nbsp;#x119E
3621*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11A8
3622*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11AB
3623*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x11AE-#x11AF]
3624*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x11B7-#x11B8]
3625*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11BA
3626*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x11BC-#x11C2]
3627*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11EB
3628*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11F0
3629*7c568831SAndroid Build Coastguard Worker|&nbsp;#x11F9
3630*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1E00-#x1E9B]
3631*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1EA0-#x1EF9]
3632*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F00-#x1F15]
3633*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F18-#x1F1D]
3634*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F20-#x1F45]
3635*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F48-#x1F4D]
3636*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F50-#x1F57]
3637*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1F59
3638*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1F5B
3639*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1F5D
3640*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F5F-#x1F7D]
3641*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1F80-#x1FB4]
3642*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FB6-#x1FBC]
3643*7c568831SAndroid Build Coastguard Worker|&nbsp;#x1FBE
3644*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FC2-#x1FC4]
3645*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FC6-#x1FCC]
3646*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FD0-#x1FD3]
3647*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FD6-#x1FDB]
3648*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FE0-#x1FEC]
3649*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FF2-#x1FF4]
3650*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x1FF6-#x1FFC]
3651*7c568831SAndroid Build Coastguard Worker|&nbsp;#x2126
3652*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x212A-#x212B]
3653*7c568831SAndroid Build Coastguard Worker|&nbsp;#x212E
3654*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x2180-#x2182]
3655*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x3041-#x3094]
3656*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x30A1-#x30FA]
3657*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x3105-#x312C]
3658*7c568831SAndroid Build Coastguard Worker|&nbsp;[#xAC00-#xD7A3]
3659*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3660*7c568831SAndroid Build Coastguard Worker<prod id="NT-Ideographic"><lhs>Ideographic</lhs>
3661*7c568831SAndroid Build Coastguard Worker<rhs>[#x4E00-#x9FA5]
3662*7c568831SAndroid Build Coastguard Worker|&nbsp;#x3007
3663*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x3021-#x3029]
3664*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3665*7c568831SAndroid Build Coastguard Worker<prod id="NT-CombiningChar"><lhs>CombiningChar</lhs>
3666*7c568831SAndroid Build Coastguard Worker<rhs>[#x0300-#x0345]
3667*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0360-#x0361]
3668*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0483-#x0486]
3669*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0591-#x05A1]
3670*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x05A3-#x05B9]
3671*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x05BB-#x05BD]
3672*7c568831SAndroid Build Coastguard Worker|&nbsp;#x05BF
3673*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x05C1-#x05C2]
3674*7c568831SAndroid Build Coastguard Worker|&nbsp;#x05C4
3675*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x064B-#x0652]
3676*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0670
3677*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06D6-#x06DC]
3678*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06DD-#x06DF]
3679*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06E0-#x06E4]
3680*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06E7-#x06E8]
3681*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06EA-#x06ED]
3682*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0901-#x0903]
3683*7c568831SAndroid Build Coastguard Worker|&nbsp;#x093C
3684*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x093E-#x094C]
3685*7c568831SAndroid Build Coastguard Worker|&nbsp;#x094D
3686*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0951-#x0954]
3687*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0962-#x0963]
3688*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0981-#x0983]
3689*7c568831SAndroid Build Coastguard Worker|&nbsp;#x09BC
3690*7c568831SAndroid Build Coastguard Worker|&nbsp;#x09BE
3691*7c568831SAndroid Build Coastguard Worker|&nbsp;#x09BF
3692*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09C0-#x09C4]
3693*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09C7-#x09C8]
3694*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09CB-#x09CD]
3695*7c568831SAndroid Build Coastguard Worker|&nbsp;#x09D7
3696*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09E2-#x09E3]
3697*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A02
3698*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A3C
3699*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A3E
3700*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0A3F
3701*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A40-#x0A42]
3702*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A47-#x0A48]
3703*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A4B-#x0A4D]
3704*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A70-#x0A71]
3705*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A81-#x0A83]
3706*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0ABC
3707*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0ABE-#x0AC5]
3708*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0AC7-#x0AC9]
3709*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0ACB-#x0ACD]
3710*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B01-#x0B03]
3711*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0B3C
3712*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B3E-#x0B43]
3713*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B47-#x0B48]
3714*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B4B-#x0B4D]
3715*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B56-#x0B57]
3716*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B82-#x0B83]
3717*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BBE-#x0BC2]
3718*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BC6-#x0BC8]
3719*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BCA-#x0BCD]
3720*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0BD7
3721*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C01-#x0C03]
3722*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C3E-#x0C44]
3723*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C46-#x0C48]
3724*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C4A-#x0C4D]
3725*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C55-#x0C56]
3726*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C82-#x0C83]
3727*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CBE-#x0CC4]
3728*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CC6-#x0CC8]
3729*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CCA-#x0CCD]
3730*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CD5-#x0CD6]
3731*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D02-#x0D03]
3732*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D3E-#x0D43]
3733*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D46-#x0D48]
3734*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D4A-#x0D4D]
3735*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0D57
3736*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E31
3737*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E34-#x0E3A]
3738*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E47-#x0E4E]
3739*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EB1
3740*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EB4-#x0EB9]
3741*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EBB-#x0EBC]
3742*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0EC8-#x0ECD]
3743*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F18-#x0F19]
3744*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F35
3745*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F37
3746*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F39
3747*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F3E
3748*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F3F
3749*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F71-#x0F84]
3750*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F86-#x0F8B]
3751*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F90-#x0F95]
3752*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0F97
3753*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F99-#x0FAD]
3754*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0FB1-#x0FB7]
3755*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0FB9
3756*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x20D0-#x20DC]
3757*7c568831SAndroid Build Coastguard Worker|&nbsp;#x20E1
3758*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x302A-#x302F]
3759*7c568831SAndroid Build Coastguard Worker|&nbsp;#x3099
3760*7c568831SAndroid Build Coastguard Worker|&nbsp;#x309A
3761*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3762*7c568831SAndroid Build Coastguard Worker<prod id="NT-Digit"><lhs>Digit</lhs>
3763*7c568831SAndroid Build Coastguard Worker<rhs>[#x0030-#x0039]
3764*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0660-#x0669]
3765*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x06F0-#x06F9]
3766*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0966-#x096F]
3767*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x09E6-#x09EF]
3768*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0A66-#x0A6F]
3769*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0AE6-#x0AEF]
3770*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0B66-#x0B6F]
3771*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0BE7-#x0BEF]
3772*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0C66-#x0C6F]
3773*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0CE6-#x0CEF]
3774*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0D66-#x0D6F]
3775*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0E50-#x0E59]
3776*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0ED0-#x0ED9]
3777*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x0F20-#x0F29]
3778*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3779*7c568831SAndroid Build Coastguard Worker<prod id="NT-Extender"><lhs>Extender</lhs>
3780*7c568831SAndroid Build Coastguard Worker<rhs>#x00B7
3781*7c568831SAndroid Build Coastguard Worker|&nbsp;#x02D0
3782*7c568831SAndroid Build Coastguard Worker|&nbsp;#x02D1
3783*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0387
3784*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0640
3785*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0E46
3786*7c568831SAndroid Build Coastguard Worker|&nbsp;#x0EC6
3787*7c568831SAndroid Build Coastguard Worker|&nbsp;#x3005
3788*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x3031-#x3035]
3789*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x309D-#x309E]
3790*7c568831SAndroid Build Coastguard Worker|&nbsp;[#x30FC-#x30FE]
3791*7c568831SAndroid Build Coastguard Worker</rhs></prod>
3792*7c568831SAndroid Build Coastguard Worker
3793*7c568831SAndroid Build Coastguard Worker</prodgroup>
3794*7c568831SAndroid Build Coastguard Worker</scrap>
3795*7c568831SAndroid Build Coastguard Worker</p>
3796*7c568831SAndroid Build Coastguard Worker<p>The character classes defined here can be derived from the
3797*7c568831SAndroid Build Coastguard WorkerUnicode character database as follows:
3798*7c568831SAndroid Build Coastguard Worker<ulist>
3799*7c568831SAndroid Build Coastguard Worker<item>
3800*7c568831SAndroid Build Coastguard Worker<p>Name start characters must have one of the categories Ll, Lu,
3801*7c568831SAndroid Build Coastguard WorkerLo, Lt, Nl.</p>
3802*7c568831SAndroid Build Coastguard Worker</item>
3803*7c568831SAndroid Build Coastguard Worker<item>
3804*7c568831SAndroid Build Coastguard Worker<p>Name characters other than Name-start characters
3805*7c568831SAndroid Build Coastguard Workermust have one of the categories Mc, Me, Mn, Lm, or Nd.</p>
3806*7c568831SAndroid Build Coastguard Worker</item>
3807*7c568831SAndroid Build Coastguard Worker<item>
3808*7c568831SAndroid Build Coastguard Worker<p>Characters in the compatibility area (i.e. with character code
3809*7c568831SAndroid Build Coastguard Workergreater than #xF900 and less than #xFFFE) are not allowed in XML
3810*7c568831SAndroid Build Coastguard Workernames.</p>
3811*7c568831SAndroid Build Coastguard Worker</item>
3812*7c568831SAndroid Build Coastguard Worker<item>
3813*7c568831SAndroid Build Coastguard Worker<p>Characters which have a font or compatibility decomposition (i.e. those
3814*7c568831SAndroid Build Coastguard Workerwith a "compatibility formatting tag" in field 5 of the database --
3815*7c568831SAndroid Build Coastguard Workermarked by field 5 beginning with a "&lt;") are not allowed.</p>
3816*7c568831SAndroid Build Coastguard Worker</item>
3817*7c568831SAndroid Build Coastguard Worker<item>
3818*7c568831SAndroid Build Coastguard Worker<p>The following characters are treated as name-start characters
3819*7c568831SAndroid Build Coastguard Workerrather than name characters, because the property file classifies
3820*7c568831SAndroid Build Coastguard Workerthem as Alphabetic:  [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.</p>
3821*7c568831SAndroid Build Coastguard Worker</item>
3822*7c568831SAndroid Build Coastguard Worker<item>
3823*7c568831SAndroid Build Coastguard Worker<p>Characters #x20DD-#x20E0 are excluded (in accordance with
3824*7c568831SAndroid Build Coastguard WorkerUnicode, section 5.14).</p>
3825*7c568831SAndroid Build Coastguard Worker</item>
3826*7c568831SAndroid Build Coastguard Worker<item>
3827*7c568831SAndroid Build Coastguard Worker<p>Character #x00B7 is classified as an extender, because the
3828*7c568831SAndroid Build Coastguard Workerproperty list so identifies it.</p>
3829*7c568831SAndroid Build Coastguard Worker</item>
3830*7c568831SAndroid Build Coastguard Worker<item>
3831*7c568831SAndroid Build Coastguard Worker<p>Character #x0387 is added as a name character, because #x00B7
3832*7c568831SAndroid Build Coastguard Workeris its canonical equivalent.</p>
3833*7c568831SAndroid Build Coastguard Worker</item>
3834*7c568831SAndroid Build Coastguard Worker<item>
3835*7c568831SAndroid Build Coastguard Worker<p>Characters ':' and '_' are allowed as name-start characters.</p>
3836*7c568831SAndroid Build Coastguard Worker</item>
3837*7c568831SAndroid Build Coastguard Worker<item>
3838*7c568831SAndroid Build Coastguard Worker<p>Characters '-' and '.' are allowed as name characters.</p>
3839*7c568831SAndroid Build Coastguard Worker</item>
3840*7c568831SAndroid Build Coastguard Worker</ulist>
3841*7c568831SAndroid Build Coastguard Worker</p>
3842*7c568831SAndroid Build Coastguard Worker</div1>
3843*7c568831SAndroid Build Coastguard Worker<inform-div1 id="sec-xml-and-sgml">
3844*7c568831SAndroid Build Coastguard Worker<head>XML and SGML</head>
3845*7c568831SAndroid Build Coastguard Worker
3846*7c568831SAndroid Build Coastguard Worker<p>XML is designed to be a subset of SGML, in that every
3847*7c568831SAndroid Build Coastguard Worker<termref def="dt-valid">valid</termref> XML document should also be a
3848*7c568831SAndroid Build Coastguard Workerconformant SGML document.
3849*7c568831SAndroid Build Coastguard WorkerFor a detailed comparison of the additional restrictions that XML places on
3850*7c568831SAndroid Build Coastguard Workerdocuments beyond those of SGML, see <bibref ref="Clark"/>.
3851*7c568831SAndroid Build Coastguard Worker</p>
3852*7c568831SAndroid Build Coastguard Worker</inform-div1>
3853*7c568831SAndroid Build Coastguard Worker<inform-div1 id="sec-entexpand">
3854*7c568831SAndroid Build Coastguard Worker<head>Expansion of Entity and Character References</head>
3855*7c568831SAndroid Build Coastguard Worker<p>This appendix contains some examples illustrating the
3856*7c568831SAndroid Build Coastguard Workersequence of entity- and character-reference recognition and
3857*7c568831SAndroid Build Coastguard Workerexpansion, as specified in <specref ref="entproc"/>.</p>
3858*7c568831SAndroid Build Coastguard Worker<p>
3859*7c568831SAndroid Build Coastguard WorkerIf the DTD contains the declaration
3860*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<!ENTITY example "<p>An ampersand (&#38;#38;) may be escaped
3861*7c568831SAndroid Build Coastguard Workernumerically (&#38;#38;#38;) or with a general entity
3862*7c568831SAndroid Build Coastguard Worker(&amp;amp;).</p>" >
3863*7c568831SAndroid Build Coastguard Worker]]></eg>
3864*7c568831SAndroid Build Coastguard Workerthen the XML processor will recognize the character references
3865*7c568831SAndroid Build Coastguard Workerwhen it parses the entity declaration, and resolve them before
3866*7c568831SAndroid Build Coastguard Workerstoring the following string as the
3867*7c568831SAndroid Build Coastguard Workervalue of the entity "<code>example</code>":
3868*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[<p>An ampersand (&#38;) may be escaped
3869*7c568831SAndroid Build Coastguard Workernumerically (&#38;#38;) or with a general entity
3870*7c568831SAndroid Build Coastguard Worker(&amp;amp;).</p>
3871*7c568831SAndroid Build Coastguard Worker]]></eg>
3872*7c568831SAndroid Build Coastguard WorkerA reference in the document to "<code>&amp;example;</code>"
3873*7c568831SAndroid Build Coastguard Workerwill cause the text to be reparsed, at which time the
3874*7c568831SAndroid Build Coastguard Workerstart- and end-tags of the "<code>p</code>" element will be recognized
3875*7c568831SAndroid Build Coastguard Workerand the three references will be recognized and expanded,
3876*7c568831SAndroid Build Coastguard Workerresulting in a "<code>p</code>" element with the following content
3877*7c568831SAndroid Build Coastguard Worker(all data, no delimiters or markup):
3878*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[An ampersand (&) may be escaped
3879*7c568831SAndroid Build Coastguard Workernumerically (&#38;) or with a general entity
3880*7c568831SAndroid Build Coastguard Worker(&amp;).
3881*7c568831SAndroid Build Coastguard Worker]]></eg>
3882*7c568831SAndroid Build Coastguard Worker</p>
3883*7c568831SAndroid Build Coastguard Worker<p>A more complex example will illustrate the rules and their
3884*7c568831SAndroid Build Coastguard Workereffects fully.  In the following example, the line numbers are
3885*7c568831SAndroid Build Coastguard Workersolely for reference.
3886*7c568831SAndroid Build Coastguard Worker<eg><![CDATA[1 <?xml version='1.0'?>
3887*7c568831SAndroid Build Coastguard Worker2 <!DOCTYPE test [
3888*7c568831SAndroid Build Coastguard Worker3 <!ELEMENT test (#PCDATA) >
3889*7c568831SAndroid Build Coastguard Worker4 <!ENTITY % xx '&#37;zz;'>
3890*7c568831SAndroid Build Coastguard Worker5 <!ENTITY % zz '&#60;!ENTITY tricky "error-prone" >' >
3891*7c568831SAndroid Build Coastguard Worker6 %xx;
3892*7c568831SAndroid Build Coastguard Worker7 ]>
3893*7c568831SAndroid Build Coastguard Worker8 <test>This sample shows a &tricky; method.</test>
3894*7c568831SAndroid Build Coastguard Worker]]></eg>
3895*7c568831SAndroid Build Coastguard WorkerThis produces the following:
3896*7c568831SAndroid Build Coastguard Worker<ulist spacing="compact">
3897*7c568831SAndroid Build Coastguard Worker<item><p>in line 4, the reference to character 37 is expanded immediately,
3898*7c568831SAndroid Build Coastguard Workerand the parameter entity "<code>xx</code>" is stored in the symbol
3899*7c568831SAndroid Build Coastguard Workertable with the value "<code>%zz;</code>".  Since the replacement text
3900*7c568831SAndroid Build Coastguard Workeris not rescanned, the reference to parameter entity "<code>zz</code>"
3901*7c568831SAndroid Build Coastguard Workeris not recognized.  (And it would be an error if it were, since
3902*7c568831SAndroid Build Coastguard Worker"<code>zz</code>" is not yet declared.)</p></item>
3903*7c568831SAndroid Build Coastguard Worker<item><p>in line 5, the character reference "<code>&amp;#60;</code>" is
3904*7c568831SAndroid Build Coastguard Workerexpanded immediately and the parameter entity "<code>zz</code>" is
3905*7c568831SAndroid Build Coastguard Workerstored with the replacement text
3906*7c568831SAndroid Build Coastguard Worker"<code>&lt;!ENTITY tricky "error-prone" &gt;</code>",
3907*7c568831SAndroid Build Coastguard Workerwhich is a well-formed entity declaration.</p></item>
3908*7c568831SAndroid Build Coastguard Worker<item><p>in line 6, the reference to "<code>xx</code>" is recognized,
3909*7c568831SAndroid Build Coastguard Workerand the replacement text of "<code>xx</code>" (namely
3910*7c568831SAndroid Build Coastguard Worker"<code>%zz;</code>") is parsed.  The reference to "<code>zz</code>"
3911*7c568831SAndroid Build Coastguard Workeris recognized in its turn, and its replacement text
3912*7c568831SAndroid Build Coastguard Worker("<code>&lt;!ENTITY tricky "error-prone" &gt;</code>") is parsed.
3913*7c568831SAndroid Build Coastguard WorkerThe general entity "<code>tricky</code>" has now been
3914*7c568831SAndroid Build Coastguard Workerdeclared, with the replacement text "<code>error-prone</code>".</p></item>
3915*7c568831SAndroid Build Coastguard Worker<item><p>
3916*7c568831SAndroid Build Coastguard Workerin line 8, the reference to the general entity "<code>tricky</code>" is
3917*7c568831SAndroid Build Coastguard Workerrecognized, and it is expanded, so the full content of the
3918*7c568831SAndroid Build Coastguard Worker"<code>test</code>" element is the self-describing (and ungrammatical) string
3919*7c568831SAndroid Build Coastguard Worker<emph>This sample shows a error-prone method.</emph>
3920*7c568831SAndroid Build Coastguard Worker</p></item>
3921*7c568831SAndroid Build Coastguard Worker</ulist>
3922*7c568831SAndroid Build Coastguard Worker</p>
3923*7c568831SAndroid Build Coastguard Worker</inform-div1>
3924*7c568831SAndroid Build Coastguard Worker<inform-div1 id="determinism">
3925*7c568831SAndroid Build Coastguard Worker<head>Deterministic Content Models</head>
3926*7c568831SAndroid Build Coastguard Worker<p><termref def="dt-compat">For compatibility</termref>, it is
3927*7c568831SAndroid Build Coastguard Workerrequired
3928*7c568831SAndroid Build Coastguard Workerthat content models in element type declarations be deterministic.
3929*7c568831SAndroid Build Coastguard Worker</p>
3930*7c568831SAndroid Build Coastguard Worker<!-- FINAL EDIT:  WebSGML allows ambiguity? -->
3931*7c568831SAndroid Build Coastguard Worker<p>SGML
3932*7c568831SAndroid Build Coastguard Workerrequires deterministic content models (it calls them
3933*7c568831SAndroid Build Coastguard Worker"unambiguous"); XML processors built using SGML systems may
3934*7c568831SAndroid Build Coastguard Workerflag non-deterministic content models as errors.</p>
3935*7c568831SAndroid Build Coastguard Worker<p>For example, the content model <code>((b, c) | (b, d))</code> is
3936*7c568831SAndroid Build Coastguard Workernon-deterministic, because given an initial <code>b</code> the parser
3937*7c568831SAndroid Build Coastguard Workercannot know which <code>b</code> in the model is being matched without
3938*7c568831SAndroid Build Coastguard Workerlooking ahead to see which element follows the <code>b</code>.
3939*7c568831SAndroid Build Coastguard WorkerIn this case, the two references to
3940*7c568831SAndroid Build Coastguard Worker<code>b</code> can be collapsed
3941*7c568831SAndroid Build Coastguard Workerinto a single reference, making the model read
3942*7c568831SAndroid Build Coastguard Worker<code>(b, (c | d))</code>.  An initial <code>b</code> now clearly
3943*7c568831SAndroid Build Coastguard Workermatches only a single name in the content model.  The parser doesn't
3944*7c568831SAndroid Build Coastguard Workerneed to look ahead to see what follows; either <code>c</code> or
3945*7c568831SAndroid Build Coastguard Worker<code>d</code> would be accepted.</p>
3946*7c568831SAndroid Build Coastguard Worker<p>More formally:  a finite state automaton may be constructed from the
3947*7c568831SAndroid Build Coastguard Workercontent model using the standard algorithms, e.g. algorithm 3.5
3948*7c568831SAndroid Build Coastguard Workerin section 3.9
3949*7c568831SAndroid Build Coastguard Workerof Aho, Sethi, and Ullman <bibref ref="Aho"/>.
3950*7c568831SAndroid Build Coastguard WorkerIn many such algorithms, a follow set is constructed for each
3951*7c568831SAndroid Build Coastguard Workerposition in the regular expression (i.e., each leaf
3952*7c568831SAndroid Build Coastguard Workernode in the
3953*7c568831SAndroid Build Coastguard Workersyntax tree for the regular expression);
3954*7c568831SAndroid Build Coastguard Workerif any position has a follow set in which
3955*7c568831SAndroid Build Coastguard Workermore than one following position is
3956*7c568831SAndroid Build Coastguard Workerlabeled with the same element type name,
3957*7c568831SAndroid Build Coastguard Workerthen the content model is in error
3958*7c568831SAndroid Build Coastguard Workerand may be reported as an error.
3959*7c568831SAndroid Build Coastguard Worker</p>
3960*7c568831SAndroid Build Coastguard Worker<p>Algorithms exist which allow many but not all non-deterministic
3961*7c568831SAndroid Build Coastguard Workercontent models to be reduced automatically to equivalent deterministic
3962*7c568831SAndroid Build Coastguard Workermodels; see Br�ggemann-Klein 1991 <bibref ref="ABK"/>.</p>
3963*7c568831SAndroid Build Coastguard Worker</inform-div1>
3964*7c568831SAndroid Build Coastguard Worker<inform-div1 id="sec-guessing">
3965*7c568831SAndroid Build Coastguard Worker<head>Autodetection of Character Encodings</head>
3966*7c568831SAndroid Build Coastguard Worker<p>The XML encoding declaration functions as an internal label on each
3967*7c568831SAndroid Build Coastguard Workerentity, indicating which character encoding is in use.  Before an XML
3968*7c568831SAndroid Build Coastguard Workerprocessor can read the internal label, however, it apparently has to
3969*7c568831SAndroid Build Coastguard Workerknow what character encoding is in use&mdash;which is what the internal label
3970*7c568831SAndroid Build Coastguard Workeris trying to indicate.  In the general case, this is a hopeless
3971*7c568831SAndroid Build Coastguard Workersituation. It is not entirely hopeless in XML, however, because XML
3972*7c568831SAndroid Build Coastguard Workerlimits the general case in two ways:  each implementation is assumed
3973*7c568831SAndroid Build Coastguard Workerto support only a  finite set of character encodings, and the XML
3974*7c568831SAndroid Build Coastguard Workerencoding declaration is restricted in position and content in order to
3975*7c568831SAndroid Build Coastguard Workermake it feasible to autodetect the character encoding in use in each
3976*7c568831SAndroid Build Coastguard Workerentity in normal cases.  Also, in many cases other sources of information
3977*7c568831SAndroid Build Coastguard Workerare available in addition to the XML data stream itself.
3978*7c568831SAndroid Build Coastguard WorkerTwo cases may be distinguished,
3979*7c568831SAndroid Build Coastguard Workerdepending on whether the XML entity is presented to the
3980*7c568831SAndroid Build Coastguard Workerprocessor without, or with, any accompanying
3981*7c568831SAndroid Build Coastguard Worker(external) information.  We consider the first case first.
3982*7c568831SAndroid Build Coastguard Worker</p>
3983*7c568831SAndroid Build Coastguard Worker<p>
3984*7c568831SAndroid Build Coastguard WorkerBecause each XML entity not in UTF-8 or UTF-16 format <emph>must</emph>
3985*7c568831SAndroid Build Coastguard Workerbegin with an XML encoding declaration, in which the first  characters
3986*7c568831SAndroid Build Coastguard Workermust be '<code>&lt;?xml</code>', any conforming processor can detect,
3987*7c568831SAndroid Build Coastguard Workerafter two to four octets of input, which of the following cases apply.
3988*7c568831SAndroid Build Coastguard WorkerIn reading this list, it may help to know that in UCS-4, '&lt;' is
3989*7c568831SAndroid Build Coastguard Worker"<code>#x0000003C</code>" and '?' is "<code>#x0000003F</code>", and the Byte
3990*7c568831SAndroid Build Coastguard WorkerOrder Mark required of UTF-16 data streams is "<code>#xFEFF</code>".</p>
3991*7c568831SAndroid Build Coastguard Worker<p>
3992*7c568831SAndroid Build Coastguard Worker<ulist>
3993*7c568831SAndroid Build Coastguard Worker<item>
3994*7c568831SAndroid Build Coastguard Worker<p><code>00 00 00 3C</code>: UCS-4, big-endian machine (1234 order)</p>
3995*7c568831SAndroid Build Coastguard Worker</item>
3996*7c568831SAndroid Build Coastguard Worker<item>
3997*7c568831SAndroid Build Coastguard Worker<p><code>3C 00 00 00</code>: UCS-4, little-endian machine (4321 order)</p>
3998*7c568831SAndroid Build Coastguard Worker</item>
3999*7c568831SAndroid Build Coastguard Worker<item>
4000*7c568831SAndroid Build Coastguard Worker<p><code>00 00 3C 00</code>: UCS-4, unusual octet order (2143)</p>
4001*7c568831SAndroid Build Coastguard Worker</item>
4002*7c568831SAndroid Build Coastguard Worker<item>
4003*7c568831SAndroid Build Coastguard Worker<p><code>00 3C 00 00</code>: UCS-4, unusual octet order (3412)</p>
4004*7c568831SAndroid Build Coastguard Worker</item>
4005*7c568831SAndroid Build Coastguard Worker<item>
4006*7c568831SAndroid Build Coastguard Worker<p><code>FE FF</code>: UTF-16, big-endian</p>
4007*7c568831SAndroid Build Coastguard Worker</item>
4008*7c568831SAndroid Build Coastguard Worker<item>
4009*7c568831SAndroid Build Coastguard Worker<p><code>FF FE</code>: UTF-16, little-endian</p>
4010*7c568831SAndroid Build Coastguard Worker</item>
4011*7c568831SAndroid Build Coastguard Worker<item>
4012*7c568831SAndroid Build Coastguard Worker<p><code>00 3C 00 3F</code>: UTF-16, big-endian, no Byte Order Mark
4013*7c568831SAndroid Build Coastguard Worker(and thus, strictly speaking, in error)</p>
4014*7c568831SAndroid Build Coastguard Worker</item>
4015*7c568831SAndroid Build Coastguard Worker<item>
4016*7c568831SAndroid Build Coastguard Worker<p><code>3C 00 3F 00</code>: UTF-16, little-endian, no Byte Order Mark
4017*7c568831SAndroid Build Coastguard Worker(and thus, strictly speaking, in error)</p>
4018*7c568831SAndroid Build Coastguard Worker</item>
4019*7c568831SAndroid Build Coastguard Worker<item>
4020*7c568831SAndroid Build Coastguard Worker<p><code>3C 3F 78 6D</code>: UTF-8, ISO 646, ASCII, some part of ISO 8859,
4021*7c568831SAndroid Build Coastguard WorkerShift-JIS, EUC, or any other 7-bit, 8-bit, or mixed-width encoding
4022*7c568831SAndroid Build Coastguard Workerwhich ensures that the characters of ASCII have their normal positions,
4023*7c568831SAndroid Build Coastguard Workerwidth,
4024*7c568831SAndroid Build Coastguard Workerand values; the actual encoding declaration must be read to
4025*7c568831SAndroid Build Coastguard Workerdetect which of these applies, but since all of these encodings
4026*7c568831SAndroid Build Coastguard Workeruse the same bit patterns for the ASCII characters, the encoding
4027*7c568831SAndroid Build Coastguard Workerdeclaration itself may be read reliably
4028*7c568831SAndroid Build Coastguard Worker</p>
4029*7c568831SAndroid Build Coastguard Worker</item>
4030*7c568831SAndroid Build Coastguard Worker<item>
4031*7c568831SAndroid Build Coastguard Worker<p><code>4C 6F A7 94</code>: EBCDIC (in some flavor; the full
4032*7c568831SAndroid Build Coastguard Workerencoding declaration must be read to tell which code page is in
4033*7c568831SAndroid Build Coastguard Workeruse)</p>
4034*7c568831SAndroid Build Coastguard Worker</item>
4035*7c568831SAndroid Build Coastguard Worker<item>
4036*7c568831SAndroid Build Coastguard Worker<p>other: UTF-8 without an encoding declaration, or else
4037*7c568831SAndroid Build Coastguard Workerthe data stream is corrupt, fragmentary, or enclosed in
4038*7c568831SAndroid Build Coastguard Workera wrapper of some kind</p>
4039*7c568831SAndroid Build Coastguard Worker</item>
4040*7c568831SAndroid Build Coastguard Worker</ulist>
4041*7c568831SAndroid Build Coastguard Worker</p>
4042*7c568831SAndroid Build Coastguard Worker<p>
4043*7c568831SAndroid Build Coastguard WorkerThis level of autodetection is enough to read the XML encoding
4044*7c568831SAndroid Build Coastguard Workerdeclaration and parse the character-encoding identifier, which is
4045*7c568831SAndroid Build Coastguard Workerstill necessary to distinguish the individual members of each family
4046*7c568831SAndroid Build Coastguard Workerof encodings (e.g. to tell  UTF-8 from 8859, and the parts of 8859
4047*7c568831SAndroid Build Coastguard Workerfrom each other, or to distinguish the specific EBCDIC code page in
4048*7c568831SAndroid Build Coastguard Workeruse, and so on).
4049*7c568831SAndroid Build Coastguard Worker</p>
4050*7c568831SAndroid Build Coastguard Worker<p>
4051*7c568831SAndroid Build Coastguard WorkerBecause the contents of the encoding declaration are restricted to
4052*7c568831SAndroid Build Coastguard WorkerASCII characters, a processor can reliably read the entire encoding
4053*7c568831SAndroid Build Coastguard Workerdeclaration as soon as it has detected which family of encodings is in
4054*7c568831SAndroid Build Coastguard Workeruse.  Since in practice, all widely used character encodings fall into
4055*7c568831SAndroid Build Coastguard Workerone of the categories above, the XML encoding declaration allows
4056*7c568831SAndroid Build Coastguard Workerreasonably reliable in-band labeling of character encodings, even when
4057*7c568831SAndroid Build Coastguard Workerexternal sources of information at the operating-system or
4058*7c568831SAndroid Build Coastguard Workertransport-protocol level are unreliable.
4059*7c568831SAndroid Build Coastguard Worker</p>
4060*7c568831SAndroid Build Coastguard Worker<p>
4061*7c568831SAndroid Build Coastguard WorkerOnce the processor has detected the character encoding in use, it can
4062*7c568831SAndroid Build Coastguard Workeract appropriately, whether by invoking a separate input routine for
4063*7c568831SAndroid Build Coastguard Workereach case, or by calling the proper conversion function on each
4064*7c568831SAndroid Build Coastguard Workercharacter of input.
4065*7c568831SAndroid Build Coastguard Worker</p>
4066*7c568831SAndroid Build Coastguard Worker<p>
4067*7c568831SAndroid Build Coastguard WorkerLike any self-labeling system, the XML encoding declaration will not
4068*7c568831SAndroid Build Coastguard Workerwork if any software changes the entity's character set or encoding
4069*7c568831SAndroid Build Coastguard Workerwithout updating the encoding declaration.  Implementors of
4070*7c568831SAndroid Build Coastguard Workercharacter-encoding routines should be careful to ensure the accuracy
4071*7c568831SAndroid Build Coastguard Workerof the internal and external information used to label the entity.
4072*7c568831SAndroid Build Coastguard Worker</p>
4073*7c568831SAndroid Build Coastguard Worker<p>The second possible case occurs when the XML entity is accompanied
4074*7c568831SAndroid Build Coastguard Workerby encoding information, as in some file systems and some network
4075*7c568831SAndroid Build Coastguard Workerprotocols.
4076*7c568831SAndroid Build Coastguard WorkerWhen multiple sources of information are available,
4077*7c568831SAndroid Build Coastguard Worker
4078*7c568831SAndroid Build Coastguard Workertheir relative
4079*7c568831SAndroid Build Coastguard Workerpriority and the preferred method of handling conflict should be
4080*7c568831SAndroid Build Coastguard Workerspecified as part of the higher-level protocol used to deliver XML.
4081*7c568831SAndroid Build Coastguard WorkerRules for the relative priority of the internal label and the
4082*7c568831SAndroid Build Coastguard WorkerMIME-type label in an external header, for example, should be part of the
4083*7c568831SAndroid Build Coastguard WorkerRFC document defining the text/xml and application/xml MIME types. In
4084*7c568831SAndroid Build Coastguard Workerthe interests of interoperability, however, the following rules
4085*7c568831SAndroid Build Coastguard Workerare recommended.
4086*7c568831SAndroid Build Coastguard Worker<ulist>
4087*7c568831SAndroid Build Coastguard Worker<item><p>If an XML entity is in a file, the Byte-Order Mark
4088*7c568831SAndroid Build Coastguard Workerand encoding-declaration PI are used (if present) to determine the
4089*7c568831SAndroid Build Coastguard Workercharacter encoding.  All other heuristics and sources of information
4090*7c568831SAndroid Build Coastguard Workerare solely for error recovery.
4091*7c568831SAndroid Build Coastguard Worker</p></item>
4092*7c568831SAndroid Build Coastguard Worker<item><p>If an XML entity is delivered with a
4093*7c568831SAndroid Build Coastguard WorkerMIME type of text/xml, then the <code>charset</code> parameter
4094*7c568831SAndroid Build Coastguard Workeron the MIME type determines the
4095*7c568831SAndroid Build Coastguard Workercharacter encoding method; all other heuristics and sources of
4096*7c568831SAndroid Build Coastguard Workerinformation are solely for error recovery.
4097*7c568831SAndroid Build Coastguard Worker</p></item>
4098*7c568831SAndroid Build Coastguard Worker<item><p>If an XML entity is delivered
4099*7c568831SAndroid Build Coastguard Workerwith a
4100*7c568831SAndroid Build Coastguard WorkerMIME type of application/xml, then the Byte-Order Mark and
4101*7c568831SAndroid Build Coastguard Workerencoding-declaration PI are used (if present) to determine the
4102*7c568831SAndroid Build Coastguard Workercharacter encoding.  All other heuristics and sources of
4103*7c568831SAndroid Build Coastguard Workerinformation are solely for error recovery.
4104*7c568831SAndroid Build Coastguard Worker</p></item>
4105*7c568831SAndroid Build Coastguard Worker</ulist>
4106*7c568831SAndroid Build Coastguard WorkerThese rules apply only in the absence of protocol-level documentation;
4107*7c568831SAndroid Build Coastguard Workerin particular, when the MIME types text/xml and application/xml are
4108*7c568831SAndroid Build Coastguard Workerdefined, the recommendations of the relevant RFC will supersede
4109*7c568831SAndroid Build Coastguard Workerthese rules.
4110*7c568831SAndroid Build Coastguard Worker</p>
4111*7c568831SAndroid Build Coastguard Worker
4112*7c568831SAndroid Build Coastguard Worker</inform-div1>
4113*7c568831SAndroid Build Coastguard Worker
4114*7c568831SAndroid Build Coastguard Worker<inform-div1 id="sec-xml-wg">
4115*7c568831SAndroid Build Coastguard Worker<head>W3C XML Working Group</head>
4116*7c568831SAndroid Build Coastguard Worker
4117*7c568831SAndroid Build Coastguard Worker<p>This specification was prepared and approved for publication by the
4118*7c568831SAndroid Build Coastguard WorkerW3C XML Working Group (WG).  WG approval of this specification does
4119*7c568831SAndroid Build Coastguard Workernot necessarily imply that all WG members voted for its approval.
4120*7c568831SAndroid Build Coastguard WorkerThe current and former members of the XML WG are:</p>
4121*7c568831SAndroid Build Coastguard Worker
4122*7c568831SAndroid Build Coastguard Worker<orglist>
4123*7c568831SAndroid Build Coastguard Worker<member><name>Jon Bosak, Sun</name><role>Chair</role></member>
4124*7c568831SAndroid Build Coastguard Worker<member><name>James Clark</name><role>Technical Lead</role></member>
4125*7c568831SAndroid Build Coastguard Worker<member><name>Tim Bray, Textuality and Netscape</name><role>XML Co-editor</role></member>
4126*7c568831SAndroid Build Coastguard Worker<member><name>Jean Paoli, Microsoft</name><role>XML Co-editor</role></member>
4127*7c568831SAndroid Build Coastguard Worker<member><name>C. M. Sperberg-McQueen, U. of Ill.</name><role>XML
4128*7c568831SAndroid Build Coastguard WorkerCo-editor</role></member>
4129*7c568831SAndroid Build Coastguard Worker<member><name>Dan Connolly, W3C</name><role>W3C Liaison</role></member>
4130*7c568831SAndroid Build Coastguard Worker<member><name>Paula Angerstein, Texcel</name></member>
4131*7c568831SAndroid Build Coastguard Worker<member><name>Steve DeRose, INSO</name></member>
4132*7c568831SAndroid Build Coastguard Worker<member><name>Dave Hollander, HP</name></member>
4133*7c568831SAndroid Build Coastguard Worker<member><name>Eliot Kimber, ISOGEN</name></member>
4134*7c568831SAndroid Build Coastguard Worker<member><name>Eve Maler, ArborText</name></member>
4135*7c568831SAndroid Build Coastguard Worker<member><name>Tom Magliery, NCSA</name></member>
4136*7c568831SAndroid Build Coastguard Worker<member><name>Murray Maloney, Muzmo and Grif</name></member>
4137*7c568831SAndroid Build Coastguard Worker<member><name>Makoto Murata, Fuji Xerox Information Systems</name></member>
4138*7c568831SAndroid Build Coastguard Worker<member><name>Joel Nava, Adobe</name></member>
4139*7c568831SAndroid Build Coastguard Worker<member><name>Conleth O'Connell, Vignette</name></member>
4140*7c568831SAndroid Build Coastguard Worker<member><name>Peter Sharpe, SoftQuad</name></member>
4141*7c568831SAndroid Build Coastguard Worker<member><name>John Tigue, DataChannel</name></member>
4142*7c568831SAndroid Build Coastguard Worker</orglist>
4143*7c568831SAndroid Build Coastguard Worker
4144*7c568831SAndroid Build Coastguard Worker</inform-div1>
4145*7c568831SAndroid Build Coastguard Worker</back>
4146*7c568831SAndroid Build Coastguard Worker</spec>
4147*7c568831SAndroid Build Coastguard Worker<!-- Keep this comment at the end of the file
4148*7c568831SAndroid Build Coastguard WorkerLocal variables:
4149*7c568831SAndroid Build Coastguard Workermode: sgml
4150*7c568831SAndroid Build Coastguard Workersgml-default-dtd-file:"~/sgml/spec.ced"
4151*7c568831SAndroid Build Coastguard Workersgml-omittag:t
4152*7c568831SAndroid Build Coastguard Workersgml-shorttag:t
4153*7c568831SAndroid Build Coastguard WorkerEnd:
4154*7c568831SAndroid Build Coastguard Worker-->
4155