Debian Codegraph @

test/grammar/xml.html

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="EN">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6 <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
7 <style type="text/css">
8 code {
9 font-family: monospace;
10 }
11
12 div.constraint,
13 div.issue,
14 div.note,
15 div.notice {
16 margin-left: 2em;
17 }
18
19 ol.enumar {
20 list-style-type: decimal;
21 }
22 ol.enumla {
23 list-style-type: lower-alpha;
24 }
25 ol.enumlr {
26 list-style-type: lower-roman;
27 }
28 ol.enumua {
29 list-style-type: upper-alpha;
30 }
31 ol.enumur {
32 list-style-type: upper-roman;
33 }
34
35 div.exampleInner pre {
36 margin-left: 1em;
37 margin-top: 0em;
38 margin-bottom: 0em;
39 }
40 div.exampleOuter {
41 border: 4px double gray;
42 margin: 0em;
43 padding: 0em;
44 }
45 div.exampleInner {
46 background-color: #d5dee3;
47 border-top-width: 4px;
48 border-top-style: double;
49 border-top-color: #d3d3d3;
50 border-bottom-width: 4px;
51 border-bottom-style: double;
52 border-bottom-color: #d3d3d3;
53 padding: 4px;
54 margin: 0em;
55 }
56 div.exampleWrapper {
57 margin: 4px;
58 }
59 div.exampleHeader {
60 font-weight: bold;
61 margin: 4px;
62 }
63
64 em.rfc2119 {
65 text-transform: lowercase;
66 font-variant: small-caps;
67 font-style: normal;
68 }
69 </style>
70 <link
71 rel="stylesheet"
72 type="text/css"
73 href="http://www.w3.org/StyleSheets/TR/W3C-REC.css"
74 />
75 </head>
76 <body>
77 <div class="head">
78 <p>
79 <a href="http://www.w3.org/"
80 ><img
81 src="http://www.w3.org/Icons/w3c_home"
82 alt="W3C"
83 height="48"
84 width="72"
85 /></a>
86 </p>
87 <h1>
88 <a name="title" id="title" />Extensible Markup Language (XML) 1.0 (Fifth
89 Edition)
90 </h1>
91 <h2>
92 <a name="w3c-doctype" id="w3c-doctype" />W3C Recommendation 26 November
93 2008
94 </h2>
95 <div
96 id="notice-20130207"
97 style="border: solid black 1px; padding: 0.5em; background: #ffb"
98 >
99 <p>
100 <strong>Note:</strong> On 7 February 2013, this specification was
101 modified in place to replace broken links to RFC4646 and RFC4647.
102 </p>
103 </div>
104 <dl>
105 <dt>This version:</dt>
106 <dd>
107 <a href="http://www.w3.org/TR/2008/REC-xml-20081126/"
108 >http://www.w3.org/TR/2008/REC-xml-20081126/</a
109 >
110 </dd>
111 <dt>Latest version:</dt>
112 <dd>
113 <a href="http://www.w3.org/TR/xml/">http://www.w3.org/TR/xml/</a>
114 </dd>
115 <dt>Previous versions:</dt>
116 <dd>
117 <a href="http://www.w3.org/TR/2008/PER-xml-20080205/"
118 >http://www.w3.org/TR/2008/PER-xml-20080205/</a
119 >
120 <br />
121 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/"
122 >http://www.w3.org/TR/2006/REC-xml-20060816/</a
123 >
124 </dd>
125 <dt>Editors:</dt>
126 <dd>
127 Tim Bray, Textuality and Netscape
128 <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>
129 </dd>
130 <dd>
131 Jean Paoli, Microsoft
132 <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>
133 </dd>
134 <dd>
135 C. M. Sperberg-McQueen, W3C
136 <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>
137 </dd>
138 <dd>
139 Eve Maler, Sun Microsystems, Inc.
140 <a href="mailto:[email protected]">&lt;[email protected]&gt;</a>
141 </dd>
142 <dd>François Yergeau</dd>
143 </dl>
144 <p>
145 Please refer to the
146 <a href="http://www.w3.org/XML/xml-V10-5e-errata"
147 ><strong>errata</strong></a
148 >
149 for this document, which may include some normative corrections.
150 </p>
151 <p>
152 The
153 <a href="http://www.w3.org/XML/xml-V10-4e-errata">previous errata</a>
154 for this document, are also available.
155 </p>
156 <p>
157 See also
158 <a
159 href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xml"
160 ><strong>translations</strong></a
161 >.
162 </p>
163 <p>
164 This document is also available in these non-normative formats:
165 <a href="REC-xml-20081126.xml">XML</a> and&nbsp;<a
166 href="REC-xml-20081126-review.html"
167 >XHTML with color-coded revision indicators</a
168 >.
169 </p>
170 <p class="copyright">
171 <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright"
172 >Copyright</a
173 >&nbsp;©&nbsp;2008&nbsp;<a href="http://www.w3.org/"
174 ><acronym title="World Wide Web Consortium">W3C</acronym></a
175 ><sup>®</sup> (<a href="http://www.csail.mit.edu/"
176 ><acronym title="Massachusetts Institute of Technology"
177 >MIT</acronym
178 ></a
179 >,
180 <a href="http://www.ercim.org/"
181 ><acronym
182 title="European Research Consortium for Informatics and Mathematics"
183 >ERCIM</acronym
184 ></a
185 >, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C
186 <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer"
187 >liability</a
188 >,
189 <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks"
190 >trademark</a
191 >
192 and
193 <a href="http://www.w3.org/Consortium/Legal/copyright-documents"
194 >document use</a
195 >
196 rules apply.
197 </p>
198 </div>
199 <hr />
200 <div>
201 <h2><a name="abstract" id="abstract" />Abstract</h2>
202 <p>
203 The Extensible Markup Language (XML) is a subset of SGML that is
204 completely described in this document. Its goal is to enable generic
205 SGML to be served, received, and processed on the Web in the way that is
206 now possible with HTML. XML has been designed for ease of implementation
207 and for interoperability with both SGML and HTML.
208 </p>
209 </div>
210 <div>
211 <h2><a name="status" id="status" />Status of this Document</h2>
212 <p>
213 <em
214 >This section describes the status of this document at the time of its
215 publication. Other documents may supersede this document. A list of
216 current W3C publications and the latest revision of this technical
217 report can be found in the
218 <a href="http://www.w3.org/TR/">W3C technical reports index</a> at
219 http://www.w3.org/TR/.</em
220 >
221 </p>
222 <p>
223 This document specifies a syntax created by subsetting an existing,
224 widely used international text processing standard (Standard Generalized
225 Markup Language, ISO 8879:1986(E) as amended and corrected) for use on
226 the World Wide Web. It is a product of the
227 <a href="http://www.w3.org/XML/Core/">XML Core Working Group</a> as part
228 of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>. The
229 English version of this specification is the only normative version.
230 However, for translations of this document, see
231 <a
232 href="http://www.w3.org/2003/03/Translations/byTechnology?technology=xml"
233 >http://www.w3.org/2003/03/Translations/byTechnology?technology=xml</a
234 >.
235 </p>
236 <p>
237 This document is a
238 <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#q74"
239 >W3C Recommendation</a
240 >. This fifth edition is <em>not</em> a new version of XML. As a
241 convenience to readers, it incorporates the changes dictated by the
242 accumulated errata (available at
243 <a href="http://www.w3.org/XML/xml-V10-4e-errata"
244 >http://www.w3.org/XML/xml-V10-4e-errata</a
245 >) to the
246 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/"
247 >Fourth Edition of XML 1.0, dated 16 August 2006</a
248 >. In particular, erratum
249 <a href="http://www.w3.org/XML/xml-V10-4e-errata#E09">[E09]</a> relaxes
250 the restrictions on element and attribute names, thereby providing in
251 XML 1.0 the major end user benefit currently achievable only by using
252 XML 1.1. As a consequence, many possible documents which were not
253 well-formed according to previous editions of this specification are now
254 well-formed, and previously invalid documents using the newly-allowed
255 name characters in, for example, ID attributes, are now valid.
256 </p>
257 <p>
258 This edition supersedes the previous
259 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/"
260 >W3C Recommendation of 16 August 2006</a
261 >.
262 </p>
263 <p>
264 Please report errors in this document to the public
265 <a href="mailto:[email protected]">[email protected]</a> mail list;
266 public
267 <a href="http://lists.w3.org/Archives/Public/xml-editor/">archives</a>
268 are available. For the convenience of readers, an
269 <a href="REC-xml-20081126-review.html"
270 >XHTML version with color-coded revision indicators</a
271 >
272 is also provided; this version highlights each change due to an erratum
273 published in the
274 <a href="http://www.w3.org/XML/xml-V10-4e-errata">errata list</a> for
275 the previous edition, together with a link to the particular erratum in
276 that list. Most of the errata in the list provide a rationale for the
277 change. The errata list for this fifth edition is available at
278 <a href="http://www.w3.org/XML/xml-V10-5e-errata"
279 >http://www.w3.org/XML/xml-V10-5e-errata</a
280 >.
281 </p>
282 <p>
283 An implementation report is available at
284 <a href="http://www.w3.org/XML/2008/01/xml10-5e-implementation.html"
285 >http://www.w3.org/XML/2008/01/xml10-5e-implementation.html</a
286 >. A <a href="http://www.w3.org/XML/Test/">Test Suite</a> is maintained
287 to help assessing conformance to this specification.
288 </p>
289 <p>
290 This document has been reviewed by W3C Members, by software developers,
291 and by other W3C groups and interested parties, and is endorsed by the
292 Director as a W3C Recommendation. It is a stable document and may be
293 used as reference material or cited from another document. W3C's role in
294 making the Recommendation is to draw attention to the specification and
295 to promote its widespread deployment. This enhances the functionality
296 and interoperability of the Web.
297 </p>
298 <p>
299 W3C maintains a
300 <a
301 href="http://www.w3.org/2002/08/xmlcore-IPR-statements"
302 rel="disclosure"
303 >public list of any patent disclosures</a
304 >
305 made in connection with the deliverables of the group; that page also
306 includes instructions for disclosing a patent. An individual who has
307 actual knowledge of a patent which the individual believes contains
308 <a
309 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential"
310 >Essential Claim(s)</a
311 >
312 must disclose the information in accordance with
313 <a
314 href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure"
315 >section 6 of the W3C Patent Policy</a
316 >.
317 </p>
318 </div>
319 <div class="toc">
320 <h2><a name="contents" id="contents" />Table of Contents</h2>
321 <p class="toc">
322 1 <a href="#sec-intro">Introduction</a><br />
323 &nbsp;&nbsp;&nbsp;&nbsp;1.1
324 <a href="#sec-origin-goals">Origin and Goals</a><br />
325 &nbsp;&nbsp;&nbsp;&nbsp;1.2 <a href="#sec-terminology">Terminology</a
326 ><br />
327 2 <a href="#sec-documents">Documents</a><br />
328 &nbsp;&nbsp;&nbsp;&nbsp;2.1
329 <a href="#sec-well-formed">Well-Formed XML Documents</a><br />
330 &nbsp;&nbsp;&nbsp;&nbsp;2.2 <a href="#charsets">Characters</a><br />
331 &nbsp;&nbsp;&nbsp;&nbsp;2.3
332 <a href="#sec-common-syn">Common Syntactic Constructs</a><br />
333 &nbsp;&nbsp;&nbsp;&nbsp;2.4
334 <a href="#syntax">Character Data and Markup</a><br />
335 &nbsp;&nbsp;&nbsp;&nbsp;2.5 <a href="#sec-comments">Comments</a><br />
336 &nbsp;&nbsp;&nbsp;&nbsp;2.6 <a href="#sec-pi">Processing Instructions</a
337 ><br />
338 &nbsp;&nbsp;&nbsp;&nbsp;2.7 <a href="#sec-cdata-sect">CDATA Sections</a
339 ><br />
340 &nbsp;&nbsp;&nbsp;&nbsp;2.8
341 <a href="#sec-prolog-dtd">Prolog and Document Type Declaration</a><br />
342 &nbsp;&nbsp;&nbsp;&nbsp;2.9
343 <a href="#sec-rmd">Standalone Document Declaration</a><br />
344 &nbsp;&nbsp;&nbsp;&nbsp;2.10
345 <a href="#sec-white-space">White Space Handling</a><br />
346 &nbsp;&nbsp;&nbsp;&nbsp;2.11
347 <a href="#sec-line-ends">End-of-Line Handling</a><br />
348 &nbsp;&nbsp;&nbsp;&nbsp;2.12
349 <a href="#sec-lang-tag">Language Identification</a><br />
350 3 <a href="#sec-logical-struct">Logical Structures</a><br />
351 &nbsp;&nbsp;&nbsp;&nbsp;3.1
352 <a href="#sec-starttags">Start-Tags, End-Tags, and Empty-Element Tags</a
353 ><br />
354 &nbsp;&nbsp;&nbsp;&nbsp;3.2
355 <a href="#elemdecls">Element Type Declarations</a><br />
356 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2.1
357 <a href="#sec-element-content">Element Content</a><br />
358 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.2.2
359 <a href="#sec-mixed-content">Mixed Content</a><br />
360 &nbsp;&nbsp;&nbsp;&nbsp;3.3
361 <a href="#attdecls">Attribute-List Declarations</a><br />
362 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.3.1
363 <a href="#sec-attribute-types">Attribute Types</a><br />
364 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.3.2
365 <a href="#sec-attr-defaults">Attribute Defaults</a><br />
366 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3.3.3
367 <a href="#AVNormalize">Attribute-Value Normalization</a><br />
368 &nbsp;&nbsp;&nbsp;&nbsp;3.4
369 <a href="#sec-condition-sect">Conditional Sections</a><br />
370 4 <a href="#sec-physical-struct">Physical Structures</a><br />
371 &nbsp;&nbsp;&nbsp;&nbsp;4.1
372 <a href="#sec-references">Character and Entity References</a><br />
373 &nbsp;&nbsp;&nbsp;&nbsp;4.2
374 <a href="#sec-entity-decl">Entity Declarations</a><br />
375 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.2.1
376 <a href="#sec-internal-ent">Internal Entities</a><br />
377 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.2.2
378 <a href="#sec-external-ent">External Entities</a><br />
379 &nbsp;&nbsp;&nbsp;&nbsp;4.3 <a href="#TextEntities">Parsed Entities</a
380 ><br />
381 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.1
382 <a href="#sec-TextDecl">The Text Declaration</a><br />
383 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.2
384 <a href="#wf-entities">Well-Formed Parsed Entities</a><br />
385 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.3.3
386 <a href="#charencoding">Character Encoding in Entities</a><br />
387 &nbsp;&nbsp;&nbsp;&nbsp;4.4
388 <a href="#entproc">XML Processor Treatment of Entities and References</a
389 ><br />
390 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.1
391 <a href="#not-recognized">Not Recognized</a><br />
392 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.2
393 <a href="#included">Included</a><br />
394 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.3
395 <a href="#include-if-valid">Included If Validating</a><br />
396 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.4
397 <a href="#forbidden">Forbidden</a><br />
398 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.5
399 <a href="#inliteral">Included in Literal</a><br />
400 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.6
401 <a href="#notify">Notify</a><br />
402 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.7
403 <a href="#bypass">Bypassed</a><br />
404 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.8
405 <a href="#as-PE">Included as PE</a><br />
406 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.4.9
407 <a href="#error">Error</a><br />
408 &nbsp;&nbsp;&nbsp;&nbsp;4.5
409 <a href="#intern-replacement">Construction of Entity Replacement Text</a
410 ><br />
411 &nbsp;&nbsp;&nbsp;&nbsp;4.6
412 <a href="#sec-predefined-ent">Predefined Entities</a><br />
413 &nbsp;&nbsp;&nbsp;&nbsp;4.7
414 <a href="#Notations">Notation Declarations</a><br />
415 &nbsp;&nbsp;&nbsp;&nbsp;4.8 <a href="#sec-doc-entity">Document Entity</a
416 ><br />
417 5 <a href="#sec-conformance">Conformance</a><br />
418 &nbsp;&nbsp;&nbsp;&nbsp;5.1
419 <a href="#proc-types">Validating and Non-Validating Processors</a><br />
420 &nbsp;&nbsp;&nbsp;&nbsp;5.2
421 <a href="#safe-behavior">Using XML Processors</a><br />
422 6 <a href="#sec-notation">Notation</a><br />
423 </p>
424 <h3><a name="appendices" id="appendices" />Appendices</h3>
425 <p class="toc">
426 A <a href="#sec-bibliography">References</a><br />
427 &nbsp;&nbsp;&nbsp;&nbsp;A.1
428 <a href="#sec-existing-stds">Normative References</a><br />
429 &nbsp;&nbsp;&nbsp;&nbsp;A.2 <a href="#null">Other References</a><br />
430 B <a href="#CharClasses">Character Classes</a><br />
431 C <a href="#sec-xml-and-sgml">XML and SGML</a> (Non-Normative)<br />
432 D
433 <a href="#sec-entexpand"
434 >Expansion of Entity and Character References</a
435 >
436 (Non-Normative)<br />
437 E
438 <a href="#determinism">Deterministic Content Models</a>
439 (Non-Normative)<br />
440 F
441 <a href="#sec-guessing">Autodetection of Character Encodings</a>
442 (Non-Normative)<br />
443 &nbsp;&nbsp;&nbsp;&nbsp;F.1
444 <a href="#sec-guessing-no-ext-info"
445 >Detection Without External Encoding Information</a
446 ><br />
447 &nbsp;&nbsp;&nbsp;&nbsp;F.2
448 <a href="#sec-guessing-with-ext-info"
449 >Priorities in the Presence of External Encoding Information</a
450 ><br />
451 G <a href="#sec-xml-wg">W3C XML Working Group</a> (Non-Normative)<br />
452 H
453 <a href="#sec-core-wg">W3C XML Core Working Group</a>
454 (Non-Normative)<br />
455 I <a href="#prod-notes">Production Notes</a> (Non-Normative)<br />
456 J
457 <a href="#sec-suggested-names">Suggestions for XML Names</a>
458 (Non-Normative)<br />
459 </p>
460 </div>
461 <hr />
462 <div class="body">
463 <div class="div1">
464 <h2><a name="sec-intro" id="sec-intro" />1 Introduction</h2>
465 <p>
466 Extensible Markup Language, abbreviated XML, describes a class of data
467 objects called
468 <a title="XML Document" href="#dt-xml-doc">XML documents</a> and
469 partially describes the behavior of computer programs which process
470 them. XML is an application profile or restricted form of SGML, the
471 Standard Generalized Markup Language
472 <a href="#ISO8879">[ISO 8879]</a>. By construction, XML documents are
473 conforming SGML documents.
474 </p>
475 <p>
476 XML documents are made up of storage units called
477 <a title="Entity" href="#dt-entity">entities</a>, which contain either
478 parsed or unparsed data. Parsed data is made up of
479 <a title="Character" href="#dt-character">characters</a>, some of
480 which form
481 <a title="Character Data" href="#dt-chardata">character data</a>, and
482 some of which form <a title="Markup" href="#dt-markup">markup</a>.
483 Markup encodes a description of the document's storage layout and
484 logical structure. XML provides a mechanism to impose constraints on
485 the storage layout and logical structure.
486 </p>
487 <p>
488 [<a name="dt-xml-proc" id="dt-xml-proc" title="XML Processor"
489 >Definition</a
490 >: A software module called an <b>XML processor</b> is used to read
491 XML documents and provide access to their content and structure.] [<a
492 name="dt-app"
493 id="dt-app"
494 title="Application"
495 >Definition</a
496 >: It is assumed that an XML processor is doing its work on behalf of
497 another module, called the <b>application</b>.] This specification
498 describes the required behavior of an XML processor in terms of how it
499 must read XML data and the information it must provide to the
500 application.
501 </p>
502 <div class="div2">
503 <h3>
504 <a name="sec-origin-goals" id="sec-origin-goals" />1.1 Origin and
505 Goals
506 </h3>
507 <p>
508 XML was developed by an XML Working Group (originally known as the
509 SGML Editorial Review Board) formed under the auspices of the World
510 Wide Web Consortium (W3C) in 1996. It was chaired by Jon Bosak of
511 Sun Microsystems with the active participation of an XML Special
512 Interest Group (previously known as the SGML Working Group) also
513 organized by the W3C. The membership of the XML Working Group is
514 given in an appendix. Dan Connolly served as the Working Group's
515 contact with the W3C.
516 </p>
517 <p>The design goals for XML are:</p>
518 <ol class="enumar">
519 <li>
520 <p>XML shall be straightforwardly usable over the Internet.</p>
521 </li>
522 <li><p>XML shall support a wide variety of applications.</p></li>
523 <li><p>XML shall be compatible with SGML.</p></li>
524 <li>
525 <p>
526 It shall be easy to write programs which process XML documents.
527 </p>
528 </li>
529 <li>
530 <p>
531 The number of optional features in XML is to be kept to the
532 absolute minimum, ideally zero.
533 </p>
534 </li>
535 <li>
536 <p>XML documents should be human-legible and reasonably clear.</p>
537 </li>
538 <li><p>The XML design should be prepared quickly.</p></li>
539 <li><p>The design of XML shall be formal and concise.</p></li>
540 <li><p>XML documents shall be easy to create.</p></li>
541 <li><p>Terseness in XML markup is of minimal importance.</p></li>
542 </ol>
543 <p>
544 This specification, together with associated standards (Unicode
545 <a href="#Unicode">[Unicode]</a> and ISO/IEC 10646
546 <a href="#ISO10646">[ISO/IEC 10646]</a> for characters, Internet
547 <span>BCP 47</span> <a href="#RFC1766">[IETF BCP 47]</a>
548 <span
549 >and the Language Subtag Registry
550 <a href="#IANA-LANGCODES">[IANA-LANGCODES]</a></span
551 >
552 for language identification tags), provides all the information
553 necessary to understand XML Version 1.0 and construct computer
554 programs to process it.
555 </p>
556 <p>
557 This version of the XML specification may be distributed freely, as
558 long as all text and legal notices remain intact.
559 </p>
560 </div>
561 <div class="div2">
562 <h3>
563 <a name="sec-terminology" id="sec-terminology" />1.2 Terminology
564 </h3>
565 <p>
566 The terminology used to describe XML documents is defined in the
567 body of this specification. The key words
568 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>,
569 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST NOT</em
570 >,
571 <em class="rfc2119" title="Keyword in RFC 2119 context">REQUIRED</em
572 >,
573 <em class="rfc2119" title="Keyword in RFC 2119 context">SHALL</em>,
574 <em class="rfc2119" title="Keyword in RFC 2119 context"
575 >SHALL NOT</em
576 >,
577 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>,
578 <em class="rfc2119" title="Keyword in RFC 2119 context"
579 >SHOULD NOT</em
580 >,
581 <em class="rfc2119" title="Keyword in RFC 2119 context"
582 >RECOMMENDED</em
583 >, <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>,
584 and
585 <em class="rfc2119" title="Keyword in RFC 2119 context">OPTIONAL</em
586 >, when
587 <em class="rfc2119" title="Keyword in RFC 2119 context"
588 >EMPHASIZED</em
589 >, are to be interpreted as described in
590 <a href="#rfc2119">[IETF RFC 2119]</a>. In addition, the terms
591 defined in the following list are used in building those definitions
592 and in describing the actions of an XML processor:
593 </p>
594 <dl>
595 <dt class="label">error</dt>
596 <dd>
597 <p>
598 [<a name="dt-error" id="dt-error" title="Error">Definition</a>:
599 A violation of the rules of this specification; results are
600 undefined. Unless otherwise specified, failure to observe a
601 prescription of this specification indicated by one of the
602 keywords
603 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em
604 >,
605 <em class="rfc2119" title="Keyword in RFC 2119 context"
606 >REQUIRED</em
607 >,
608 <em class="rfc2119" title="Keyword in RFC 2119 context"
609 >MUST NOT</em
610 >,
611 <em class="rfc2119" title="Keyword in RFC 2119 context"
612 >SHALL</em
613 >
614 and
615 <em class="rfc2119" title="Keyword in RFC 2119 context"
616 >SHALL NOT</em
617 >
618 is an error. Conforming software
619 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
620 detect and report an error and
621 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
622 recover from it.]
623 </p>
624 </dd>
625 <dt class="label">fatal error</dt>
626 <dd>
627 <p>
628 [<a name="dt-fatal" id="dt-fatal" title="Fatal Error"
629 >Definition</a
630 >: An error which a conforming
631 <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
632 <em class="rfc2119" title="Keyword in RFC 2119 context"
633 >MUST</em
634 >
635 detect and report to the application. After encountering a fatal
636 error, the processor
637 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
638 continue processing the data to search for further errors and
639 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
640 report such errors to the application. In order to support
641 correction of errors, the processor
642 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
643 make unprocessed data from the document (with intermingled
644 character data and markup) available to the application. Once a
645 fatal error is detected, however, the processor
646 <em class="rfc2119" title="Keyword in RFC 2119 context"
647 >MUST NOT</em
648 >
649 continue normal processing (i.e., it
650 <em class="rfc2119" title="Keyword in RFC 2119 context"
651 >MUST NOT</em
652 >
653 continue to pass character data and information about the
654 document's logical structure to the application in the normal
655 way).]
656 </p>
657 </dd>
658 <dt class="label">at user option</dt>
659 <dd>
660 <p>
661 [<a
662 name="dt-atuseroption"
663 id="dt-atuseroption"
664 title="At user option"
665 >Definition</a
666 >: Conforming software
667 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
668 or
669 <em class="rfc2119" title="Keyword in RFC 2119 context"
670 >MUST</em
671 >
672 (depending on the modal verb in the sentence) behave as
673 described; if it does, it
674 <em class="rfc2119" title="Keyword in RFC 2119 context"
675 >MUST</em
676 >
677 provide users a means to enable or disable the behavior
678 described.]
679 </p>
680 </dd>
681 <dt class="label">validity constraint</dt>
682 <dd>
683 <p>
684 [<a name="dt-vc" id="dt-vc" title="Validity constraint"
685 >Definition</a
686 >: A rule which applies to all
687 <a title="Validity" href="#dt-valid">valid</a> XML documents.
688 Violations of validity constraints are errors; they
689 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em
690 >, at user option, be reported by
691 <a title="Validating Processor" href="#dt-validating"
692 >validating XML processors</a
693 >.]
694 </p>
695 </dd>
696 <dt class="label">well-formedness constraint</dt>
697 <dd>
698 <p>
699 [<a name="dt-wfc" id="dt-wfc" title="Well-formedness constraint"
700 >Definition</a
701 >: A rule which applies to all
702 <a title="Well-Formed" href="#dt-wellformed">well-formed</a> XML
703 documents. Violations of well-formedness constraints are
704 <a title="Fatal Error" href="#dt-fatal">fatal errors</a>.]
705 </p>
706 </dd>
707 <dt class="label">match</dt>
708 <dd>
709 <p>
710 [<a name="dt-match" id="dt-match" title="match">Definition</a>:
711 (Of strings or names:) Two strings or names being compared are
712 identical. Characters with multiple possible representations in
713 ISO/IEC 10646 (e.g. characters with both precomposed and
714 base+diacritic forms) match only if they have the same
715 representation in both strings. No case folding is performed.
716 (Of strings and rules in the grammar:) A string matches a
717 grammatical production if it belongs to the language generated
718 by that production. (Of content and content models:) An element
719 matches its declaration when it conforms in the fashion
720 described in the constraint
721 <b>[VC: <a href="#elementvalid">Element Valid</a>]</b>.]
722 </p>
723 </dd>
724 <dt class="label">for compatibility</dt>
725 <dd>
726 <p>
727 [<a name="dt-compat" id="dt-compat" title="For Compatibility"
728 >Definition</a
729 >: Marks a sentence describing a feature of XML included solely
730 to ensure that XML remains compatible with SGML.]
731 </p>
732 </dd>
733 <dt class="label">for interoperability</dt>
734 <dd>
735 <p>
736 [<a
737 name="dt-interop"
738 id="dt-interop"
739 title="For interoperability"
740 >Definition</a
741 >: Marks a sentence describing a non-binding recommendation
742 included to increase the chances that XML documents can be
743 processed by the existing installed base of SGML processors
744 which predate the WebSGML Adaptations Annex to ISO 8879.]
745 </p>
746 </dd>
747 </dl>
748 <p></p>
749 </div>
750 </div>
751 <div class="div1">
752 <h2><a name="sec-documents" id="sec-documents" />2 Documents</h2>
753 <p>
754 [<a name="dt-xml-doc" id="dt-xml-doc" title="XML Document"
755 >Definition</a
756 >: A data object is an <b>XML document</b> if it is
757 <a title="Well-Formed" href="#dt-wellformed">well-formed</a>, as
758 defined in this specification. In addition, the XML document is
759 <a title="Validity" href="#dt-valid">valid</a> if it meets certain
760 further constraints.]
761 </p>
762 <p>
763 Each XML document has both a logical and a physical structure.
764 Physically, the document is composed of units called
765 <a title="Entity" href="#dt-entity">entities</a>. An entity may
766 <a title="Entity Reference" href="#dt-entref">refer</a> to other
767 entities to cause their inclusion in the document. A document begins
768 in a "root" or
769 <a title="Document Entity" href="#dt-docent">document entity</a>.
770 Logically, the document is composed of declarations, elements,
771 comments, character references, and processing instructions, all of
772 which are indicated in the document by explicit markup. The logical
773 and physical structures
774 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> nest
775 properly, as described in
776 <a href="#wf-entities"><b>4.3.2 Well-Formed Parsed Entities</b></a
777 >.
778 </p>
779 <div class="div2">
780 <h3>
781 <a name="sec-well-formed" id="sec-well-formed" />2.1 Well-Formed XML
782 Documents
783 </h3>
784 <p>
785 [<a name="dt-wellformed" id="dt-wellformed" title="Well-Formed"
786 >Definition</a
787 >: A textual object is a <b>well-formed</b>
788 XML document if:]
789 </p>
790 <ol class="enumar">
791 <li>
792 <p>
793 Taken as a whole, it matches the production labeled
794 <a href="#NT-document">document</a>.
795 </p>
796 </li>
797 <li>
798 <p>
799 It meets all the well-formedness constraints given in this
800 specification.
801 </p>
802 </li>
803 <li>
804 <p>
805 Each of the
806 <a title="Text Entity" href="#dt-parsedent">parsed entities</a>
807 which is referenced directly or indirectly within the document
808 is <a title="Well-Formed" href="#dt-wellformed">well-formed</a>.
809 </p>
810 </li>
811 </ol>
812 <h5><a name="document" id="document" />Document</h5>
813 <table class="scrap" summary="Scrap">
814 <tbody>
815 <tr valign="baseline">
816 <td>
817 <a name="NT-document" id="NT-document" />[1]&nbsp;&nbsp;&nbsp;
818 </td>
819 <td><code>document</code></td>
820 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
821 <td>
822 <code>
823 <a href="#NT-prolog">prolog</a>
824 <a href="#NT-element">element</a>
825 <a href="#NT-Misc">Misc</a>*</code
826 >
827 </td>
828 </tr>
829 </tbody>
830 </table>
831 <p>
832 Matching the <a href="#NT-document">document</a> production implies
833 that:
834 </p>
835 <ol class="enumar">
836 <li>
837 <p>
838 It contains one or more
839 <a title="Element" href="#dt-element">elements</a>.
840 </p>
841 </li>
842 <li>
843 <p>
844 [<a name="dt-root" id="dt-root" title="Root Element"
845 >Definition</a
846 >: There is exactly one element, called the <b>root</b>, or
847 document element, no part of which appears in the
848 <a title="Content" href="#dt-content">content</a> of any other
849 element.] For all other elements, if the
850 <a title="Start-Tag" href="#dt-stag">start-tag</a> is in the
851 content of another element, the
852 <a title="End Tag" href="#dt-etag">end-tag</a> is in the content
853 of the same element. More simply stated, the elements, delimited
854 by start- and end-tags, nest properly within each other.
855 </p>
856 </li>
857 </ol>
858 <p>
859 [<a name="dt-parentchild" id="dt-parentchild" title="Parent/Child"
860 >Definition</a
861 >: As a consequence of this, for each non-root element
862 <code>C</code> in the document, there is one other element
863 <code>P</code> in the document such that <code>C</code> is in the
864 content of <code>P</code>, but is not in the content of any other
865 element that is in the content of <code>P</code>. <code>P</code> is
866 referred to as the <b>parent</b> of <code>C</code>, and
867 <code>C</code> as a <b>child</b> of <code>P</code>.]
868 </p>
869 </div>
870 <div class="div2">
871 <h3><a name="charsets" id="charsets" />2.2 Characters</h3>
872 <p>
873 [<a name="dt-text" id="dt-text" title="Text">Definition</a>: A
874 parsed entity contains <b>text</b>, a sequence of
875 <a title="Character" href="#dt-character">characters</a>, which may
876 represent markup or character data.] [<a
877 name="dt-character"
878 id="dt-character"
879 title="Character"
880 >Definition</a
881 >: A <b>character</b> is an atomic unit of text as specified by
882 ISO/IEC 10646:2000 <a href="#ISO10646">[ISO/IEC 10646]</a>. Legal
883 characters are tab, carriage return, line feed, and the legal
884 characters of Unicode and ISO/IEC 10646. The versions of these
885 standards cited in
886 <a href="#sec-existing-stds"><b>A.1 Normative References</b></a>
887 were current at the time this document was prepared. New characters
888 may be added to these standards by amendments or new editions.
889 Consequently, XML processors
890 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
891 accept any character in the range specified for
892 <a href="#NT-Char">Char</a>. ]
893 </p>
894 <h5><a name="char32" id="char32" />Character Range</h5>
895 <table class="scrap" summary="Scrap">
896 <tbody>
897 <tr valign="baseline">
898 <td><a name="NT-Char" id="NT-Char" />[2]&nbsp;&nbsp;&nbsp;</td>
899 <td><code>Char</code></td>
900 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
901 <td>
902 <code
903 >#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] |
904 [#x10000-#x10FFFF]</code
905 >
906 </td>
907 <td>
908 <i
909 >/* any Unicode character, excluding the surrogate blocks,
910 FFFE, and FFFF. */</i
911 >
912 </td>
913 </tr>
914 </tbody>
915 </table>
916 <p>
917 The mechanism for encoding character code points into bit patterns
918 may vary from entity to entity. All XML processors
919 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
920 accept the UTF-8 and UTF-16 encodings of Unicode
921 <span><a href="#Unicode">[Unicode]</a></span
922 >; the mechanisms for signaling which of the two is in use, or for
923 bringing other encodings into play, are discussed later, in
924 <a href="#charencoding"
925 ><b>4.3.3 Character Encoding in Entities</b></a
926 >.
927 </p>
928 <div class="note">
929 <p class="prefix"><b>Note:</b></p>
930 <p>
931 Document authors are encouraged to avoid "compatibility
932 characters", as defined in section <span>2.3</span> of
933 <a href="#Unicode">[Unicode]</a>. The characters defined in the
934 following ranges are also discouraged. They are either control
935 characters or permanently undefined Unicode characters:
936 </p>
937 <div class="exampleInner">
938 <pre>
939 [#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFD<span>E</span>F],
940 [#x1FFFE-#x1FFFF], [#x2FFFE-#x2FFFF], [#x3FFFE-#x3FFFF],
941 [#x4FFFE-#x4FFFF], [#x5FFFE-#x5FFFF], [#x6FFFE-#x6FFFF],
942 [#x7FFFE-#x7FFFF], [#x8FFFE-#x8FFFF], [#x9FFFE-#x9FFFF],
943 [#xAFFFE-#xAFFFF], [#xBFFFE-#xBFFFF], [#xCFFFE-#xCFFFF],
944 [#xDFFFE-#xDFFFF], [#xEFFFE-#xEFFFF], [#xFFFFE-#xFFFFF],
945 [#x10FFFE-#x10FFFF].</pre
946 >
947 </div>
948 </div>
949 </div>
950 <div class="div2">
951 <h3>
952 <a name="sec-common-syn" id="sec-common-syn" />2.3 Common Syntactic
953 Constructs
954 </h3>
955 <p>This section defines some symbols used widely in the grammar.</p>
956 <p>
957 <a href="#NT-S">S</a> (white space) consists of one or more space
958 (#x20) characters, carriage returns, line feeds, or tabs.
959 </p>
960 <h5><a name="white" id="white" />White Space</h5>
961 <table class="scrap" summary="Scrap">
962 <tbody>
963 <tr valign="baseline">
964 <td><a name="NT-S" id="NT-S" />[3]&nbsp;&nbsp;&nbsp;</td>
965 <td><code>S</code></td>
966 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
967 <td><code>(#x20 | #x9 | #xD | #xA)+</code></td>
968 </tr>
969 </tbody>
970 </table>
971 <div class="note">
972 <p class="prefix"><b>Note:</b></p>
973 <p>
974 The presence of #xD in the above production is maintained purely
975 for backward compatibility with the
976 <a href="http://www.w3.org/TR/1998/REC-xml-19980210"
977 >First Edition</a
978 >. As explained in
979 <a href="#sec-line-ends"><b>2.11 End-of-Line Handling</b></a
980 >, all #xD characters literally present in an XML document are
981 either removed or replaced by #xA characters before any other
982 processing is done. The only way to get a #xD character to match
983 this production is to use a character reference in an entity value
984 literal.
985 </p>
986 </div>
987 <p>
988 An <a href="#NT-Nmtoken">Nmtoken</a> (name token) is any mixture of
989 name characters.
990 </p>
991 <p>
992 [<a name="dt-name" id="dt-name" title="Name">Definition</a>: A
993 <a href="#NT-Name">Name</a> is an
994 <a href="#NT-Nmtoken">Nmtoken</a> with a restricted set of initial
995 characters.] Disallowed initial characters for
996 <a href="#NT-Name">Names</a> include digits, diacritics, the full
997 stop and the hyphen.
998 </p>
999 <p>
1000 Names beginning with the string "<code>xml</code>", or with any
1001 string which would match
1002 <code>(('X'|'x') ('M'|'m') ('L'|'l'))</code>, are reserved for
1003 standardization in this or future versions of this specification.
1004 </p>
1005 <div class="note">
1006 <p class="prefix"><b>Note:</b></p>
1007 <p>
1008 The Namespaces in XML Recommendation
1009 <a href="#xml-names">[XML Names]</a> assigns a meaning to names
1010 containing colon characters. Therefore, authors should not use the
1011 colon in XML names except for namespace purposes, but XML
1012 processors must accept the colon as a name character.
1013 </p>
1014 </div>
1015 <p>
1016 The first character of a <a href="#NT-Name">Name</a>
1017 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
1018 a <a href="#NT-NameStartChar">NameStartChar</a>, and any other
1019 characters
1020 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
1021 <a href="#NT-NameChar">NameChars</a>; this mechanism is used to
1022 prevent names from beginning with European (ASCII) digits or with
1023 basic combining characters. Almost all characters are permitted in
1024 names, except those which either are or reasonably could be used as
1025 delimiters. The intention is to be inclusive rather than exclusive,
1026 so that writing systems not yet encoded in Unicode can be used in
1027 XML names. See
1028 <a href="#sec-suggested-names"
1029 ><b>J Suggestions for XML Names</b></a
1030 >
1031 for suggestions on the creation of names.
1032 </p>
1033 <p>
1034 Document authors are encouraged to use names which are meaningful
1035 words or combinations of words in natural languages, and to avoid
1036 symbolic or white space characters in names. Note that COLON,
1037 HYPHEN-MINUS, FULL STOP (period), LOW LINE (underscore), and MIDDLE
1038 DOT are explicitly permitted.
1039 </p>
1040 <p>
1041 The ASCII symbols and punctuation marks, along with a fairly large
1042 group of Unicode symbol characters, are excluded from names because
1043 they are more useful as delimiters in contexts where XML names are
1044 used outside XML documents; providing this group gives those
1045 contexts hard guarantees about what <em>cannot</em> be part of an
1046 XML name. The character #x037E, GREEK QUESTION MARK, is excluded
1047 because when normalized it becomes a semicolon, which could change
1048 the meaning of entity references.
1049 </p>
1050 <h5><a name="d0e804" id="d0e804" />Names and Tokens</h5>
1051 <table class="scrap" summary="Scrap">
1052 <tbody>
1053 <tr valign="baseline">
1054 <td>
1055 <a
1056 name="NT-NameStartChar"
1057 id="NT-NameStartChar"
1058 />[4]&nbsp;&nbsp;&nbsp;
1059 </td>
1060 <td><code>NameStartChar</code></td>
1061 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1062 <td>
1063 <code
1064 >":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] |
1065 [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] |
1066 [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
1067 [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] |
1068 [#x10000-#xEFFFF]</code
1069 >
1070 </td>
1071 </tr>
1072 </tbody>
1073 <tbody>
1074 <tr valign="baseline">
1075 <td>
1076 <a
1077 name="NT-NameChar"
1078 id="NT-NameChar"
1079 />[4a]&nbsp;&nbsp;&nbsp;
1080 </td>
1081 <td><code>NameChar</code></td>
1082 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1083 <td>
1084 <code
1085 ><a href="#NT-NameStartChar">NameStartChar</a> | "-" | "." |
1086 [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]</code
1087 >
1088 </td>
1089 </tr>
1090 </tbody>
1091 <tbody>
1092 <tr valign="baseline">
1093 <td><a name="NT-Name" id="NT-Name" />[5]&nbsp;&nbsp;&nbsp;</td>
1094 <td><code>Name</code></td>
1095 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1096 <td>
1097 <code
1098 ><a href="#NT-NameStartChar">NameStartChar</a> (<a
1099 href="#NT-NameChar"
1100 >NameChar</a
1101 >)*</code
1102 >
1103 </td>
1104 </tr>
1105 </tbody>
1106 <tbody>
1107 <tr valign="baseline">
1108 <td>
1109 <a name="NT-Names" id="NT-Names" />[6]&nbsp;&nbsp;&nbsp;
1110 </td>
1111 <td><code>Names</code></td>
1112 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1113 <td>
1114 <code
1115 ><a href="#NT-Name">Name</a> (#x20
1116 <a href="#NT-Name">Name</a>)*</code
1117 >
1118 </td>
1119 </tr>
1120 </tbody>
1121 <tbody>
1122 <tr valign="baseline">
1123 <td>
1124 <a name="NT-Nmtoken" id="NT-Nmtoken" />[7]&nbsp;&nbsp;&nbsp;
1125 </td>
1126 <td><code>Nmtoken</code></td>
1127 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1128 <td>
1129 <code>(<a href="#NT-NameChar">NameChar</a>)+</code>
1130 </td>
1131 </tr>
1132 </tbody>
1133 <tbody>
1134 <tr valign="baseline">
1135 <td>
1136 <a name="NT-Nmtokens" id="NT-Nmtokens" />[8]&nbsp;&nbsp;&nbsp;
1137 </td>
1138 <td><code>Nmtokens</code></td>
1139 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1140 <td>
1141 <code
1142 ><a href="#NT-Nmtoken">Nmtoken</a> (#x20
1143 <a href="#NT-Nmtoken">Nmtoken</a>)*</code
1144 >
1145 </td>
1146 </tr>
1147 </tbody>
1148 </table>
1149 <div class="note">
1150 <p class="prefix"><b>Note:</b></p>
1151 <p>
1152 The <a href="#NT-Names">Names</a> and
1153 <a href="#NT-Nmtokens">Nmtokens</a> productions are used to define
1154 the validity of tokenized attribute values after normalization
1155 (see
1156 <a href="#sec-attribute-types"><b>3.3.1 Attribute Types</b></a
1157 >).
1158 </p>
1159 </div>
1160 <p>
1161 Literal data is any quoted string not containing the quotation mark
1162 used as a delimiter for that string. Literals are used for
1163 specifying the content of internal entities (<a
1164 href="#NT-EntityValue"
1165 >EntityValue</a
1166 >), the values of attributes (<a href="#NT-AttValue">AttValue</a>),
1167 and external identifiers (<a href="#NT-SystemLiteral"
1168 >SystemLiteral</a
1169 >). Note that a <a href="#NT-SystemLiteral">SystemLiteral</a> can be
1170 parsed without scanning for markup.
1171 </p>
1172 <h5><a name="d0e888" id="d0e888" />Literals</h5>
1173 <table class="scrap" summary="Scrap">
1174 <tbody>
1175 <tr valign="baseline">
1176 <td>
1177 <a
1178 name="NT-EntityValue"
1179 id="NT-EntityValue"
1180 />[9]&nbsp;&nbsp;&nbsp;
1181 </td>
1182 <td><code>EntityValue</code></td>
1183 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1184 <td>
1185 <code
1186 >'"' ([^%&amp;"] |
1187 <a href="#NT-PEReference">PEReference</a> |
1188 <a href="#NT-Reference">Reference</a>)* '"'
1189 </code>
1190 </td>
1191 </tr>
1192 <tr valign="baseline">
1193 <td />
1194 <td />
1195 <td />
1196 <td>
1197 <code
1198 >|&nbsp; "'" ([^%&amp;'] |
1199 <a href="#NT-PEReference">PEReference</a> |
1200 <a href="#NT-Reference">Reference</a>)* "'"</code
1201 >
1202 </td>
1203 </tr>
1204 </tbody>
1205 <tbody>
1206 <tr valign="baseline">
1207 <td>
1208 <a
1209 name="NT-AttValue"
1210 id="NT-AttValue"
1211 />[10]&nbsp;&nbsp;&nbsp;
1212 </td>
1213 <td><code>AttValue</code></td>
1214 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1215 <td>
1216 <code
1217 >'"' ([^&lt;&amp;"] |
1218 <a href="#NT-Reference">Reference</a>)* '"'
1219 </code>
1220 </td>
1221 </tr>
1222 <tr valign="baseline">
1223 <td />
1224 <td />
1225 <td />
1226 <td>
1227 <code
1228 >|&nbsp; "'" ([^&lt;&amp;'] |
1229 <a href="#NT-Reference">Reference</a>)* "'"</code
1230 >
1231 </td>
1232 </tr>
1233 </tbody>
1234 <tbody>
1235 <tr valign="baseline">
1236 <td>
1237 <a
1238 name="NT-SystemLiteral"
1239 id="NT-SystemLiteral"
1240 />[11]&nbsp;&nbsp;&nbsp;
1241 </td>
1242 <td><code>SystemLiteral</code></td>
1243 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1244 <td><code>('"' [^"]* '"') |&nbsp;("'" [^']* "'") </code></td>
1245 </tr>
1246 </tbody>
1247 <tbody>
1248 <tr valign="baseline">
1249 <td>
1250 <a
1251 name="NT-PubidLiteral"
1252 id="NT-PubidLiteral"
1253 />[12]&nbsp;&nbsp;&nbsp;
1254 </td>
1255 <td><code>PubidLiteral</code></td>
1256 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1257 <td>
1258 <code
1259 >'"' <a href="#NT-PubidChar">PubidChar</a>* '"' | "'" (<a
1260 href="#NT-PubidChar"
1261 >PubidChar</a
1262 >
1263 - "'")* "'"</code
1264 >
1265 </td>
1266 </tr>
1267 </tbody>
1268 <tbody>
1269 <tr valign="baseline">
1270 <td>
1271 <a
1272 name="NT-PubidChar"
1273 id="NT-PubidChar"
1274 />[13]&nbsp;&nbsp;&nbsp;
1275 </td>
1276 <td><code>PubidChar</code></td>
1277 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1278 <td>
1279 <code
1280 >#x20 | #xD | #xA |&nbsp;[a-zA-Z0-9]
1281 |&nbsp;[-'()+,./:=?;!*#@$_%]</code
1282 >
1283 </td>
1284 </tr>
1285 </tbody>
1286 </table>
1287 <div class="note">
1288 <p class="prefix"><b>Note:</b></p>
1289 <p>
1290 Although the <a href="#NT-EntityValue">EntityValue</a> production
1291 allows the definition of a general entity consisting of a single
1292 explicit <code>&lt;</code> in the literal (e.g.,
1293 <code>&lt;!ENTITY mylt "&lt;"&gt;</code>), it is strongly advised
1294 to avoid this practice since any reference to that entity will
1295 cause a well-formedness error.
1296 </p>
1297 </div>
1298 </div>
1299 <div class="div2">
1300 <h3><a name="syntax" id="syntax" />2.4 Character Data and Markup</h3>
1301 <p>
1302 <a title="Text" href="#dt-text">Text</a> consists of intermingled
1303 <a title="Character Data" href="#dt-chardata">character data</a> and
1304 markup. [<a name="dt-markup" id="dt-markup" title="Markup"
1305 >Definition</a
1306 >: <b>Markup</b> takes the form of
1307 <a title="Start-Tag" href="#dt-stag">start-tags</a>,
1308 <a title="End Tag" href="#dt-etag">end-tags</a>,
1309 <a title="Empty" href="#dt-empty">empty-element tags</a>,
1310 <a title="Entity Reference" href="#dt-entref">entity references</a>,
1311 <a title="Character Reference" href="#dt-charref"
1312 >character references</a
1313 >, <a title="Comment" href="#dt-comment">comments</a>,
1314 <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>
1315 delimiters,
1316 <a title="Document Type Declaration" href="#dt-doctype"
1317 >document type declarations</a
1318 >,
1319 <a title="Processing instruction" href="#dt-pi"
1320 >processing instructions</a
1321 >, <a href="#NT-XMLDecl">XML declarations</a>,
1322 <a href="#NT-TextDecl">text declarations</a>, and any white space
1323 that is at the top level of the document entity (that is, outside
1324 the document element and not inside any other markup).]
1325 </p>
1326 <p>
1327 [<a name="dt-chardata" id="dt-chardata" title="Character Data"
1328 >Definition</a
1329 >: All text that is not markup constitutes the
1330 <b>character data</b> of the document.]
1331 </p>
1332 <p>
1333 The ampersand character (&amp;) and the left angle bracket (&lt;)
1334 <em class="rfc2119" title="Keyword in RFC 2119 context"
1335 >MUST NOT</em
1336 >
1337 appear in their literal form, except when used as markup delimiters,
1338 or within a <a title="Comment" href="#dt-comment">comment</a>, a
1339 <a title="Processing instruction" href="#dt-pi"
1340 >processing instruction</a
1341 >, or a
1342 <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>. If
1343 they are needed elsewhere, they
1344 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
1345 <a title="escape" href="#dt-escape">escaped</a> using either
1346 <a title="Character Reference" href="#dt-charref"
1347 >numeric character references</a
1348 >
1349 or the strings "
1350 <code>&amp;amp;</code>
1351 " and "
1352 <code>&amp;lt;</code>
1353 " respectively. The right angle bracket (&gt;) may be represented
1354 using the string "
1355 <code>&amp;gt;</code>
1356 ", and
1357 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>,
1358 <a title="For Compatibility" href="#dt-compat">for compatibility</a
1359 >, be escaped using either "
1360 <code>&amp;gt;</code>
1361 " or a character reference when it appears in the string "
1362 <code>]]&gt;</code>
1363 " in content, when that string is not marking the end of a
1364 <a title="CDATA Section" href="#dt-cdsection">CDATA section</a>.
1365 </p>
1366 <p>
1367 In the content of elements, character data is any string of
1368 characters which does not contain the start-delimiter of any markup
1369 and does not include the CDATA-section-close delimiter, "
1370 <code>]]&gt;</code>
1371 ". In a CDATA section, character data is any string of characters
1372 not including the CDATA-section-close delimiter, "
1373 <code>]]&gt;</code>
1374 ".
1375 </p>
1376 <p>
1377 To allow attribute values to contain both single and double quotes,
1378 the apostrophe or single-quote character (') may be represented as "
1379 <code>&amp;apos;</code>
1380 ", and the double-quote character (") as "
1381 <code>&amp;quot;</code>
1382 ".
1383 </p>
1384 <h5><a name="d0e1106" id="d0e1106" />Character Data</h5>
1385 <table class="scrap" summary="Scrap">
1386 <tbody>
1387 <tr valign="baseline">
1388 <td>
1389 <a
1390 name="NT-CharData"
1391 id="NT-CharData"
1392 />[14]&nbsp;&nbsp;&nbsp;
1393 </td>
1394 <td><code>CharData</code></td>
1395 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1396 <td>
1397 <code
1398 >[^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;'
1399 [^&lt;&amp;]*)</code
1400 >
1401 </td>
1402 </tr>
1403 </tbody>
1404 </table>
1405 </div>
1406 <div class="div2">
1407 <h3><a name="sec-comments" id="sec-comments" />2.5 Comments</h3>
1408 <p>
1409 [<a name="dt-comment" id="dt-comment" title="Comment">Definition</a
1410 >: <b>Comments</b> may appear anywhere in a document outside other
1411 <a title="Markup" href="#dt-markup">markup</a>; in addition, they
1412 may appear within the document type declaration at places allowed by
1413 the grammar. They are not part of the document's
1414 <a title="Character Data" href="#dt-chardata">character data</a>; an
1415 XML processor
1416 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>,
1417 but need not, make it possible for an application to retrieve the
1418 text of comments.
1419 <a title="For Compatibility" href="#dt-compat">For compatibility</a
1420 >, the string "
1421 <code>--</code>
1422 " (double-hyphen)
1423 <em class="rfc2119" title="Keyword in RFC 2119 context"
1424 >MUST NOT</em
1425 >
1426 occur within comments.] Parameter entity references
1427 <em class="rfc2119" title="Keyword in RFC 2119 context"
1428 >MUST NOT</em
1429 >
1430 be recognized within comments.
1431 </p>
1432 <h5><a name="d0e1149" id="d0e1149" />Comments</h5>
1433 <table class="scrap" summary="Scrap">
1434 <tbody>
1435 <tr valign="baseline">
1436 <td>
1437 <a name="NT-Comment" id="NT-Comment" />[15]&nbsp;&nbsp;&nbsp;
1438 </td>
1439 <td><code>Comment</code></td>
1440 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1441 <td>
1442 <code
1443 >'&lt;!--' ((<a href="#NT-Char">Char</a> - '-') | ('-' (<a
1444 href="#NT-Char"
1445 >Char</a
1446 >
1447 - '-')))* '--&gt;'</code
1448 >
1449 </td>
1450 </tr>
1451 </tbody>
1452 </table>
1453 <p>An example of a comment:</p>
1454 <div class="exampleInner">
1455 <pre>
1456 &lt;!-- declarations for &lt;head&gt; &amp; &lt;body&gt; --&gt;</pre
1457 >
1458 </div>
1459 <p>
1460 Note that the grammar does not allow a comment ending in
1461 <code>---&gt;</code>. The following example is
1462 <em>not</em> well-formed.
1463 </p>
1464 <div class="exampleInner"><pre>&lt;!-- B+, B, or B---&gt;</pre></div>
1465 </div>
1466 <div class="div2">
1467 <h3><a name="sec-pi" id="sec-pi" />2.6 Processing Instructions</h3>
1468 <p>
1469 [<a name="dt-pi" id="dt-pi" title="Processing instruction"
1470 >Definition</a
1471 >:
1472 <b>Processing instructions</b>
1473 (PIs) allow documents to contain instructions for applications.]
1474 </p>
1475 <h5><a name="d0e1188" id="d0e1188" />Processing Instructions</h5>
1476 <table class="scrap" summary="Scrap">
1477 <tbody>
1478 <tr valign="baseline">
1479 <td><a name="NT-PI" id="NT-PI" />[16]&nbsp;&nbsp;&nbsp;</td>
1480 <td><code>PI</code></td>
1481 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1482 <td>
1483 <code
1484 >'&lt;?' <a href="#NT-PITarget">PITarget</a> (<a
1485 href="#NT-S"
1486 >S</a
1487 >
1488 (<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a
1489 >* '?&gt;' <a href="#NT-Char">Char</a>*)))? '?&gt;'</code
1490 >
1491 </td>
1492 </tr>
1493 </tbody>
1494 <tbody>
1495 <tr valign="baseline">
1496 <td>
1497 <a
1498 name="NT-PITarget"
1499 id="NT-PITarget"
1500 />[17]&nbsp;&nbsp;&nbsp;
1501 </td>
1502 <td><code>PITarget</code></td>
1503 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1504 <td>
1505 <code>
1506 <a href="#NT-Name">Name</a> - (('X' | 'x') ('M' | 'm') ('L'
1507 | 'l'))</code
1508 >
1509 </td>
1510 </tr>
1511 </tbody>
1512 </table>
1513 <p>
1514 PIs are not part of the document's
1515 <a title="Character Data" href="#dt-chardata">character data</a>,
1516 but
1517 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
1518 passed through to the application. The PI begins with a target (<a
1519 href="#NT-PITarget"
1520 >PITarget</a
1521 >) used to identify the application to which the instruction is
1522 directed. The target names "
1523 <code>XML</code>
1524 ", "
1525 <code>xml</code>
1526 ", and so on are reserved for standardization in this or future
1527 versions of this specification. The XML
1528 <a title="Notation" href="#dt-notation">Notation</a> mechanism may
1529 be used for formal declaration of PI targets. Parameter entity
1530 references
1531 <em class="rfc2119" title="Keyword in RFC 2119 context"
1532 >MUST NOT</em
1533 >
1534 be recognized within processing instructions.
1535 </p>
1536 </div>
1537 <div class="div2">
1538 <h3>
1539 <a name="sec-cdata-sect" id="sec-cdata-sect" />2.7 CDATA Sections
1540 </h3>
1541 <p>
1542 [<a name="dt-cdsection" id="dt-cdsection" title="CDATA Section"
1543 >Definition</a
1544 >: <b>CDATA sections</b> may occur anywhere character data may
1545 occur; they are used to escape blocks of text containing characters
1546 which would otherwise be recognized as markup. CDATA sections begin
1547 with the string "
1548 <code>&lt;![CDATA[</code>
1549 " and end with the string "
1550 <code>]]&gt;</code>
1551 ":]
1552 </p>
1553 <h5><a name="d0e1271" id="d0e1271" />CDATA Sections</h5>
1554 <table class="scrap" summary="Scrap">
1555 <tbody>
1556 <tr valign="baseline">
1557 <td>
1558 <a name="NT-CDSect" id="NT-CDSect" />[18]&nbsp;&nbsp;&nbsp;
1559 </td>
1560 <td><code>CDSect</code></td>
1561 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1562 <td>
1563 <code>
1564 <a href="#NT-CDStart">CDStart</a>
1565 <a href="#NT-CData">CData</a>
1566 <a href="#NT-CDEnd">CDEnd</a>
1567 </code>
1568 </td>
1569 </tr>
1570 </tbody>
1571 <tbody>
1572 <tr valign="baseline">
1573 <td>
1574 <a name="NT-CDStart" id="NT-CDStart" />[19]&nbsp;&nbsp;&nbsp;
1575 </td>
1576 <td><code>CDStart</code></td>
1577 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1578 <td><code>'&lt;![CDATA['</code></td>
1579 </tr>
1580 </tbody>
1581 <tbody>
1582 <tr valign="baseline">
1583 <td>
1584 <a name="NT-CData" id="NT-CData" />[20]&nbsp;&nbsp;&nbsp;
1585 </td>
1586 <td><code>CData</code></td>
1587 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1588 <td>
1589 <code
1590 >(<a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a
1591 >* ']]&gt;' <a href="#NT-Char">Char</a>*))
1592 </code>
1593 </td>
1594 </tr>
1595 </tbody>
1596 <tbody>
1597 <tr valign="baseline">
1598 <td>
1599 <a name="NT-CDEnd" id="NT-CDEnd" />[21]&nbsp;&nbsp;&nbsp;
1600 </td>
1601 <td><code>CDEnd</code></td>
1602 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1603 <td><code>']]&gt;'</code></td>
1604 </tr>
1605 </tbody>
1606 </table>
1607 <p>
1608 Within a CDATA section, only the
1609 <a href="#NT-CDEnd">CDEnd</a> string is recognized as markup, so
1610 that left angle brackets and ampersands may occur in their literal
1611 form; they need not (and cannot) be escaped using "
1612 <code>&amp;lt;</code>
1613 " and "
1614 <code>&amp;amp;</code>
1615 ". CDATA sections cannot nest.
1616 </p>
1617 <p>
1618 An example of a CDATA section, in which "
1619 <code>&lt;greeting&gt;</code>
1620 " and "
1621 <code>&lt;/greeting&gt;</code>
1622 " are recognized as
1623 <a title="Character Data" href="#dt-chardata">character data</a>,
1624 not <a title="Markup" href="#dt-markup">markup</a>:
1625 </p>
1626 <div class="exampleInner">
1627 <pre>
1628 &lt;![CDATA[&lt;greeting&gt;Hello, world!&lt;/greeting&gt;]]&gt; </pre
1629 >
1630 </div>
1631 </div>
1632 <div class="div2">
1633 <h3>
1634 <a name="sec-prolog-dtd" id="sec-prolog-dtd" />2.8 Prolog and
1635 Document Type Declaration
1636 </h3>
1637 <p>
1638 [<a name="dt-xmldecl" id="dt-xmldecl" title="XML Declaration"
1639 >Definition</a
1640 >: XML documents
1641 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>
1642 begin with an <b>XML declaration</b> which specifies the version of
1643 XML being used.] For example, the following is a complete XML
1644 document,
1645 <a title="Well-Formed" href="#dt-wellformed">well-formed</a> but not
1646 <a title="Validity" href="#dt-valid">valid</a>:
1647 </p>
1648 <div class="exampleInner">
1649 <pre>
1650 &lt;?xml version="1.0"?&gt;
1651 &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre
1652 >
1653 </div>
1654 <p>and so is this:</p>
1655 <div class="exampleInner">
1656 <pre>&lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre>
1657 </div>
1658 <p>
1659 The function of the markup in an XML document is to describe its
1660 storage and logical structure and to associate attribute name-value
1661 pairs with its logical structures. XML provides a mechanism, the
1662 <a title="Document Type Declaration" href="#dt-doctype"
1663 >document type declaration</a
1664 >, to define constraints on the logical structure and to support the
1665 use of predefined storage units. [<a
1666 name="dt-valid"
1667 id="dt-valid"
1668 title="Validity"
1669 >Definition</a
1670 >: An XML document is <b>valid</b> if it has an associated document
1671 type declaration and if the document complies with the constraints
1672 expressed in it.]
1673 </p>
1674 <p>
1675 The document type declaration
1676 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
1677 appear before the first
1678 <a title="Element" href="#dt-element">element</a> in the document.
1679 </p>
1680 <h5><a name="xmldoc" id="xmldoc" />Prolog</h5>
1681 <table class="scrap" summary="Scrap">
1682 <tbody>
1683 <tr valign="baseline">
1684 <td>
1685 <a name="NT-prolog" id="NT-prolog" />[22]&nbsp;&nbsp;&nbsp;
1686 </td>
1687 <td><code>prolog</code></td>
1688 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1689 <td>
1690 <code>
1691 <a href="#NT-XMLDecl">XMLDecl</a>?
1692 <a href="#NT-Misc">Misc</a>* (<a href="#NT-doctypedecl"
1693 >doctypedecl</a
1694 >
1695 <a href="#NT-Misc">Misc</a>*)?</code
1696 >
1697 </td>
1698 </tr>
1699 <tr valign="baseline">
1700 <td>
1701 <a name="NT-XMLDecl" id="NT-XMLDecl" />[23]&nbsp;&nbsp;&nbsp;
1702 </td>
1703 <td><code>XMLDecl</code></td>
1704 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1705 <td>
1706 <code
1707 >'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a>
1708 <a href="#NT-EncodingDecl">EncodingDecl</a>?
1709 <a href="#NT-SDDecl">SDDecl</a>? <a href="#NT-S">S</a>?
1710 '?&gt;'</code
1711 >
1712 </td>
1713 </tr>
1714 <tr valign="baseline">
1715 <td>
1716 <a
1717 name="NT-VersionInfo"
1718 id="NT-VersionInfo"
1719 />[24]&nbsp;&nbsp;&nbsp;
1720 </td>
1721 <td><code>VersionInfo</code></td>
1722 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1723 <td>
1724 <code>
1725 <a href="#NT-S">S</a> 'version' <a href="#NT-Eq">Eq</a> ("'"
1726 <a href="#NT-VersionNum">VersionNum</a> "'" | '"'
1727 <a href="#NT-VersionNum">VersionNum</a> '"')</code
1728 >
1729 </td>
1730 </tr>
1731 <tr valign="baseline">
1732 <td><a name="NT-Eq" id="NT-Eq" />[25]&nbsp;&nbsp;&nbsp;</td>
1733 <td><code>Eq</code></td>
1734 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1735 <td>
1736 <code>
1737 <a href="#NT-S">S</a>? '=' <a href="#NT-S">S</a>?</code
1738 >
1739 </td>
1740 </tr>
1741 <tr valign="baseline">
1742 <td>
1743 <a
1744 name="NT-VersionNum"
1745 id="NT-VersionNum"
1746 />[26]&nbsp;&nbsp;&nbsp;
1747 </td>
1748 <td><code>VersionNum</code></td>
1749 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1750 <td><code>'1.' [0-9]+</code></td>
1751 </tr>
1752 <tr valign="baseline">
1753 <td><a name="NT-Misc" id="NT-Misc" />[27]&nbsp;&nbsp;&nbsp;</td>
1754 <td><code>Misc</code></td>
1755 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1756 <td>
1757 <code>
1758 <a href="#NT-Comment">Comment</a> |
1759 <a href="#NT-PI">PI</a> | <a href="#NT-S">S</a>
1760 </code>
1761 </td>
1762 </tr>
1763 </tbody>
1764 </table>
1765 <p>
1766 Even though the <a href="#NT-VersionNum">VersionNum</a> production
1767 matches any version number of the form '1.x', XML 1.0 documents
1768 <em class="rfc2119" title="Keyword in RFC 2119 context"
1769 >SHOULD NOT</em
1770 >
1771 specify a version number other than '1.0'.
1772 </p>
1773 <div class="note">
1774 <p class="prefix"><b>Note:</b></p>
1775 <p>
1776 When an XML 1.0 processor encounters a document that specifies a
1777 1.x version number other than '1.0', it will process it as a 1.0
1778 document. This means that an XML 1.0 processor will accept 1.x
1779 documents provided they do not use any non-1.0 features.
1780 </p>
1781 </div>
1782 <p>
1783 [<a
1784 name="dt-doctype"
1785 id="dt-doctype"
1786 title="Document Type Declaration"
1787 >Definition</a
1788 >: The XML <b>document type declaration</b> contains or points to
1789 <a title="markup declaration" href="#dt-markupdecl"
1790 >markup declarations</a
1791 >
1792 that provide a grammar for a class of documents. This grammar is
1793 known as a document type definition, or <b>DTD</b>. The document
1794 type declaration can point to an external subset (a special kind of
1795 <a title="External Entity" href="#dt-extent">external entity</a>)
1796 containing markup declarations, or can contain the markup
1797 declarations directly in an internal subset, or can do both. The DTD
1798 for a document consists of both subsets taken together.]
1799 </p>
1800 <p>
1801 [<a
1802 name="dt-markupdecl"
1803 id="dt-markupdecl"
1804 title="markup declaration"
1805 >Definition</a
1806 >: A <b>markup declaration</b> is an
1807 <a title="Element Type declaration" href="#dt-eldecl"
1808 >element type declaration</a
1809 >, an
1810 <a title="Attribute-List Declaration" href="#dt-attdecl"
1811 >attribute-list declaration</a
1812 >, an
1813 <a title="entity declaration" href="#dt-entdecl"
1814 >entity declaration</a
1815 >, or a
1816 <a title="Notation Declaration" href="#dt-notdecl"
1817 >notation declaration</a
1818 >.] These declarations may be contained in whole or in part within
1819 <a title="Parameter entity" href="#dt-PE">parameter entities</a>, as
1820 described in the well-formedness and validity constraints below. For
1821 further information, see
1822 <a href="#sec-physical-struct"><b>4 Physical Structures</b></a
1823 >.
1824 </p>
1825 <h5><a name="dtd" id="dtd" />Document Type Definition</h5>
1826 <table class="scrap" summary="Scrap">
1827 <tbody>
1828 <tr valign="baseline">
1829 <td>
1830 <a
1831 name="NT-doctypedecl"
1832 id="NT-doctypedecl"
1833 />[28]&nbsp;&nbsp;&nbsp;
1834 </td>
1835 <td><code>doctypedecl</code></td>
1836 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1837 <td>
1838 <code
1839 >'&lt;!DOCTYPE' <a href="#NT-S">S</a>
1840 <a href="#NT-Name">Name</a>
1841 (<a href="#NT-S">S</a>
1842 <a href="#NT-ExternalID">ExternalID</a>)?
1843 <a href="#NT-S">S</a>? ('['
1844 <a href="#NT-intSubset">intSubset</a> ']'
1845 <a href="#NT-S">S</a>?)? '&gt;'</code
1846 >
1847 </td>
1848 <td><a href="#vc-roottype">[VC: Root Element Type]</a></td>
1849 </tr>
1850 <tr valign="baseline">
1851 <td />
1852 <td />
1853 <td />
1854 <td />
1855 <td><a href="#ExtSubset">[WFC: External Subset]</a></td>
1856 </tr>
1857 <tr valign="baseline">
1858 <td>
1859 <a name="NT-DeclSep" id="NT-DeclSep" />[28a]&nbsp;&nbsp;&nbsp;
1860 </td>
1861 <td><code>DeclSep</code></td>
1862 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1863 <td>
1864 <code>
1865 <a href="#NT-PEReference">PEReference</a> |
1866 <a href="#NT-S">S</a>
1867 </code>
1868 </td>
1869 <td>
1870 <a href="#PE-between-Decls">[WFC: PE Between Declarations]</a>
1871 </td>
1872 </tr>
1873 <tr valign="baseline">
1874 <td>
1875 <a
1876 name="NT-intSubset"
1877 id="NT-intSubset"
1878 />[28b]&nbsp;&nbsp;&nbsp;
1879 </td>
1880 <td><code>intSubset</code></td>
1881 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1882 <td>
1883 <code
1884 >(<a href="#NT-markupdecl">markupdecl</a> |
1885 <a href="#NT-DeclSep">DeclSep</a>)*</code
1886 >
1887 </td>
1888 </tr>
1889 <tr valign="baseline">
1890 <td>
1891 <a
1892 name="NT-markupdecl"
1893 id="NT-markupdecl"
1894 />[29]&nbsp;&nbsp;&nbsp;
1895 </td>
1896 <td><code>markupdecl</code></td>
1897 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
1898 <td>
1899 <code>
1900 <a href="#NT-elementdecl">elementdecl</a> |
1901 <a href="#NT-AttlistDecl">AttlistDecl</a> |
1902 <a href="#NT-EntityDecl">EntityDecl</a> |
1903 <a href="#NT-NotationDecl">NotationDecl</a> |
1904 <a href="#NT-PI">PI</a> | <a href="#NT-Comment">Comment</a>
1905 </code>
1906 </td>
1907 <td>
1908 <a href="#vc-PEinMarkupDecl"
1909 >[VC: Proper Declaration/PE Nesting]</a
1910 >
1911 </td>
1912 </tr>
1913 <tr valign="baseline">
1914 <td />
1915 <td />
1916 <td />
1917 <td />
1918 <td>
1919 <a href="#wfc-PEinInternalSubset"
1920 >[WFC: PEs in Internal Subset]</a
1921 >
1922 </td>
1923 </tr>
1924 </tbody>
1925 </table>
1926 <p>
1927 Note that it is possible to construct a well-formed document
1928 containing a <a href="#NT-doctypedecl">doctypedecl</a> that neither
1929 points to an external subset nor contains an internal subset.
1930 </p>
1931 <p>
1932 The markup declarations may be made up in whole or in part of the
1933 <a title="Replacement Text" href="#dt-repltext">replacement text</a>
1934 of <a title="Parameter entity" href="#dt-PE">parameter entities</a>.
1935 The productions later in this specification for individual
1936 nonterminals (<a href="#NT-elementdecl">elementdecl</a>,
1937 <a href="#NT-AttlistDecl">AttlistDecl</a>, and so on) describe the
1938 declarations <em>after</em> all the parameter entities have been
1939 <a title="Include" href="#dt-include">included</a>.
1940 </p>
1941 <p>
1942 Parameter entity references are recognized anywhere in the DTD
1943 (internal and external subsets and external parameter entities),
1944 except in literals, processing instructions, comments, and the
1945 contents of ignored conditional sections (see
1946 <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a
1947 >). They are also recognized in entity value literals. The use of
1948 parameter entities in the internal subset is restricted as described
1949 below.
1950 </p>
1951 <div class="constraint">
1952 <p class="prefix">
1953 <a name="vc-roottype" id="vc-roottype" /><b
1954 >Validity constraint: Root Element Type</b
1955 >
1956 </p>
1957 <p>
1958 The <a href="#NT-Name">Name</a> in the document type declaration
1959 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
1960 match the element type of the
1961 <a title="Root Element" href="#dt-root">root element</a>.
1962 </p>
1963 </div>
1964 <div class="constraint">
1965 <p class="prefix">
1966 <a name="vc-PEinMarkupDecl" id="vc-PEinMarkupDecl" /><b
1967 >Validity constraint: Proper Declaration/PE Nesting</b
1968 >
1969 </p>
1970 <p>
1971 Parameter-entity
1972 <a title="Replacement Text" href="#dt-repltext"
1973 >replacement text</a
1974 >
1975 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
1976 be properly nested with markup declarations. That is to say, if
1977 either the first character or the last character of a markup
1978 declaration (<a href="#NT-markupdecl">markupdecl</a> above) is
1979 contained in the replacement text for a
1980 <a title="Parameter-entity reference" href="#dt-PERef"
1981 >parameter-entity reference</a
1982 >, both
1983 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
1984 be contained in the same replacement text.
1985 </p>
1986 </div>
1987 <div class="constraint">
1988 <p class="prefix">
1989 <a name="wfc-PEinInternalSubset" id="wfc-PEinInternalSubset" /><b
1990 >Well-formedness constraint: PEs in Internal Subset</b
1991 >
1992 </p>
1993 <p>
1994 In the internal DTD subset,
1995 <a title="Parameter-entity reference" href="#dt-PERef"
1996 >parameter-entity references</a
1997 >
1998 <em class="rfc2119" title="Keyword in RFC 2119 context"
1999 >MUST NOT</em
2000 >
2001 occur within markup declarations; they may occur where markup
2002 declarations can occur. (This does not apply to references that
2003 occur in external parameter entities or to the external subset.)
2004 </p>
2005 </div>
2006 <div class="constraint">
2007 <p class="prefix">
2008 <a name="ExtSubset" id="ExtSubset" /><b
2009 >Well-formedness constraint: External Subset</b
2010 >
2011 </p>
2012 <p>
2013 The external subset, if any,
2014 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2015 match the production for <a href="#NT-extSubset">extSubset</a>.
2016 </p>
2017 </div>
2018 <div class="constraint">
2019 <p class="prefix">
2020 <a name="PE-between-Decls" id="PE-between-Decls" /><b
2021 >Well-formedness constraint: PE Between Declarations</b
2022 >
2023 </p>
2024 <p>
2025 The replacement text of a parameter entity reference in a
2026 <a href="#NT-DeclSep">DeclSep</a>
2027 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2028 match the production
2029 <a href="#NT-extSubsetDecl">extSubsetDecl</a>.
2030 </p>
2031 </div>
2032 <p>
2033 Like the internal subset, the external subset and any external
2034 parameter entities referenced in a
2035 <a href="#NT-DeclSep">DeclSep</a>
2036 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2037 consist of a series of complete markup declarations of the types
2038 allowed by the non-terminal symbol
2039 <a href="#NT-markupdecl">markupdecl</a>, interspersed with white
2040 space or
2041 <a title="Parameter-entity reference" href="#dt-PERef"
2042 >parameter-entity references</a
2043 >. However, portions of the contents of the external subset or of
2044 these external parameter entities may conditionally be ignored by
2045 using the
2046 <a title="conditional section" href="#dt-cond-section"
2047 >conditional section</a
2048 >
2049 construct; this is not allowed in the internal subset but is allowed
2050 in external parameter entities referenced in the internal subset.
2051 </p>
2052 <h5><a name="ext-Subset" id="ext-Subset" />External Subset</h5>
2053 <table class="scrap" summary="Scrap">
2054 <tbody>
2055 <tr valign="baseline">
2056 <td>
2057 <a
2058 name="NT-extSubset"
2059 id="NT-extSubset"
2060 />[30]&nbsp;&nbsp;&nbsp;
2061 </td>
2062 <td><code>extSubset</code></td>
2063 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2064 <td>
2065 <code>
2066 <a href="#NT-TextDecl">TextDecl</a>?
2067 <a href="#NT-extSubsetDecl">extSubsetDecl</a>
2068 </code>
2069 </td>
2070 </tr>
2071 <tr valign="baseline">
2072 <td>
2073 <a
2074 name="NT-extSubsetDecl"
2075 id="NT-extSubsetDecl"
2076 />[31]&nbsp;&nbsp;&nbsp;
2077 </td>
2078 <td><code>extSubsetDecl</code></td>
2079 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2080 <td>
2081 <code
2082 >( <a href="#NT-markupdecl">markupdecl</a> |
2083 <a href="#NT-conditionalSect">conditionalSect</a> |
2084 <a href="#NT-DeclSep">DeclSep</a>)*</code
2085 >
2086 </td>
2087 </tr>
2088 </tbody>
2089 </table>
2090 <p>
2091 The external subset and external parameter entities also differ from
2092 the internal subset in that in them,
2093 <a title="Parameter-entity reference" href="#dt-PERef"
2094 >parameter-entity references</a
2095 >
2096 are permitted <em>within</em> markup declarations, not only
2097 <em>between</em> markup declarations.
2098 </p>
2099 <p>An example of an XML document with a document type declaration:</p>
2100 <div class="exampleInner">
2101 <pre>
2102 &lt;?xml version="1.0"?&gt;
2103 &lt;!DOCTYPE greeting SYSTEM "hello.dtd"&gt;
2104 &lt;greeting&gt;Hello, world!&lt;/greeting&gt; </pre
2105 >
2106 </div>
2107 <p>
2108 The
2109 <a title="System Identifier" href="#dt-sysid">system identifier</a>
2110 "
2111 <code>hello.dtd</code>
2112 " gives the address (a URI reference) of a DTD for the document.
2113 </p>
2114 <p>The declarations can also be given locally, as in this example:</p>
2115 <div class="exampleInner">
2116 <pre>
2117 &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
2118 &lt;!DOCTYPE greeting [
2119 &lt;!ELEMENT greeting (#PCDATA)&gt;
2120 ]&gt;
2121 &lt;greeting&gt;Hello, world!&lt;/greeting&gt;</pre
2122 >
2123 </div>
2124 <p>
2125 If both the external and internal subsets are used, the internal
2126 subset
2127 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
2128 considered to occur before the external subset. This has the effect
2129 that entity and attribute-list declarations in the internal subset
2130 take precedence over those in the external subset.
2131 </p>
2132 </div>
2133 <div class="div2">
2134 <h3>
2135 <a name="sec-rmd" id="sec-rmd" />2.9 Standalone Document Declaration
2136 </h3>
2137 <p>
2138 Markup declarations can affect the content of the document, as
2139 passed from an
2140 <a title="XML Processor" href="#dt-xml-proc">XML processor</a> to an
2141 application; examples are attribute defaults and entity
2142 declarations. The standalone document declaration, which may appear
2143 as a component of the XML declaration, signals whether or not there
2144 are such declarations which appear external to the
2145 <a title="Document Entity" href="#dt-docent">document entity</a> or
2146 in parameter entities. [<a
2147 name="dt-extmkpdecl"
2148 id="dt-extmkpdecl"
2149 title="External Markup Declaration"
2150 >Definition</a
2151 >: An <b>external markup declaration</b> is defined as a markup
2152 declaration occurring in the external subset or in a parameter
2153 entity (external or internal, the latter being included because
2154 non-validating processors are not required to read them).]
2155 </p>
2156 <h5>
2157 <a name="fulldtd" id="fulldtd" />Standalone Document Declaration
2158 </h5>
2159 <table class="scrap" summary="Scrap">
2160 <tbody>
2161 <tr valign="baseline">
2162 <td>
2163 <a name="NT-SDDecl" id="NT-SDDecl" />[32]&nbsp;&nbsp;&nbsp;
2164 </td>
2165 <td><code>SDDecl</code></td>
2166 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2167 <td>
2168 <code>
2169 <a href="#NT-S">S</a> 'standalone'
2170 <a href="#NT-Eq">Eq</a> (("'" ('yes' | 'no') "'") | ('"'
2171 ('yes' | 'no') '"'))
2172 </code>
2173 </td>
2174 <td>
2175 <a href="#vc-check-rmd"
2176 >[VC: Standalone Document Declaration]</a
2177 >
2178 </td>
2179 </tr>
2180 </tbody>
2181 </table>
2182 <p>
2183 In a standalone document declaration, the value "yes" indicates that
2184 there are no
2185 <a title="External Markup Declaration" href="#dt-extmkpdecl"
2186 >external markup declarations</a
2187 >
2188 which affect the information passed from the XML processor to the
2189 application. The value "no" indicates that there are or may be such
2190 external markup declarations. Note that the standalone document
2191 declaration only denotes the presence of external
2192 <em>declarations</em>; the presence, in a document, of references to
2193 external <em>entities</em>, when those entities are internally
2194 declared, does not change its standalone status.
2195 </p>
2196 <p>
2197 If there are no external markup declarations, the standalone
2198 document declaration has no meaning. If there are external markup
2199 declarations but there is no standalone document declaration, the
2200 value "no" is assumed.
2201 </p>
2202 <p>
2203 Any XML document for which <code>standalone="no"</code> holds can be
2204 converted algorithmically to a standalone document, which may be
2205 desirable for some network delivery applications.
2206 </p>
2207 <div class="constraint">
2208 <p class="prefix">
2209 <a name="vc-check-rmd" id="vc-check-rmd" /><b
2210 >Validity constraint: Standalone Document Declaration</b
2211 >
2212 </p>
2213 <p>
2214 The standalone document declaration
2215 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2216 have the value "no" if any external markup declarations contain
2217 declarations of:
2218 </p>
2219 <ul>
2220 <li>
2221 <p>
2222 attributes with
2223 <a title="Attribute Default" href="#dt-default">default</a>
2224 values, if elements to which these attributes apply appear in
2225 the document without specifications of values for these
2226 attributes, or
2227 </p>
2228 </li>
2229 <li>
2230 <p>
2231 entities (other than <code>amp</code>, <code>lt</code>,
2232 <code>gt</code>, <code>apos</code>, <code>quot</code>), if
2233 <a title="Entity Reference" href="#dt-entref">references</a>
2234 to those entities appear in the document, or
2235 </p>
2236 </li>
2237 <li>
2238 <p>
2239 attributes with tokenized types, where the attribute appears
2240 in the document with a value such that
2241 <a href="#AVNormalize"><cite>normalization</cite></a>
2242 will produce a different value from that which would be
2243 produced in the absence of the declaration, or
2244 </p>
2245 </li>
2246 <li>
2247 <p>
2248 element types with
2249 <a title="Element content" href="#dt-elemcontent"
2250 >element content</a
2251 >, if white space occurs directly within any instance of those
2252 types.
2253 </p>
2254 </li>
2255 </ul>
2256 </div>
2257 <p>
2258 An example XML declaration with a standalone document declaration:
2259 </p>
2260 <div class="exampleInner">
2261 <pre>&lt;?xml version="1.0" standalone='yes'?&gt;</pre>
2262 </div>
2263 </div>
2264 <div class="div2">
2265 <h3>
2266 <a name="sec-white-space" id="sec-white-space" />2.10 White Space
2267 Handling
2268 </h3>
2269 <p>
2270 In editing XML documents, it is often convenient to use "white
2271 space" (spaces, tabs, and blank lines) to set apart the markup for
2272 greater readability. Such white space is typically not intended for
2273 inclusion in the delivered version of the document. On the other
2274 hand, "significant" white space that should be preserved in the
2275 delivered version is common, for example in poetry and source code.
2276 </p>
2277 <p>
2278 An <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
2279 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2280 always pass all characters in a document that are not markup through
2281 to the application. A
2282 <a title="Validating Processor" href="#dt-validating">
2283 validating XML processor</a
2284 >
2285 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2286 also inform the application which of these characters constitute
2287 white space appearing in
2288 <a title="Element content" href="#dt-elemcontent">element content</a
2289 >.
2290 </p>
2291 <p>
2292 A special <a title="Attribute" href="#dt-attr">attribute</a> named
2293 <code>xml:space</code> may be attached to an element to signal an
2294 intention that in that element, white space should be preserved by
2295 applications. In valid documents, this attribute, like any other,
2296 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
2297 <a title="Attribute-List Declaration" href="#dt-attdecl"
2298 >declared</a
2299 >
2300 if it is used. When declared, it
2301 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
2302 given as an
2303 <a title="Enumerated Attribute Values" href="#dt-enumerated"
2304 >enumerated type</a
2305 >
2306 whose values are one or both of "default" and "preserve". For
2307 example:
2308 </p>
2309 <div class="exampleInner">
2310 <pre>
2311 &lt;!ATTLIST poem xml:space (default|preserve) 'preserve'&gt;
2312
2313 &lt;!ATTLIST pre xml:space (preserve) #FIXED 'preserve'&gt;</pre
2314 >
2315 </div>
2316 <p>
2317 The value "default" signals that applications' default white-space
2318 processing modes are acceptable for this element; the value
2319 "preserve" indicates the intent that applications preserve all the
2320 white space. This declared intent is considered to apply to all
2321 elements within the content of the element where it is specified,
2322 unless overridden with another instance of the
2323 <code>xml:space</code> attribute. This specification does not give
2324 meaning to any value of <code>xml:space</code> other than "default"
2325 and "preserve". It is an error for other values to be specified; the
2326 XML processor
2327 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
2328 report the error or
2329 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
2330 recover by ignoring the attribute specification or by reporting the
2331 (erroneous) value to the application. Applications may ignore or
2332 reject erroneous values.
2333 </p>
2334 <p>
2335 The <a title="Root Element" href="#dt-root">root element</a> of any
2336 document is considered to have signaled no intentions as regards
2337 application space handling, unless it provides a value for this
2338 attribute or the attribute is declared with a default value.
2339 </p>
2340 </div>
2341 <div class="div2">
2342 <h3>
2343 <a name="sec-line-ends" id="sec-line-ends" />2.11 End-of-Line
2344 Handling
2345 </h3>
2346 <p>
2347 XML
2348 <a title="Text Entity" href="#dt-parsedent">parsed entities</a> are
2349 often stored in computer files which, for editing convenience, are
2350 organized into lines. These lines are typically separated by some
2351 combination of the characters CARRIAGE RETURN (#xD) and LINE FEED
2352 (#xA).
2353 </p>
2354 <p>
2355 To simplify the tasks of
2356 <a title="Application" href="#dt-app">applications</a>, the
2357 <a title="XML Processor" href="#dt-xml-proc">XML processor</a>
2358 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2359 behave as if it normalized all line breaks in external parsed
2360 entities (including the document entity) on input, before parsing,
2361 by translating both the two-character sequence #xD #xA and any #xD
2362 that is not followed by #xA to a single #xA character.
2363 </p>
2364 </div>
2365 <div class="div2">
2366 <h3>
2367 <a name="sec-lang-tag" id="sec-lang-tag" />2.12 Language
2368 Identification
2369 </h3>
2370 <p>
2371 In document processing, it is often useful to identify the natural
2372 or formal language in which the content is written. A special
2373 <a title="Attribute" href="#dt-attr">attribute</a> named
2374 <code>xml:lang</code> may be inserted in documents to specify the
2375 language used in the contents and attribute values of any element in
2376 an XML document. In valid documents, this attribute, like any other,
2377 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
2378 <a title="Attribute-List Declaration" href="#dt-attdecl"
2379 >declared</a
2380 >
2381 if it is used. The values of the attribute are language identifiers
2382 as defined by <a href="#RFC1766">[IETF BCP 47]</a>,
2383 <cite>Tags for the Identification of Languages</cite>; in addition,
2384 the empty string may be specified.
2385 </p>
2386 <p>(Productions 33 through 38 have been removed.)</p>
2387 <p>For example:</p>
2388 <div class="exampleInner">
2389 <pre>
2390 &lt;p xml:lang="en"&gt;The quick brown fox jumps over the lazy dog.&lt;/p&gt;
2391 &lt;p xml:lang="en-GB"&gt;What colour is it?&lt;/p&gt;
2392 &lt;p xml:lang="en-US"&gt;What color is it?&lt;/p&gt;
2393 &lt;sp who="Faust" desc='leise' xml:lang="de"&gt;
2394 &lt;l&gt;Habe nun, ach! Philosophie,&lt;/l&gt;
2395 &lt;l&gt;Juristerei, und Medizin&lt;/l&gt;
2396 &lt;l&gt;und leider auch Theologie&lt;/l&gt;
2397 &lt;l&gt;durchaus studiert mit heißem Bemüh'n.&lt;/l&gt;
2398 &lt;/sp&gt;</pre
2399 >
2400 </div>
2401 <p>
2402 The language specified by <code>xml:lang</code> applies to the
2403 element where it is specified (including the values of its
2404 attributes), and to all elements in its content unless overridden
2405 with another instance of <code>xml:lang</code>. In particular, the
2406 empty value of <code>xml:lang</code> is used on an element B to
2407 override a specification of <code>xml:lang</code> on an enclosing
2408 element A, without specifying another language. Within B, it is
2409 considered that there is no language information available, just as
2410 if <code>xml:lang</code> had not been specified on B or any of its
2411 ancestors. Applications determine which of an element's attribute
2412 values and which parts of its character content, if any, are treated
2413 as language-dependent values described by <code>xml:lang</code>.
2414 </p>
2415 <div class="note">
2416 <p class="prefix"><b>Note:</b></p>
2417 <p>
2418 Language information may also be provided by external transport
2419 protocols (e.g. HTTP or MIME). When available, this information
2420 may be used by XML applications, but the more local information
2421 provided by <code>xml:lang</code> should be considered to override
2422 it.
2423 </p>
2424 </div>
2425 <p>
2426 A simple declaration for <code>xml:lang</code> might take the form
2427 </p>
2428 <div class="exampleInner"><pre>xml:lang CDATA #IMPLIED</pre></div>
2429 <p>
2430 but specific default values may also be given, if appropriate. In a
2431 collection of French poems for English students, with glosses and
2432 notes in English, the <code>xml:lang</code> attribute might be
2433 declared this way:
2434 </p>
2435 <div class="exampleInner">
2436 <pre>
2437 &lt;!ATTLIST poem xml:lang CDATA 'fr'&gt;
2438 &lt;!ATTLIST gloss xml:lang CDATA 'en'&gt;
2439 &lt;!ATTLIST note xml:lang CDATA 'en'&gt;</pre
2440 >
2441 </div>
2442 </div>
2443 </div>
2444 <div class="div1">
2445 <h2>
2446 <a name="sec-logical-struct" id="sec-logical-struct" />3 Logical
2447 Structures
2448 </h2>
2449 <p>
2450 [<a name="dt-element" id="dt-element" title="Element">Definition</a>:
2451 Each
2452 <a title="XML Document" href="#dt-xml-doc">XML document</a> contains
2453 one or more <b>elements</b>, the boundaries of which are either
2454 delimited by <a title="Start-Tag" href="#dt-stag">start-tags</a> and
2455 <a title="End Tag" href="#dt-etag">end-tags</a>, or, for
2456 <a title="Empty" href="#dt-empty">empty</a> elements, by an
2457 <a title="empty-element tag" href="#dt-eetag">empty-element tag</a>.
2458 Each element has a type, identified by name, sometimes called its
2459 "generic identifier" (GI), and may have a set of attribute
2460 specifications.] Each attribute specification has a
2461 <a title="Attribute Name" href="#dt-attrname">name</a> and a
2462 <a title="Attribute Value" href="#dt-attrval">value</a>.
2463 </p>
2464 <h5><a name="d0e2130" id="d0e2130" />Element</h5>
2465 <table class="scrap" summary="Scrap">
2466 <tbody>
2467 <tr valign="baseline">
2468 <td>
2469 <a name="NT-element" id="NT-element" />[39]&nbsp;&nbsp;&nbsp;
2470 </td>
2471 <td><code>element</code></td>
2472 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2473 <td>
2474 <code>
2475 <a href="#NT-EmptyElemTag">EmptyElemTag</a>
2476 </code>
2477 </td>
2478 </tr>
2479 <tr valign="baseline">
2480 <td />
2481 <td />
2482 <td />
2483 <td>
2484 <code
2485 >| <a href="#NT-STag">STag</a>
2486 <a href="#NT-content">content</a>
2487 <a href="#NT-ETag">ETag</a>
2488 </code>
2489 </td>
2490 <td><a href="#GIMatch">[WFC: Element Type Match]</a></td>
2491 </tr>
2492 <tr valign="baseline">
2493 <td />
2494 <td />
2495 <td />
2496 <td />
2497 <td><a href="#elementvalid">[VC: Element Valid]</a></td>
2498 </tr>
2499 </tbody>
2500 </table>
2501 <p>
2502 This specification does not constrain the application semantics, use,
2503 or (beyond syntax) names of the element types and attributes, except
2504 that names beginning with a match to
2505 <code>(('X'|'x')('M'|'m')('L'|'l'))</code> are reserved for
2506 standardization in this or future versions of this specification.
2507 </p>
2508 <div class="constraint">
2509 <p class="prefix">
2510 <a name="GIMatch" id="GIMatch" /><b
2511 >Well-formedness constraint: Element Type Match</b
2512 >
2513 </p>
2514 <p>
2515 The <a href="#NT-Name">Name</a> in an element's end-tag
2516 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2517 match the element type in the start-tag.
2518 </p>
2519 </div>
2520 <div class="constraint">
2521 <p class="prefix">
2522 <a name="elementvalid" id="elementvalid" /><b
2523 >Validity constraint: Element Valid</b
2524 >
2525 </p>
2526 <p>
2527 An element is valid if there is a declaration matching
2528 <a href="#NT-elementdecl">elementdecl</a> where the
2529 <a href="#NT-Name">Name</a> matches the element type, and one of the
2530 following holds:
2531 </p>
2532 <ol class="enumar">
2533 <li>
2534 <p>
2535 The declaration matches <b>EMPTY</b> and the element has no
2536 <a title="Content" href="#dt-content">content</a> (not even
2537 entity references, comments, PIs or white space).
2538 </p>
2539 </li>
2540 <li>
2541 <p>
2542 The declaration matches <a href="#NT-children">children</a> and
2543 the sequence of
2544 <a title="Parent/Child" href="#dt-parentchild"
2545 >child elements</a
2546 >
2547 belongs to the language generated by the regular expression in
2548 the content model, with optional white space, comments and PIs
2549 (i.e. markup matching production [27]
2550 <a href="#NT-Misc">Misc</a>) between the start-tag and the first
2551 child element, between child elements, or between the last child
2552 element and the end-tag. Note that a CDATA section containing
2553 only white space or a reference to an entity whose replacement
2554 text is character references expanding to white space do not
2555 match the nonterminal <a href="#NT-S">S</a>, and hence cannot
2556 appear in these positions; however, a reference to an internal
2557 entity with a literal value consisting of character references
2558 expanding to white space does match <a href="#NT-S">S</a>, since
2559 its replacement text is the white space resulting from expansion
2560 of the character references.
2561 </p>
2562 </li>
2563 <li>
2564 <p>
2565 The declaration matches <a href="#NT-Mixed">Mixed</a>, and the
2566 content (after replacing any entity references with their
2567 replacement text) consists of
2568 <a title="Character Data" href="#dt-chardata">character data</a>
2569 (including
2570 <a title="CDATA Section" href="#dt-cdsection">CDATA sections</a
2571 >), <a title="Comment" href="#dt-comment">comments</a>,
2572 <a title="Processing instruction" href="#dt-pi">PIs</a> and
2573 <a title="Parent/Child" href="#dt-parentchild"
2574 >child elements</a
2575 >
2576 whose types match names in the content model.
2577 </p>
2578 </li>
2579 <li>
2580 <p>
2581 The declaration matches <b>ANY</b>, and the content (after
2582 replacing any entity references with their replacement text)
2583 consists of character data,
2584 <a title="CDATA Section" href="#dt-cdsection">CDATA sections</a
2585 >, <a title="Comment" href="#dt-comment">comments</a>,
2586 <a title="Processing instruction" href="#dt-pi">PIs</a> and
2587 <a title="Parent/Child" href="#dt-parentchild"
2588 >child elements</a
2589 >
2590 whose types have been declared.
2591 </p>
2592 </li>
2593 </ol>
2594 </div>
2595 <div class="div2">
2596 <h3>
2597 <a name="sec-starttags" id="sec-starttags" />3.1 Start-Tags,
2598 End-Tags, and Empty-Element Tags
2599 </h3>
2600 <p>
2601 [<a name="dt-stag" id="dt-stag" title="Start-Tag">Definition</a>:
2602 The beginning of every non-empty XML element is marked by a
2603 <b>start-tag</b>.]
2604 </p>
2605 <h5><a name="d0e2259" id="d0e2259" />Start-tag</h5>
2606 <table class="scrap" summary="Scrap">
2607 <tbody>
2608 <tr valign="baseline">
2609 <td><a name="NT-STag" id="NT-STag" />[40]&nbsp;&nbsp;&nbsp;</td>
2610 <td><code>STag</code></td>
2611 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2612 <td>
2613 <code
2614 >'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a>
2615 <a href="#NT-Attribute">Attribute</a>)*
2616 <a href="#NT-S">S</a>? '&gt;'</code
2617 >
2618 </td>
2619 <td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td>
2620 </tr>
2621 <tr valign="baseline">
2622 <td>
2623 <a
2624 name="NT-Attribute"
2625 id="NT-Attribute"
2626 />[41]&nbsp;&nbsp;&nbsp;
2627 </td>
2628 <td><code>Attribute</code></td>
2629 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2630 <td>
2631 <code>
2632 <a href="#NT-Name">Name</a>
2633 <a href="#NT-Eq">Eq</a>
2634 <a href="#NT-AttValue">AttValue</a>
2635 </code>
2636 </td>
2637 <td><a href="#ValueType">[VC: Attribute Value Type]</a></td>
2638 </tr>
2639 <tr valign="baseline">
2640 <td />
2641 <td />
2642 <td />
2643 <td />
2644 <td>
2645 <a href="#NoExternalRefs"
2646 >[WFC: No External Entity References]</a
2647 >
2648 </td>
2649 </tr>
2650 <tr valign="baseline">
2651 <td />
2652 <td />
2653 <td />
2654 <td />
2655 <td>
2656 <a href="#CleanAttrVals"
2657 >[WFC: No &lt; in Attribute Values]</a
2658 >
2659 </td>
2660 </tr>
2661 </tbody>
2662 </table>
2663 <p>
2664 The <a href="#NT-Name">Name</a> in the start- and end-tags gives the
2665 element's <b>type</b>. [<a
2666 name="dt-attr"
2667 id="dt-attr"
2668 title="Attribute"
2669 >Definition</a
2670 >: The <a href="#NT-Name">Name</a>-<a href="#NT-AttValue"
2671 >AttValue</a
2672 >
2673 pairs are referred to as the <b>attribute specifications</b> of the
2674 element], [<a
2675 name="dt-attrname"
2676 id="dt-attrname"
2677 title="Attribute Name"
2678 >Definition</a
2679 >: with the <a href="#NT-Name">Name</a> in each pair referred to as
2680 the <b>attribute name</b> ] and [<a
2681 name="dt-attrval"
2682 id="dt-attrval"
2683 title="Attribute Value"
2684 >Definition</a
2685 >: the content of the <a href="#NT-AttValue">AttValue</a> (the text
2686 between the <code>'</code> or <code>"</code> delimiters) as the
2687 <b>attribute value</b>.] Note that the order of attribute
2688 specifications in a start-tag or empty-element tag is not
2689 significant.
2690 </p>
2691 <div class="constraint">
2692 <p class="prefix">
2693 <a name="uniqattspec" id="uniqattspec" /><b
2694 >Well-formedness constraint: Unique Att Spec</b
2695 >
2696 </p>
2697 <p>
2698 An attribute name
2699 <em class="rfc2119" title="Keyword in RFC 2119 context"
2700 >MUST NOT</em
2701 >
2702 appear more than once in the same start-tag or empty-element tag.
2703 </p>
2704 </div>
2705 <div class="constraint">
2706 <p class="prefix">
2707 <a name="ValueType" id="ValueType" /><b
2708 >Validity constraint: Attribute Value Type</b
2709 >
2710 </p>
2711 <p>
2712 The attribute
2713 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2714 have been declared; the value
2715 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2716 be of the type declared for it. (For attribute types, see
2717 <a href="#attdecls"><b>3.3 Attribute-List Declarations</b></a
2718 >.)
2719 </p>
2720 </div>
2721 <div class="constraint">
2722 <p class="prefix">
2723 <a name="NoExternalRefs" id="NoExternalRefs" /><b
2724 >Well-formedness constraint: No External Entity References</b
2725 >
2726 </p>
2727 <p>
2728 Attribute values
2729 <em class="rfc2119" title="Keyword in RFC 2119 context"
2730 >MUST NOT</em
2731 >
2732 contain direct or indirect entity references to external entities.
2733 </p>
2734 </div>
2735 <div class="constraint">
2736 <p class="prefix">
2737 <a name="CleanAttrVals" id="CleanAttrVals" /><b
2738 >Well-formedness constraint: No <code>&lt;</code> in Attribute
2739 Values</b
2740 >
2741 </p>
2742 <p>
2743 The
2744 <a title="Replacement Text" href="#dt-repltext"
2745 >replacement text</a
2746 >
2747 of any entity referred to directly or indirectly in an attribute
2748 value
2749 <em class="rfc2119" title="Keyword in RFC 2119 context"
2750 >MUST NOT</em
2751 >
2752 contain a <code>&lt;</code>.
2753 </p>
2754 </div>
2755 <p>An example of a start-tag:</p>
2756 <div class="exampleInner">
2757 <pre>&lt;termdef id="dt-dog" term="dog"&gt;</pre>
2758 </div>
2759 <p>
2760 [<a name="dt-etag" id="dt-etag" title="End Tag">Definition</a>: The
2761 end of every element that begins with a start-tag
2762 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
2763 marked by an <b>end-tag</b> containing a name that echoes the
2764 element's type as given in the start-tag:]
2765 </p>
2766 <h5><a name="d0e2403" id="d0e2403" />End-tag</h5>
2767 <table class="scrap" summary="Scrap">
2768 <tbody>
2769 <tr valign="baseline">
2770 <td><a name="NT-ETag" id="NT-ETag" />[42]&nbsp;&nbsp;&nbsp;</td>
2771 <td><code>ETag</code></td>
2772 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2773 <td>
2774 <code
2775 >'&lt;/' <a href="#NT-Name">Name</a> <a href="#NT-S">S</a>?
2776 '&gt;'</code
2777 >
2778 </td>
2779 </tr>
2780 </tbody>
2781 </table>
2782 <p>An example of an end-tag:</p>
2783 <div class="exampleInner"><pre>&lt;/termdef&gt;</pre></div>
2784 <p>
2785 [<a name="dt-content" id="dt-content" title="Content">Definition</a
2786 >: The <a title="Text" href="#dt-text">text</a> between the
2787 start-tag and end-tag is called the element's <b>content</b>:]
2788 </p>
2789 <h5><a name="d0e2433" id="d0e2433" />Content of Elements</h5>
2790 <table class="scrap" summary="Scrap">
2791 <tbody>
2792 <tr valign="baseline">
2793 <td>
2794 <a name="NT-content" id="NT-content" />[43]&nbsp;&nbsp;&nbsp;
2795 </td>
2796 <td><code>content</code></td>
2797 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2798 <td>
2799 <code>
2800 <a href="#NT-CharData">CharData</a>? ((<a href="#NT-element"
2801 >element</a
2802 >
2803 | <a href="#NT-Reference">Reference</a> |
2804 <a href="#NT-CDSect">CDSect</a> | <a href="#NT-PI">PI</a> |
2805 <a href="#NT-Comment">Comment</a>)
2806 <a href="#NT-CharData">CharData</a>?)*</code
2807 >
2808 </td>
2809 </tr>
2810 </tbody>
2811 </table>
2812 <p>
2813 [<a name="dt-empty" id="dt-empty" title="Empty">Definition</a>: An
2814 element with no <a href="#NT-content">content</a> is said to be
2815 <b>empty</b>.] The representation of an empty element is either a
2816 start-tag immediately followed by an end-tag, or an empty-element
2817 tag. [<a name="dt-eetag" id="dt-eetag" title="empty-element tag"
2818 >Definition</a
2819 >: An <b>empty-element tag</b> takes a special form:]
2820 </p>
2821 <h5><a name="d0e2480" id="d0e2480" />Tags for Empty Elements</h5>
2822 <table class="scrap" summary="Scrap">
2823 <tbody>
2824 <tr valign="baseline">
2825 <td>
2826 <a
2827 name="NT-EmptyElemTag"
2828 id="NT-EmptyElemTag"
2829 />[44]&nbsp;&nbsp;&nbsp;
2830 </td>
2831 <td><code>EmptyElemTag</code></td>
2832 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2833 <td>
2834 <code
2835 >'&lt;' <a href="#NT-Name">Name</a> (<a href="#NT-S">S</a>
2836 <a href="#NT-Attribute">Attribute</a>)*
2837 <a href="#NT-S">S</a>? '/&gt;'</code
2838 >
2839 </td>
2840 <td><a href="#uniqattspec">[WFC: Unique Att Spec]</a></td>
2841 </tr>
2842 </tbody>
2843 </table>
2844 <p>
2845 Empty-element tags may be used for any element which has no content,
2846 whether or not it is declared using the keyword <b>EMPTY</b>.
2847 <a title="For interoperability" href="#dt-interop"
2848 >For interoperability</a
2849 >, the empty-element tag
2850 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>
2851 be used, and
2852 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>
2853 only be used, for elements which are declared EMPTY.
2854 </p>
2855 <p>Examples of empty elements:</p>
2856 <div class="exampleInner">
2857 <pre>
2858 &lt;IMG align="left"
2859 src="http://www.w3.org/Icons/WWW/w3c_home" /&gt;
2860 &lt;br&gt;&lt;/br&gt;
2861 &lt;br/&gt;</pre
2862 >
2863 </div>
2864 </div>
2865 <div class="div2">
2866 <h3>
2867 <a name="elemdecls" id="elemdecls" />3.2 Element Type Declarations
2868 </h3>
2869 <p>
2870 The <a title="Element" href="#dt-element">element</a> structure of
2871 an <a title="XML Document" href="#dt-xml-doc">XML document</a> may,
2872 for <a title="Validity" href="#dt-valid">validation</a> purposes, be
2873 constrained using element type and attribute-list declarations. An
2874 element type declaration constrains the element's
2875 <a title="Content" href="#dt-content">content</a>.
2876 </p>
2877 <p>
2878 Element type declarations often constrain which element types can
2879 appear as
2880 <a title="Parent/Child" href="#dt-parentchild">children</a> of the
2881 element. At user option, an XML processor
2882 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
2883 issue a warning when a declaration mentions an element type for
2884 which no declaration is provided, but this is not an error.
2885 </p>
2886 <p>
2887 [<a name="dt-eldecl" id="dt-eldecl" title="Element Type declaration"
2888 >Definition</a
2889 >: An <b>element type declaration</b> takes the form:]
2890 </p>
2891 <h5><a name="d0e2553" id="d0e2553" />Element Type Declaration</h5>
2892 <table class="scrap" summary="Scrap">
2893 <tbody>
2894 <tr valign="baseline">
2895 <td>
2896 <a
2897 name="NT-elementdecl"
2898 id="NT-elementdecl"
2899 />[45]&nbsp;&nbsp;&nbsp;
2900 </td>
2901 <td><code>elementdecl</code></td>
2902 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2903 <td>
2904 <code
2905 >'&lt;!ELEMENT' <a href="#NT-S">S</a>
2906 <a href="#NT-Name">Name</a>
2907 <a href="#NT-S">S</a>
2908 <a href="#NT-contentspec">contentspec</a>
2909 <a href="#NT-S">S</a>? '&gt;'</code
2910 >
2911 </td>
2912 <td>
2913 <a href="#EDUnique">[VC: Unique Element Type Declaration]</a>
2914 </td>
2915 </tr>
2916 <tr valign="baseline">
2917 <td>
2918 <a
2919 name="NT-contentspec"
2920 id="NT-contentspec"
2921 />[46]&nbsp;&nbsp;&nbsp;
2922 </td>
2923 <td><code>contentspec</code></td>
2924 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
2925 <td>
2926 <code
2927 >'EMPTY' | 'ANY' | <a href="#NT-Mixed">Mixed</a> |
2928 <a href="#NT-children">children</a>
2929 </code>
2930 </td>
2931 </tr>
2932 </tbody>
2933 </table>
2934 <p>
2935 where the <a href="#NT-Name">Name</a> gives the element type being
2936 declared.
2937 </p>
2938 <div class="constraint">
2939 <p class="prefix">
2940 <a name="EDUnique" id="EDUnique" /><b
2941 >Validity constraint: Unique Element Type Declaration</b
2942 >
2943 </p>
2944 <p>
2945 An element type
2946 <em class="rfc2119" title="Keyword in RFC 2119 context"
2947 >MUST NOT</em
2948 >
2949 be declared more than once.
2950 </p>
2951 </div>
2952 <p>Examples of element type declarations:</p>
2953 <div class="exampleInner">
2954 <pre>
2955 &lt;!ELEMENT br EMPTY&gt;
2956 &lt;!ELEMENT p (#PCDATA|emph)* &gt;
2957 &lt;!ELEMENT %name.para; %content.para; &gt;
2958 &lt;!ELEMENT container ANY&gt;</pre
2959 >
2960 </div>
2961 <div class="div3">
2962 <h4>
2963 <a name="sec-element-content" id="sec-element-content" />3.2.1
2964 Element Content
2965 </h4>
2966 <p>
2967 [<a
2968 name="dt-elemcontent"
2969 id="dt-elemcontent"
2970 title="Element content"
2971 >Definition</a
2972 >: An element <a title="Start-Tag" href="#dt-stag">type</a> has
2973 <b>element content</b> when elements of that type
2974 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
2975 contain only
2976 <a title="Parent/Child" href="#dt-parentchild">child</a> elements
2977 (no character data), optionally separated by white space
2978 (characters matching the nonterminal <a href="#NT-S">S</a>).] [<a
2979 name="dt-content-model"
2980 id="dt-content-model"
2981 title="Content model"
2982 >Definition</a
2983 >: In this case, the constraint includes a <b>content model</b>, a
2984 simple grammar governing the allowed types of the child elements
2985 and the order in which they are allowed to appear.] The grammar is
2986 built on content particles (<a href="#NT-cp">cp</a>s), which
2987 consist of names, choice lists of content particles, or sequence
2988 lists of content particles:
2989 </p>
2990 <h5><a name="d0e2638" id="d0e2638" />Element-content Models</h5>
2991 <table class="scrap" summary="Scrap">
2992 <tbody>
2993 <tr valign="baseline">
2994 <td>
2995 <a
2996 name="NT-children"
2997 id="NT-children"
2998 />[47]&nbsp;&nbsp;&nbsp;
2999 </td>
3000 <td><code>children</code></td>
3001 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3002 <td>
3003 <code
3004 >(<a href="#NT-choice">choice</a> |
3005 <a href="#NT-seq">seq</a>) ('?' | '*' | '+')?</code
3006 >
3007 </td>
3008 </tr>
3009 <tr valign="baseline">
3010 <td><a name="NT-cp" id="NT-cp" />[48]&nbsp;&nbsp;&nbsp;</td>
3011 <td><code>cp</code></td>
3012 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3013 <td>
3014 <code
3015 >(<a href="#NT-Name">Name</a> |
3016 <a href="#NT-choice">choice</a> |
3017 <a href="#NT-seq">seq</a>) ('?' | '*' | '+')?</code
3018 >
3019 </td>
3020 </tr>
3021 <tr valign="baseline">
3022 <td>
3023 <a name="NT-choice" id="NT-choice" />[49]&nbsp;&nbsp;&nbsp;
3024 </td>
3025 <td><code>choice</code></td>
3026 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3027 <td>
3028 <code
3029 >'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> (
3030 <a href="#NT-S">S</a>? '|' <a href="#NT-S">S</a>?
3031 <a href="#NT-cp">cp</a> )+ <a href="#NT-S">S</a>?
3032 ')'</code
3033 >
3034 </td>
3035 <td>
3036 <a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a>
3037 </td>
3038 </tr>
3039 <tr valign="baseline">
3040 <td><a name="NT-seq" id="NT-seq" />[50]&nbsp;&nbsp;&nbsp;</td>
3041 <td><code>seq</code></td>
3042 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3043 <td>
3044 <code
3045 >'(' <a href="#NT-S">S</a>? <a href="#NT-cp">cp</a> (
3046 <a href="#NT-S">S</a>? ',' <a href="#NT-S">S</a>?
3047 <a href="#NT-cp">cp</a> )* <a href="#NT-S">S</a>?
3048 ')'</code
3049 >
3050 </td>
3051 <td>
3052 <a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a>
3053 </td>
3054 </tr>
3055 </tbody>
3056 </table>
3057 <p>
3058 where each <a href="#NT-Name">Name</a> is the type of an element
3059 which may appear as a
3060 <a title="Parent/Child" href="#dt-parentchild">child</a>. Any
3061 content particle in a choice list may appear in the
3062 <a title="Element content" href="#dt-elemcontent"
3063 >element content</a
3064 >
3065 at the location where the choice list appears in the grammar;
3066 content particles occurring in a sequence list
3067 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3068 each appear in the
3069 <a title="Element content" href="#dt-elemcontent"
3070 >element content</a
3071 >
3072 in the order given in the list. The optional character following a
3073 name or list governs whether the element or the content particles
3074 in the list may occur one or more (<code>+</code>), zero or more
3075 (<code>*</code>), or zero or one times (<code>?</code>). The
3076 absence of such an operator means that the element or content
3077 particle
3078 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3079 appear exactly once. This syntax and meaning are identical to
3080 those used in the productions in this specification.
3081 </p>
3082 <p>
3083 The content of an element matches a content model if and only if
3084 it is possible to trace out a path through the content model,
3085 obeying the sequence, choice, and repetition operators and
3086 matching each element in the content against an element type in
3087 the content model.
3088 <a title="For Compatibility" href="#dt-compat"
3089 >For compatibility</a
3090 >, it is an error if the content model allows an element to match
3091 more than one occurrence of an element type in the content model.
3092 For more information, see
3093 <a href="#determinism"><b>E Deterministic Content Models</b></a
3094 >.
3095 </p>
3096 <div class="constraint">
3097 <p class="prefix">
3098 <a name="vc-PEinGroup" id="vc-PEinGroup" /><b
3099 >Validity constraint: Proper Group/PE Nesting</b
3100 >
3101 </p>
3102 <p>
3103 Parameter-entity
3104 <a title="Replacement Text" href="#dt-repltext"
3105 >replacement text</a
3106 >
3107 <em class="rfc2119" title="Keyword in RFC 2119 context"
3108 >MUST</em
3109 >
3110 be properly nested with parenthesized groups. That is to say, if
3111 either of the opening or closing parentheses in a
3112 <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or
3113 <a href="#NT-Mixed">Mixed</a> construct is contained in the
3114 replacement text for a
3115 <a title="Parameter-entity reference" href="#dt-PERef"
3116 >parameter entity</a
3117 >, both
3118 <em class="rfc2119" title="Keyword in RFC 2119 context"
3119 >MUST</em
3120 >
3121 be contained in the same replacement text.
3122 </p>
3123 <p>
3124 <a title="For interoperability" href="#dt-interop"
3125 >For interoperability</a
3126 >, if a parameter-entity reference appears in a
3127 <a href="#NT-choice">choice</a>, <a href="#NT-seq">seq</a>, or
3128 <a href="#NT-Mixed">Mixed</a> construct, its replacement text
3129 <em class="rfc2119" title="Keyword in RFC 2119 context"
3130 >SHOULD</em
3131 >
3132 contain at least one non-blank character, and neither the first
3133 nor last non-blank character of the replacement text
3134 <em class="rfc2119" title="Keyword in RFC 2119 context"
3135 >SHOULD</em
3136 >
3137 be a connector (<code>|</code> or <code>,</code>).
3138 </p>
3139 </div>
3140 <p>Examples of element-content models:</p>
3141 <div class="exampleInner">
3142 <pre>
3143 &lt;!ELEMENT spec (front, body, back?)&gt;
3144 &lt;!ELEMENT div1 (head, (p | list | note)*, div2*)&gt;
3145 &lt;!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*&gt;</pre
3146 >
3147 </div>
3148 </div>
3149 <div class="div3">
3150 <h4>
3151 <a name="sec-mixed-content" id="sec-mixed-content" />3.2.2 Mixed
3152 Content
3153 </h4>
3154 <p>
3155 [<a name="dt-mixed" id="dt-mixed" title="Mixed Content"
3156 >Definition</a
3157 >: An element <a title="Start-Tag" href="#dt-stag">type</a> has
3158 <b>mixed content</b> when elements of that type may contain
3159 character data, optionally interspersed with
3160 <a title="Parent/Child" href="#dt-parentchild">child</a>
3161 elements.] In this case, the types of the child elements may be
3162 constrained, but not their order or their number of occurrences:
3163 </p>
3164 <h5><a name="d0e2826" id="d0e2826" />Mixed-content Declaration</h5>
3165 <table class="scrap" summary="Scrap">
3166 <tbody>
3167 <tr valign="baseline">
3168 <td>
3169 <a name="NT-Mixed" id="NT-Mixed" />[51]&nbsp;&nbsp;&nbsp;
3170 </td>
3171 <td><code>Mixed</code></td>
3172 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3173 <td>
3174 <code
3175 >'(' <a href="#NT-S">S</a>? '#PCDATA' (<a href="#NT-S"
3176 >S</a
3177 >? '|' <a href="#NT-S">S</a>?
3178 <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>? ')*'
3179 </code>
3180 </td>
3181 </tr>
3182 <tr valign="baseline">
3183 <td />
3184 <td />
3185 <td />
3186 <td>
3187 <code
3188 >| '(' <a href="#NT-S">S</a>? '#PCDATA'
3189 <a href="#NT-S">S</a>? ')'
3190 </code>
3191 </td>
3192 <td>
3193 <a href="#vc-PEinGroup">[VC: Proper Group/PE Nesting]</a>
3194 </td>
3195 </tr>
3196 <tr valign="baseline">
3197 <td />
3198 <td />
3199 <td />
3200 <td />
3201 <td>
3202 <a href="#vc-MixedChildrenUnique"
3203 >[VC: No Duplicate Types]</a
3204 >
3205 </td>
3206 </tr>
3207 </tbody>
3208 </table>
3209 <p>
3210 where the <a href="#NT-Name">Name</a>s give the types of elements
3211 that may appear as children. The keyword <b>#PCDATA</b> derives
3212 historically from the term "parsed character data."
3213 </p>
3214 <div class="constraint">
3215 <p class="prefix">
3216 <a
3217 name="vc-MixedChildrenUnique"
3218 id="vc-MixedChildrenUnique"
3219 /><b>Validity constraint: No Duplicate Types</b>
3220 </p>
3221 <p>
3222 The same name
3223 <em class="rfc2119" title="Keyword in RFC 2119 context"
3224 >MUST NOT</em
3225 >
3226 appear more than once in a single mixed-content declaration.
3227 </p>
3228 </div>
3229 <p>Examples of mixed content declarations:</p>
3230 <div class="exampleInner">
3231 <pre>
3232 &lt;!ELEMENT p (#PCDATA|a|ul|b|i|em)*&gt;
3233 &lt;!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* &gt;
3234 &lt;!ELEMENT b (#PCDATA)&gt;</pre
3235 >
3236 </div>
3237 </div>
3238 </div>
3239 <div class="div2">
3240 <h3>
3241 <a name="attdecls" id="attdecls" />3.3 Attribute-List Declarations
3242 </h3>
3243 <p>
3244 <a title="Attribute" href="#dt-attr">Attributes</a> are used to
3245 associate name-value pairs with
3246 <a title="Element" href="#dt-element">elements</a>. Attribute
3247 specifications
3248 <em class="rfc2119" title="Keyword in RFC 2119 context"
3249 >MUST NOT</em
3250 >
3251 appear outside of
3252 <a title="Start-Tag" href="#dt-stag">start-tags</a> and
3253 <a title="empty-element tag" href="#dt-eetag">empty-element tags</a
3254 >; thus, the productions used to recognize them appear in
3255 <a href="#sec-starttags"
3256 ><b>3.1 Start-Tags, End-Tags, and Empty-Element Tags</b></a
3257 >. Attribute-list declarations may be used:
3258 </p>
3259 <ul>
3260 <li>
3261 <p>
3262 To define the set of attributes pertaining to a given element
3263 type.
3264 </p>
3265 </li>
3266 <li><p>To establish type constraints for these attributes.</p></li>
3267 <li>
3268 <p>
3269 To provide
3270 <a title="Attribute Default" href="#dt-default"
3271 >default values</a
3272 >
3273 for attributes.
3274 </p>
3275 </li>
3276 </ul>
3277 <p>
3278 [<a
3279 name="dt-attdecl"
3280 id="dt-attdecl"
3281 title="Attribute-List Declaration"
3282 >Definition</a
3283 >: <b>Attribute-list declarations</b> specify the name, data type,
3284 and default value (if any) of each attribute associated with a given
3285 element type:]
3286 </p>
3287 <h5><a name="d0e2926" id="d0e2926" />Attribute-list Declaration</h5>
3288 <table class="scrap" summary="Scrap">
3289 <tbody>
3290 <tr valign="baseline">
3291 <td>
3292 <a
3293 name="NT-AttlistDecl"
3294 id="NT-AttlistDecl"
3295 />[52]&nbsp;&nbsp;&nbsp;
3296 </td>
3297 <td><code>AttlistDecl</code></td>
3298 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3299 <td>
3300 <code
3301 >'&lt;!ATTLIST' <a href="#NT-S">S</a>
3302 <a href="#NT-Name">Name</a>
3303 <a href="#NT-AttDef">AttDef</a>* <a href="#NT-S">S</a>?
3304 '&gt;'</code
3305 >
3306 </td>
3307 </tr>
3308 </tbody>
3309 <tbody>
3310 <tr valign="baseline">
3311 <td>
3312 <a name="NT-AttDef" id="NT-AttDef" />[53]&nbsp;&nbsp;&nbsp;
3313 </td>
3314 <td><code>AttDef</code></td>
3315 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3316 <td>
3317 <code>
3318 <a href="#NT-S">S</a>
3319 <a href="#NT-Name">Name</a>
3320 <a href="#NT-S">S</a>
3321 <a href="#NT-AttType">AttType</a>
3322 <a href="#NT-S">S</a>
3323 <a href="#NT-DefaultDecl">DefaultDecl</a>
3324 </code>
3325 </td>
3326 </tr>
3327 </tbody>
3328 </table>
3329 <p>
3330 The <a href="#NT-Name">Name</a> in the
3331 <a href="#NT-AttlistDecl">AttlistDecl</a> rule is the type of an
3332 element. At user option, an XML processor
3333 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
3334 issue a warning if attributes are declared for an element type not
3335 itself declared, but this is not an error. The
3336 <a href="#NT-Name">Name</a> in the
3337 <a href="#NT-AttDef">AttDef</a> rule is the name of the attribute.
3338 </p>
3339 <p>
3340 When more than one <a href="#NT-AttlistDecl">AttlistDecl</a> is
3341 provided for a given element type, the contents of all those
3342 provided are merged. When more than one definition is provided for
3343 the same attribute of a given element type, the first declaration is
3344 binding and later declarations are ignored.
3345 <a title="For interoperability" href="#dt-interop"
3346 >For interoperability,</a
3347 >
3348 writers of DTDs may choose to provide at most one attribute-list
3349 declaration for a given element type, at most one attribute
3350 definition for a given attribute name in an attribute-list
3351 declaration, and at least one attribute definition in each
3352 attribute-list declaration. For interoperability, an XML processor
3353 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em> at
3354 user option issue a warning when more than one attribute-list
3355 declaration is provided for a given element type, or more than one
3356 attribute definition is provided for a given attribute, but this is
3357 not an error.
3358 </p>
3359 <div class="div3">
3360 <h4>
3361 <a name="sec-attribute-types" id="sec-attribute-types" />3.3.1
3362 Attribute Types
3363 </h4>
3364 <p>
3365 XML attribute types are of three kinds: a string type, a set of
3366 tokenized types, and enumerated types. The string type may take
3367 any literal string as a value; the tokenized types are more
3368 constrained. The validity constraints noted in the grammar are
3369 applied after the attribute value has been normalized as described
3370 in
3371 <a href="#AVNormalize"
3372 ><b>3.3.3 Attribute-Value Normalization</b></a
3373 >.
3374 </p>
3375 <h5><a name="d0e3004" id="d0e3004" />Attribute Types</h5>
3376 <table class="scrap" summary="Scrap">
3377 <tbody>
3378 <tr valign="baseline">
3379 <td>
3380 <a
3381 name="NT-AttType"
3382 id="NT-AttType"
3383 />[54]&nbsp;&nbsp;&nbsp;
3384 </td>
3385 <td><code>AttType</code></td>
3386 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3387 <td>
3388 <code>
3389 <a href="#NT-StringType">StringType</a> |
3390 <a href="#NT-TokenizedType">TokenizedType</a> |
3391 <a href="#NT-EnumeratedType">EnumeratedType</a>
3392 </code>
3393 </td>
3394 </tr>
3395 <tr valign="baseline">
3396 <td>
3397 <a
3398 name="NT-StringType"
3399 id="NT-StringType"
3400 />[55]&nbsp;&nbsp;&nbsp;
3401 </td>
3402 <td><code>StringType</code></td>
3403 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3404 <td><code>'CDATA'</code></td>
3405 </tr>
3406 <tr valign="baseline">
3407 <td>
3408 <a
3409 name="NT-TokenizedType"
3410 id="NT-TokenizedType"
3411 />[56]&nbsp;&nbsp;&nbsp;
3412 </td>
3413 <td><code>TokenizedType</code></td>
3414 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3415 <td><code>'ID'</code></td>
3416 <td><a href="#id">[VC: ID]</a></td>
3417 </tr>
3418 <tr valign="baseline">
3419 <td />
3420 <td />
3421 <td />
3422 <td />
3423 <td>
3424 <a href="#one-id-per-el">[VC: One ID per Element Type]</a>
3425 </td>
3426 </tr>
3427 <tr valign="baseline">
3428 <td />
3429 <td />
3430 <td />
3431 <td />
3432 <td><a href="#id-default">[VC: ID Attribute Default]</a></td>
3433 </tr>
3434 <tr valign="baseline">
3435 <td />
3436 <td />
3437 <td />
3438 <td><code>| 'IDREF'</code></td>
3439 <td><a href="#idref">[VC: IDREF]</a></td>
3440 </tr>
3441 <tr valign="baseline">
3442 <td />
3443 <td />
3444 <td />
3445 <td><code>| 'IDREFS'</code></td>
3446 <td><a href="#idref">[VC: IDREF]</a></td>
3447 </tr>
3448 <tr valign="baseline">
3449 <td />
3450 <td />
3451 <td />
3452 <td><code>| 'ENTITY'</code></td>
3453 <td><a href="#entname">[VC: Entity Name]</a></td>
3454 </tr>
3455 <tr valign="baseline">
3456 <td />
3457 <td />
3458 <td />
3459 <td><code>| 'ENTITIES'</code></td>
3460 <td><a href="#entname">[VC: Entity Name]</a></td>
3461 </tr>
3462 <tr valign="baseline">
3463 <td />
3464 <td />
3465 <td />
3466 <td><code>| 'NMTOKEN'</code></td>
3467 <td><a href="#nmtok">[VC: Name Token]</a></td>
3468 </tr>
3469 <tr valign="baseline">
3470 <td />
3471 <td />
3472 <td />
3473 <td><code>| 'NMTOKENS'</code></td>
3474 <td><a href="#nmtok">[VC: Name Token]</a></td>
3475 </tr>
3476 </tbody>
3477 </table>
3478 <div class="constraint">
3479 <p class="prefix">
3480 <a name="id" id="id" /><b>Validity constraint: ID</b>
3481 </p>
3482 <p>
3483 Values of type <b>ID</b>
3484 <em class="rfc2119" title="Keyword in RFC 2119 context"
3485 >MUST</em
3486 >
3487 match the <a href="#NT-Name">Name</a> production. A name
3488 <em class="rfc2119" title="Keyword in RFC 2119 context"
3489 >MUST NOT</em
3490 >
3491 appear more than once in an XML document as a value of this
3492 type; i.e., ID values
3493 <em class="rfc2119" title="Keyword in RFC 2119 context"
3494 >MUST</em
3495 >
3496 uniquely identify the elements which bear them.
3497 </p>
3498 </div>
3499 <div class="constraint">
3500 <p class="prefix">
3501 <a name="one-id-per-el" id="one-id-per-el" /><b
3502 >Validity constraint: One ID per Element Type</b
3503 >
3504 </p>
3505 <p>
3506 An element type
3507 <em class="rfc2119" title="Keyword in RFC 2119 context"
3508 >MUST NOT</em
3509 >
3510 have more than one ID attribute specified.
3511 </p>
3512 </div>
3513 <div class="constraint">
3514 <p class="prefix">
3515 <a name="id-default" id="id-default" /><b
3516 >Validity constraint: ID Attribute Default</b
3517 >
3518 </p>
3519 <p>
3520 An ID attribute
3521 <em class="rfc2119" title="Keyword in RFC 2119 context"
3522 >MUST</em
3523 >
3524 have a declared default of <b>#IMPLIED</b> or <b>#REQUIRED</b>.
3525 </p>
3526 </div>
3527 <div class="constraint">
3528 <p class="prefix">
3529 <a name="idref" id="idref" /><b>Validity constraint: IDREF</b>
3530 </p>
3531 <p>
3532 Values of type <b>IDREF</b>
3533 <em class="rfc2119" title="Keyword in RFC 2119 context"
3534 >MUST</em
3535 >
3536 match the <a href="#NT-Name">Name</a> production, and values of
3537 type <b>IDREFS</b>
3538 <em class="rfc2119" title="Keyword in RFC 2119 context"
3539 >MUST</em
3540 >
3541 match <a href="#NT-Names">Names</a>; each
3542 <a href="#NT-Name">Name</a>
3543 <em class="rfc2119" title="Keyword in RFC 2119 context"
3544 >MUST</em
3545 >
3546 match the value of an ID attribute on some element in the XML
3547 document; i.e. <b>IDREF</b> values
3548 <em class="rfc2119" title="Keyword in RFC 2119 context"
3549 >MUST</em
3550 >
3551 match the value of some ID attribute.
3552 </p>
3553 </div>
3554 <div class="constraint">
3555 <p class="prefix">
3556 <a name="entname" id="entname" /><b
3557 >Validity constraint: Entity Name</b
3558 >
3559 </p>
3560 <p>
3561 Values of type <b>ENTITY</b>
3562 <em class="rfc2119" title="Keyword in RFC 2119 context"
3563 >MUST</em
3564 >
3565 match the <a href="#NT-Name">Name</a> production, values of type
3566 <b>ENTITIES</b>
3567 <em class="rfc2119" title="Keyword in RFC 2119 context"
3568 >MUST</em
3569 >
3570 match <a href="#NT-Names">Names</a>; each
3571 <a href="#NT-Name">Name</a>
3572 <em class="rfc2119" title="Keyword in RFC 2119 context"
3573 >MUST</em
3574 >
3575 match the name of an
3576 <a title="Unparsed Entity" href="#dt-unparsed"
3577 >unparsed entity</a
3578 >
3579 declared in the
3580 <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.
3581 </p>
3582 </div>
3583 <div class="constraint">
3584 <p class="prefix">
3585 <a name="nmtok" id="nmtok" /><b
3586 >Validity constraint: Name Token</b
3587 >
3588 </p>
3589 <p>
3590 Values of type <b>NMTOKEN</b>
3591 <em class="rfc2119" title="Keyword in RFC 2119 context"
3592 >MUST</em
3593 >
3594 match the <a href="#NT-Nmtoken">Nmtoken</a> production; values
3595 of type <b>NMTOKENS</b>
3596 <em class="rfc2119" title="Keyword in RFC 2119 context"
3597 >MUST</em
3598 >
3599 match <a href="#NT-Nmtokens">Nmtokens</a>.
3600 </p>
3601 </div>
3602 <p>
3603 [<a
3604 name="dt-enumerated"
3605 id="dt-enumerated"
3606 title="Enumerated Attribute Values"
3607 >Definition</a
3608 >:
3609 <b>Enumerated attributes</b>
3610 have a list of allowed values in their declaration ]. They
3611 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3612 take one of those values. There are two kinds of enumerated
3613 attribute types:
3614 </p>
3615 <h5><a name="d0e3200" id="d0e3200" />Enumerated Attribute Types</h5>
3616 <table class="scrap" summary="Scrap">
3617 <tbody>
3618 <tr valign="baseline">
3619 <td>
3620 <a
3621 name="NT-EnumeratedType"
3622 id="NT-EnumeratedType"
3623 />[57]&nbsp;&nbsp;&nbsp;
3624 </td>
3625 <td><code>EnumeratedType</code></td>
3626 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3627 <td>
3628 <code>
3629 <a href="#NT-NotationType">NotationType</a>
3630 | <a href="#NT-Enumeration">Enumeration</a>
3631 </code>
3632 </td>
3633 </tr>
3634 </tbody>
3635 <tbody>
3636 <tr valign="baseline">
3637 <td>
3638 <a
3639 name="NT-NotationType"
3640 id="NT-NotationType"
3641 />[58]&nbsp;&nbsp;&nbsp;
3642 </td>
3643 <td><code>NotationType</code></td>
3644 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3645 <td>
3646 <code
3647 >'NOTATION' <a href="#NT-S">S</a> '('
3648 <a href="#NT-S">S</a>? <a href="#NT-Name">Name</a> (<a
3649 href="#NT-S"
3650 >S</a
3651 >? '|' <a href="#NT-S">S</a>?
3652 <a href="#NT-Name">Name</a>)* <a href="#NT-S">S</a>? ')'
3653 </code>
3654 </td>
3655 <td><a href="#notatn">[VC: Notation Attributes]</a></td>
3656 </tr>
3657 <tr valign="baseline">
3658 <td />
3659 <td />
3660 <td />
3661 <td />
3662 <td>
3663 <a href="#OneNotationPer"
3664 >[VC: One Notation Per Element Type]</a
3665 >
3666 </td>
3667 </tr>
3668 <tr valign="baseline">
3669 <td />
3670 <td />
3671 <td />
3672 <td />
3673 <td>
3674 <a href="#NoNotationEmpty"
3675 >[VC: No Notation on Empty Element]</a
3676 >
3677 </td>
3678 </tr>
3679 <tr valign="baseline">
3680 <td />
3681 <td />
3682 <td />
3683 <td />
3684 <td>
3685 <a href="#NoDuplicateTokens">[VC: No Duplicate Tokens]</a>
3686 </td>
3687 </tr>
3688 </tbody>
3689 <tbody>
3690 <tr valign="baseline">
3691 <td>
3692 <a
3693 name="NT-Enumeration"
3694 id="NT-Enumeration"
3695 />[59]&nbsp;&nbsp;&nbsp;
3696 </td>
3697 <td><code>Enumeration</code></td>
3698 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3699 <td>
3700 <code
3701 >'(' <a href="#NT-S">S</a>?
3702 <a href="#NT-Nmtoken">Nmtoken</a> (<a href="#NT-S">S</a>?
3703 '|' <a href="#NT-S">S</a>?
3704 <a href="#NT-Nmtoken">Nmtoken</a>)* <a href="#NT-S">S</a>?
3705 ')'</code
3706 >
3707 </td>
3708 <td><a href="#enum">[VC: Enumeration]</a></td>
3709 </tr>
3710 <tr valign="baseline">
3711 <td />
3712 <td />
3713 <td />
3714 <td />
3715 <td>
3716 <a href="#NoDuplicateTokens">[VC: No Duplicate Tokens]</a>
3717 </td>
3718 </tr>
3719 </tbody>
3720 </table>
3721 <p>
3722 A <b>NOTATION</b> attribute identifies a
3723 <a title="Notation" href="#dt-notation">notation</a>, declared in
3724 the DTD with associated system and/or public identifiers, to be
3725 used in interpreting the element to which the attribute is
3726 attached.
3727 </p>
3728 <div class="constraint">
3729 <p class="prefix">
3730 <a name="notatn" id="notatn" /><b
3731 >Validity constraint: Notation Attributes</b
3732 >
3733 </p>
3734 <p>
3735 Values of this type
3736 <em class="rfc2119" title="Keyword in RFC 2119 context"
3737 >MUST</em
3738 >
3739 match one of the
3740 <a href="#Notations"><cite>notation</cite></a> names included in
3741 the declaration; all notation names in the declaration
3742 <em class="rfc2119" title="Keyword in RFC 2119 context"
3743 >MUST</em
3744 >
3745 be declared.
3746 </p>
3747 </div>
3748 <div class="constraint">
3749 <p class="prefix">
3750 <a name="OneNotationPer" id="OneNotationPer" /><b
3751 >Validity constraint: One Notation Per Element Type</b
3752 >
3753 </p>
3754 <p>
3755 An element type
3756 <em class="rfc2119" title="Keyword in RFC 2119 context"
3757 >MUST NOT</em
3758 >
3759 have more than one <b>NOTATION</b> attribute specified.
3760 </p>
3761 </div>
3762 <div class="constraint">
3763 <p class="prefix">
3764 <a name="NoNotationEmpty" id="NoNotationEmpty" /><b
3765 >Validity constraint: No Notation on Empty Element</b
3766 >
3767 </p>
3768 <p>
3769 <a title="For Compatibility" href="#dt-compat"
3770 >For compatibility</a
3771 >, an attribute of type <b>NOTATION</b>
3772 <em class="rfc2119" title="Keyword in RFC 2119 context"
3773 >MUST NOT</em
3774 >
3775 be declared on an element declared <b>EMPTY</b>.
3776 </p>
3777 </div>
3778 <div class="constraint">
3779 <p class="prefix">
3780 <a name="NoDuplicateTokens" id="NoDuplicateTokens" /><b
3781 >Validity constraint: No Duplicate Tokens</b
3782 >
3783 </p>
3784 <p>
3785 The notation names in a single
3786 <a href="#NT-NotationType">NotationType</a> attribute
3787 declaration, as well as the <a href="#NT-Nmtoken">NmToken</a>s
3788 in a single <a href="#NT-Enumeration">Enumeration</a> attribute
3789 declaration,
3790 <em class="rfc2119" title="Keyword in RFC 2119 context"
3791 >MUST</em
3792 >
3793 all be distinct.
3794 </p>
3795 </div>
3796 <div class="constraint">
3797 <p class="prefix">
3798 <a name="enum" id="enum" /><b
3799 >Validity constraint: Enumeration</b
3800 >
3801 </p>
3802 <p>
3803 Values of this type
3804 <em class="rfc2119" title="Keyword in RFC 2119 context"
3805 >MUST</em
3806 >
3807 match one of the <a href="#NT-Nmtoken">Nmtoken</a> tokens in the
3808 declaration.
3809 </p>
3810 </div>
3811 <p>
3812 <a title="For interoperability" href="#dt-interop"
3813 >For interoperability,</a
3814 >
3815 the same <a href="#NT-Nmtoken">Nmtoken</a>
3816 <em class="rfc2119" title="Keyword in RFC 2119 context"
3817 >SHOULD NOT</em
3818 >
3819 occur more than once in the enumerated attribute types of a single
3820 element type.
3821 </p>
3822 </div>
3823 <div class="div3">
3824 <h4>
3825 <a name="sec-attr-defaults" id="sec-attr-defaults" />3.3.2
3826 Attribute Defaults
3827 </h4>
3828 <p>
3829 An
3830 <a title="Attribute-List Declaration" href="#dt-attdecl"
3831 >attribute declaration</a
3832 >
3833 provides information on whether the attribute's presence is
3834 <em class="rfc2119" title="Keyword in RFC 2119 context"
3835 >REQUIRED</em
3836 >, and if not, how an XML processor is to react if a declared
3837 attribute is absent in a document.
3838 </p>
3839 <h5><a name="d0e3369" id="d0e3369" />Attribute Defaults</h5>
3840 <table class="scrap" summary="Scrap">
3841 <tbody>
3842 <tr valign="baseline">
3843 <td>
3844 <a
3845 name="NT-DefaultDecl"
3846 id="NT-DefaultDecl"
3847 />[60]&nbsp;&nbsp;&nbsp;
3848 </td>
3849 <td><code>DefaultDecl</code></td>
3850 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
3851 <td><code>'#REQUIRED' |&nbsp;'#IMPLIED' </code></td>
3852 </tr>
3853 <tr valign="baseline">
3854 <td />
3855 <td />
3856 <td />
3857 <td>
3858 <code
3859 >| (('#FIXED' <a href="#NT-S">S</a>)?
3860 <a href="#NT-AttValue">AttValue</a>)</code
3861 >
3862 </td>
3863 <td><a href="#RequiredAttr">[VC: Required Attribute]</a></td>
3864 </tr>
3865 <tr valign="baseline">
3866 <td />
3867 <td />
3868 <td />
3869 <td />
3870 <td>
3871 <a href="#defattrvalid"
3872 >[VC: Attribute Default Value Syntactically Correct]</a
3873 >
3874 </td>
3875 </tr>
3876 <tr valign="baseline">
3877 <td />
3878 <td />
3879 <td />
3880 <td />
3881 <td>
3882 <a href="#CleanAttrVals"
3883 >[WFC: No &lt; in Attribute Values]</a
3884 >
3885 </td>
3886 </tr>
3887 <tr valign="baseline">
3888 <td />
3889 <td />
3890 <td />
3891 <td />
3892 <td>
3893 <a href="#FixedAttr">[VC: Fixed Attribute Default]</a>
3894 </td>
3895 </tr>
3896 <tr valign="baseline">
3897 <td />
3898 <td />
3899 <td />
3900 <td />
3901 <td>
3902 <a href="#NoExternalRefs"
3903 >[WFC: No External Entity References]</a
3904 >
3905 </td>
3906 </tr>
3907 </tbody>
3908 </table>
3909 <p>
3910 In an attribute declaration, <b>#REQUIRED</b> means that the
3911 attribute
3912 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3913 always be provided, <b>#IMPLIED</b> that no default value is
3914 provided. [<a
3915 name="dt-default"
3916 id="dt-default"
3917 title="Attribute Default"
3918 >Definition</a
3919 >: If the declaration is neither <b>#REQUIRED</b> nor
3920 <b>#IMPLIED</b>, then the
3921 <a href="#NT-AttValue">AttValue</a> value contains the declared
3922 <b>default</b> value; the <b>#FIXED</b> keyword states that the
3923 attribute
3924 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3925 always have the default value. When an XML processor encounters an
3926 element without a specification for an attribute for which it has
3927 read a default value declaration, it
3928 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
3929 report the attribute with the declared default value to the
3930 application.]
3931 </p>
3932 <div class="constraint">
3933 <p class="prefix">
3934 <a name="RequiredAttr" id="RequiredAttr" /><b
3935 >Validity constraint: Required Attribute</b
3936 >
3937 </p>
3938 <p>
3939 If the default declaration is the keyword <b>#REQUIRED</b>, then
3940 the attribute
3941 <em class="rfc2119" title="Keyword in RFC 2119 context"
3942 >MUST</em
3943 >
3944 be specified for all elements of the type in the attribute-list
3945 declaration.
3946 </p>
3947 </div>
3948 <div class="constraint">
3949 <p class="prefix">
3950 <a name="defattrvalid" id="defattrvalid" /><b
3951 >Validity constraint: Attribute Default Value Syntactically
3952 Correct</b
3953 >
3954 </p>
3955 <p>
3956 The declared default value
3957 <em class="rfc2119" title="Keyword in RFC 2119 context"
3958 >MUST</em
3959 >
3960 meet the syntactic constraints of the declared attribute type.
3961 That is, the default value of an attribute:
3962 </p>
3963 <ul>
3964 <li>
3965 <p>
3966 of type IDREF or ENTITY must match the
3967 <a href="#NT-Name">Name</a> production;
3968 </p>
3969 </li>
3970 <li>
3971 <p>
3972 of type IDREFS or ENTITIES must match the
3973 <a href="#NT-Names">Names</a> production;
3974 </p>
3975 </li>
3976 <li>
3977 <p>
3978 of type NMTOKEN must match the
3979 <a href="#NT-Nmtoken">Nmtoken</a> production;
3980 </p>
3981 </li>
3982 <li>
3983 <p>
3984 of type NMTOKENS must match the
3985 <a href="#NT-Nmtokens">Nmtokens</a> production;
3986 </p>
3987 </li>
3988 <li>
3989 <p>
3990 of an
3991 <a href="#NT-EnumeratedType">enumerated type</a> (either a
3992 <a href="#NT-NotationType">NOTATION</a> type or an
3993 <a href="#NT-Enumeration">enumeration</a>) must match one of
3994 the enumerated values.
3995 </p>
3996 </li>
3997 </ul>
3998 <p>
3999 Note that only the syntactic constraints of the type are
4000 required here; other constraints (e.g. that the value be the
4001 name of a declared unparsed entity, for an attribute of type
4002 ENTITY) will be reported by a validating parser only if an
4003 element without a specification for this attribute actually
4004 occurs.
4005 </p>
4006 </div>
4007 <div class="constraint">
4008 <p class="prefix">
4009 <a name="FixedAttr" id="FixedAttr" /><b
4010 >Validity constraint: Fixed Attribute Default</b
4011 >
4012 </p>
4013 <p>
4014 If an attribute has a default value declared with the
4015 <b>#FIXED</b> keyword, instances of that attribute
4016 <em class="rfc2119" title="Keyword in RFC 2119 context"
4017 >MUST</em
4018 >
4019 match the default value.
4020 </p>
4021 </div>
4022 <p>Examples of attribute-list declarations:</p>
4023 <div class="exampleInner">
4024 <pre>
4025 &lt;!ATTLIST termdef
4026 id ID #REQUIRED
4027 name CDATA #IMPLIED&gt;
4028 &lt;!ATTLIST list
4029 type (bullets|ordered|glossary) "ordered"&gt;
4030 &lt;!ATTLIST form
4031 method CDATA #FIXED "POST"&gt;</pre
4032 >
4033 </div>
4034 </div>
4035 <div class="div3">
4036 <h4>
4037 <a name="AVNormalize" id="AVNormalize" />3.3.3 Attribute-Value
4038 Normalization
4039 </h4>
4040 <p>
4041 Before the value of an attribute is passed to the application or
4042 checked for validity, the XML processor
4043 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4044 normalize the attribute value by applying the algorithm below, or
4045 by using some other method such that the value passed to the
4046 application is the same as that produced by the algorithm.
4047 </p>
4048 <ol class="enumar">
4049 <li>
4050 <p>
4051 All line breaks
4052 <em class="rfc2119" title="Keyword in RFC 2119 context"
4053 >MUST</em
4054 >
4055 have been normalized on input to #xA as described in
4056 <a href="#sec-line-ends"><b>2.11 End-of-Line Handling</b></a
4057 >, so the rest of this algorithm operates on text normalized
4058 in this way.
4059 </p>
4060 </li>
4061 <li>
4062 <p>
4063 Begin with a normalized value consisting of the empty string.
4064 </p>
4065 </li>
4066 <li>
4067 <p>
4068 For each character, entity reference, or character reference
4069 in the unnormalized attribute value, beginning with the first
4070 and continuing to the last, do the following:
4071 </p>
4072 <ul>
4073 <li>
4074 <p>
4075 For a character reference, append the referenced character
4076 to the normalized value.
4077 </p>
4078 </li>
4079 <li>
4080 <p>
4081 For an entity reference, recursively apply step 3 of this
4082 algorithm to the replacement text of the entity.
4083 </p>
4084 </li>
4085 <li>
4086 <p>
4087 For a white space character (#x20, #xD, #xA, #x9), append
4088 a space character (#x20) to the normalized value.
4089 </p>
4090 </li>
4091 <li>
4092 <p>
4093 For another character, append the character to the
4094 normalized value.
4095 </p>
4096 </li>
4097 </ul>
4098 </li>
4099 </ol>
4100 <p>
4101 If the attribute type is not CDATA, then the XML processor
4102 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4103 further process the normalized attribute value by discarding any
4104 leading and trailing space (#x20) characters, and by replacing
4105 sequences of space (#x20) characters by a single space (#x20)
4106 character.
4107 </p>
4108 <p>
4109 Note that if the unnormalized attribute value contains a character
4110 reference to a white space character other than space (#x20), the
4111 normalized value contains the referenced character itself (#xD,
4112 #xA or #x9). This contrasts with the case where the unnormalized
4113 value contains a white space character (not a reference), which is
4114 replaced with a space character (#x20) in the normalized value and
4115 also contrasts with the case where the unnormalized value contains
4116 an entity reference whose replacement text contains a white space
4117 character; being recursively processed, the white space character
4118 is replaced with a space character (#x20) in the normalized value.
4119 </p>
4120 <p>
4121 All attributes for which no declaration has been read
4122 <em class="rfc2119" title="Keyword in RFC 2119 context"
4123 >SHOULD</em
4124 >
4125 be treated by a non-validating processor as if declared
4126 <b>CDATA</b>.
4127 </p>
4128 <p>
4129 It is an error if an
4130 <a title="Attribute Value" href="#dt-attrval">attribute value</a>
4131 contains a
4132 <a title="Entity Reference" href="#dt-entref">reference</a> to an
4133 entity for which no declaration has been read.
4134 </p>
4135 <p>
4136 Following are examples of attribute normalization. Given the
4137 following declarations:
4138 </p>
4139 <div class="exampleInner">
4140 <pre>
4141 &lt;!ENTITY d "&amp;#xD;"&gt;
4142 &lt;!ENTITY a "&amp;#xA;"&gt;
4143 &lt;!ENTITY da "&amp;#xD;&amp;#xA;"&gt;</pre
4144 >
4145 </div>
4146 <p>
4147 the attribute specifications in the left column below would be
4148 normalized to the character sequences of the middle column if the
4149 attribute <code>a</code> is declared <b>NMTOKENS</b> and to those
4150 of the right columns if <code>a</code> is declared <b>CDATA</b>.
4151 </p>
4152 <table border="1" frame="border">
4153 <thead>
4154 <tr>
4155 <th>Attribute specification</th>
4156 <th>a is NMTOKENS</th>
4157 <th>a is CDATA</th>
4158 </tr>
4159 </thead>
4160 <tbody>
4161 <tr>
4162 <td>
4163 <div class="exampleInner">
4164 <pre>
4165 a="
4166
4167 xyz"</pre
4168 >
4169 </div>
4170 </td>
4171 <td>
4172 <div class="exampleInner"><pre>x y z</pre></div>
4173 </td>
4174 <td>
4175 <div class="exampleInner"><pre>#x20 #x20 x y z</pre></div>
4176 </td>
4177 </tr>
4178 <tr>
4179 <td>
4180 <div class="exampleInner">
4181 <pre>
4182 a="&amp;d;&amp;d;A&amp;a;&amp;#x20;&amp;a;B&amp;da;"</pre
4183 >
4184 </div>
4185 </td>
4186 <td>
4187 <div class="exampleInner"><pre>A #x20 B</pre></div>
4188 </td>
4189 <td>
4190 <div class="exampleInner">
4191 <pre>#x20 #x20 A #x20 #x20 #x20 B #x20 #x20</pre>
4192 </div>
4193 </td>
4194 </tr>
4195 <tr>
4196 <td>
4197 <div class="exampleInner">
4198 <pre>
4199 a=
4200 "&amp;#xd;&amp;#xd;A&amp;#xa;&amp;#xa;B&amp;#xd;&amp;#xa;"</pre
4201 >
4202 </div>
4203 </td>
4204 <td>
4205 <div class="exampleInner">
4206 <pre>#xD #xD A #xA #xA B #xD #xA</pre>
4207 </div>
4208 </td>
4209 <td>
4210 <div class="exampleInner">
4211 <pre>#xD #xD A #xA #xA B #xD #xA</pre>
4212 </div>
4213 </td>
4214 </tr>
4215 </tbody>
4216 </table>
4217 <p>
4218 Note that the last example is invalid (but well-formed) if
4219 <code>a</code> is declared to be of type <b>NMTOKENS</b>.
4220 </p>
4221 </div>
4222 </div>
4223 <div class="div2">
4224 <h3>
4225 <a name="sec-condition-sect" id="sec-condition-sect" />3.4
4226 Conditional Sections
4227 </h3>
4228 <p>
4229 [<a
4230 name="dt-cond-section"
4231 id="dt-cond-section"
4232 title="conditional section"
4233 >Definition</a
4234 >: <b>Conditional sections</b> are portions of the
4235 <a title="Document Type Declaration" href="#dt-doctype"
4236 >document type declaration external subset</a
4237 >
4238 or of external parameter entities which are included in, or excluded
4239 from, the logical structure of the DTD based on the keyword which
4240 governs them.]
4241 </p>
4242 <h5><a name="d0e3658" id="d0e3658" />Conditional Section</h5>
4243 <table class="scrap" summary="Scrap">
4244 <tbody>
4245 <tr valign="baseline">
4246 <td>
4247 <a
4248 name="NT-conditionalSect"
4249 id="NT-conditionalSect"
4250 />[61]&nbsp;&nbsp;&nbsp;
4251 </td>
4252 <td><code>conditionalSect</code></td>
4253 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4254 <td>
4255 <code>
4256 <a href="#NT-includeSect">includeSect</a> |
4257 <a href="#NT-ignoreSect">ignoreSect</a>
4258 </code>
4259 </td>
4260 </tr>
4261 <tr valign="baseline">
4262 <td>
4263 <a
4264 name="NT-includeSect"
4265 id="NT-includeSect"
4266 />[62]&nbsp;&nbsp;&nbsp;
4267 </td>
4268 <td><code>includeSect</code></td>
4269 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4270 <td>
4271 <code
4272 >'&lt;![' <a href="#NT-S">S</a>? 'INCLUDE'
4273 <a href="#NT-S">S</a>? '['
4274 <a href="#NT-extSubsetDecl">extSubsetDecl</a> ']]&gt;'
4275 </code>
4276 </td>
4277 <td>
4278 <a href="#condsec-nesting"
4279 >[VC: Proper Conditional Section/PE Nesting]</a
4280 >
4281 </td>
4282 </tr>
4283 <tr valign="baseline">
4284 <td>
4285 <a
4286 name="NT-ignoreSect"
4287 id="NT-ignoreSect"
4288 />[63]&nbsp;&nbsp;&nbsp;
4289 </td>
4290 <td><code>ignoreSect</code></td>
4291 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4292 <td>
4293 <code
4294 >'&lt;![' <a href="#NT-S">S</a>? 'IGNORE'
4295 <a href="#NT-S">S</a>? '['
4296 <a href="#NT-ignoreSectContents">ignoreSectContents</a>*
4297 ']]&gt;'</code
4298 >
4299 </td>
4300 <td>
4301 <a href="#condsec-nesting"
4302 >[VC: Proper Conditional Section/PE Nesting]</a
4303 >
4304 </td>
4305 </tr>
4306 <tr valign="baseline">
4307 <td>
4308 <a
4309 name="NT-ignoreSectContents"
4310 id="NT-ignoreSectContents"
4311 />[64]&nbsp;&nbsp;&nbsp;
4312 </td>
4313 <td><code>ignoreSectContents</code></td>
4314 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4315 <td>
4316 <code>
4317 <a href="#NT-Ignore">Ignore</a> ('&lt;!['
4318 <a href="#NT-ignoreSectContents">ignoreSectContents</a>
4319 ']]&gt;' <a href="#NT-Ignore">Ignore</a>)*</code
4320 >
4321 </td>
4322 </tr>
4323 <tr valign="baseline">
4324 <td>
4325 <a name="NT-Ignore" id="NT-Ignore" />[65]&nbsp;&nbsp;&nbsp;
4326 </td>
4327 <td><code>Ignore</code></td>
4328 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4329 <td>
4330 <code>
4331 <a href="#NT-Char">Char</a>* - (<a href="#NT-Char">Char</a>*
4332 ('&lt;![' | ']]&gt;') <a href="#NT-Char">Char</a>*)
4333 </code>
4334 </td>
4335 </tr>
4336 </tbody>
4337 </table>
4338 <div class="constraint">
4339 <p class="prefix">
4340 <a name="condsec-nesting" id="condsec-nesting" /><b
4341 >Validity constraint: Proper Conditional Section/PE Nesting</b
4342 >
4343 </p>
4344 <p>
4345 If any of the "<code>&lt;![</code>", "<code>[</code>", or
4346 "<code>]]&gt;</code>" of a conditional section is contained in the
4347 replacement text for a parameter-entity reference, all of them
4348 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4349 be contained in the same replacement text.
4350 </p>
4351 </div>
4352 <p>
4353 Like the internal and external DTD subsets, a conditional section
4354 may contain one or more complete declarations, comments, processing
4355 instructions, or nested conditional sections, intermingled with
4356 white space.
4357 </p>
4358 <p>
4359 If the keyword of the conditional section is <b>INCLUDE</b>, then
4360 the contents of the conditional section
4361 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
4362 processed as part of the DTD. If the keyword of the conditional
4363 section is <b>IGNORE</b>, then the contents of the conditional
4364 section
4365 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4366 <em class="rfc2119" title="Keyword in RFC 2119 context">NOT</em> be
4367 processed as part of the DTD. If a conditional section with a
4368 keyword of <b>INCLUDE</b> occurs within a larger conditional section
4369 with a keyword of <b>IGNORE</b>, both the outer and the inner
4370 conditional sections
4371 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
4372 ignored. The contents of an ignored conditional section
4373 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
4374 parsed by ignoring all characters after the "<code>[</code>"
4375 following the keyword, except conditional section starts
4376 "<code>&lt;![</code>" and ends "<code>]]&gt;</code>", until the
4377 matching conditional section end is found. Parameter entity
4378 references
4379 <em class="rfc2119" title="Keyword in RFC 2119 context"
4380 >MUST NOT</em
4381 >
4382 be recognized in this process.
4383 </p>
4384 <p>
4385 If the keyword of the conditional section is a parameter-entity
4386 reference, the parameter entity
4387 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
4388 replaced by its content before the processor decides whether to
4389 include or ignore the conditional section.
4390 </p>
4391 <p>An example:</p>
4392 <div class="exampleInner">
4393 <pre>
4394 &lt;!ENTITY % draft 'INCLUDE' &gt;
4395 &lt;!ENTITY % final 'IGNORE' &gt;
4396
4397 &lt;![%draft;[
4398 &lt;!ELEMENT book (comments*, title, body, supplements?)&gt;
4399 ]]&gt;
4400 &lt;![%final;[
4401 &lt;!ELEMENT book (title, body, supplements?)&gt;
4402 ]]&gt;</pre
4403 >
4404 </div>
4405 </div>
4406 </div>
4407 <div class="div1">
4408 <h2>
4409 <a name="sec-physical-struct" id="sec-physical-struct" />4 Physical
4410 Structures
4411 </h2>
4412 <p>
4413 [<a name="dt-entity" id="dt-entity" title="Entity">Definition</a>: An
4414 XML document may consist of one or many storage units. These are
4415 called <b>entities</b>; they all have <b>content</b> and are all
4416 (except for the
4417 <a title="Document Entity" href="#dt-docent">document entity</a> and
4418 the
4419 <a title="Document Type Declaration" href="#dt-doctype"
4420 >external DTD subset</a
4421 >) identified by entity <b>name</b>.] Each XML document has one entity
4422 called the
4423 <a title="Document Entity" href="#dt-docent">document entity</a>,
4424 which serves as the starting point for the
4425 <a title="XML Processor" href="#dt-xml-proc">XML processor</a> and may
4426 contain the whole document.
4427 </p>
4428 <p>
4429 Entities may be either parsed or unparsed. [<a
4430 name="dt-parsedent"
4431 id="dt-parsedent"
4432 title="Text Entity"
4433 >Definition</a
4434 >: The contents of a <b>parsed entity</b> are referred to as its
4435 <a title="Replacement Text" href="#dt-repltext">replacement text</a>;
4436 this <a title="Text" href="#dt-text">text</a> is considered an
4437 integral part of the document.]
4438 </p>
4439 <p>
4440 [<a name="dt-unparsed" id="dt-unparsed" title="Unparsed Entity"
4441 >Definition</a
4442 >: An <b>unparsed entity</b> is a resource whose contents may or may
4443 not be <a title="Text" href="#dt-text">text</a>, and if text, may be
4444 other than XML. Each unparsed entity has an associated
4445 <a title="Notation" href="#dt-notation">notation</a>, identified by
4446 name. Beyond a requirement that an XML processor make the identifiers
4447 for the entity and notation available to the application, XML places
4448 no constraints on the contents of unparsed entities.]
4449 </p>
4450 <p>
4451 Parsed entities are invoked by name using entity references; unparsed
4452 entities by name, given in the value of <b>ENTITY</b> or
4453 <b>ENTITIES</b> attributes.
4454 </p>
4455 <p>
4456 [<a name="gen-entity" id="gen-entity" title="general entity"
4457 >Definition</a
4458 >:
4459 <b>General entities</b>
4460 are entities for use within the document content. In this
4461 specification, general entities are sometimes referred to with the
4462 unqualified term <em>entity</em> when this leads to no ambiguity.] [<a
4463 name="dt-PE"
4464 id="dt-PE"
4465 title="Parameter entity"
4466 >Definition</a
4467 >: <b>Parameter entities</b> are parsed entities for use within the
4468 DTD.] These two types of entities use different forms of reference and
4469 are recognized in different contexts. Furthermore, they occupy
4470 different namespaces; a parameter entity and a general entity with the
4471 same name are two distinct entities.
4472 </p>
4473 <div class="div2">
4474 <h3>
4475 <a name="sec-references" id="sec-references" />4.1 Character and
4476 Entity References
4477 </h3>
4478 <p>
4479 [<a name="dt-charref" id="dt-charref" title="Character Reference"
4480 >Definition</a
4481 >: A <b>character reference</b> refers to a specific character in
4482 the ISO/IEC 10646 character set, for example one not directly
4483 accessible from available input devices.]
4484 </p>
4485 <h5><a name="d0e3895" id="d0e3895" />Character Reference</h5>
4486 <table class="scrap" summary="Scrap">
4487 <tbody>
4488 <tr valign="baseline">
4489 <td>
4490 <a name="NT-CharRef" id="NT-CharRef" />[66]&nbsp;&nbsp;&nbsp;
4491 </td>
4492 <td><code>CharRef</code></td>
4493 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4494 <td><code>'&amp;#' [0-9]+ ';' </code></td>
4495 </tr>
4496 <tr valign="baseline">
4497 <td />
4498 <td />
4499 <td />
4500 <td><code>| '&amp;#x' [0-9a-fA-F]+ ';'</code></td>
4501 <td><a href="#wf-Legalchar">[WFC: Legal Character]</a></td>
4502 </tr>
4503 </tbody>
4504 </table>
4505 <div class="constraint">
4506 <p class="prefix">
4507 <a name="wf-Legalchar" id="wf-Legalchar" /><b
4508 >Well-formedness constraint: Legal Character</b
4509 >
4510 </p>
4511 <p>
4512 Characters referred to using character references
4513 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4514 match the production for <a href="#NT-Char">Char</a>.
4515 </p>
4516 </div>
4517 <p>
4518 If the character reference begins with "
4519 <code>&amp;#x</code>
4520 ", the digits and letters up to the terminating
4521 <code>;</code> provide a hexadecimal representation of the
4522 character's code point in ISO/IEC 10646. If it begins just with "
4523 <code>&amp;#</code>
4524 ", the digits up to the terminating <code>;</code> provide a decimal
4525 representation of the character's code point.
4526 </p>
4527 <p>
4528 [<a name="dt-entref" id="dt-entref" title="Entity Reference"
4529 >Definition</a
4530 >: An <b>entity reference</b> refers to the content of a named
4531 entity.] [<a
4532 name="dt-GERef"
4533 id="dt-GERef"
4534 title="General Entity Reference"
4535 >Definition</a
4536 >: References to parsed general entities use ampersand
4537 (<code>&amp;</code>) and semicolon (<code>;</code>) as delimiters.]
4538 [<a name="dt-PERef" id="dt-PERef" title="Parameter-entity reference"
4539 >Definition</a
4540 >:
4541 <b>Parameter-entity references</b>
4542 use percent-sign (<code>%</code>) and semicolon (<code>;</code>) as
4543 delimiters.]
4544 </p>
4545 <h5><a name="d0e3966" id="d0e3966" />Entity Reference</h5>
4546 <table class="scrap" summary="Scrap">
4547 <tbody>
4548 <tr valign="baseline">
4549 <td>
4550 <a
4551 name="NT-Reference"
4552 id="NT-Reference"
4553 />[67]&nbsp;&nbsp;&nbsp;
4554 </td>
4555 <td><code>Reference</code></td>
4556 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4557 <td>
4558 <code>
4559 <a href="#NT-EntityRef">EntityRef</a> |
4560 <a href="#NT-CharRef">CharRef</a>
4561 </code>
4562 </td>
4563 </tr>
4564 </tbody>
4565 <tbody>
4566 <tr valign="baseline">
4567 <td>
4568 <a
4569 name="NT-EntityRef"
4570 id="NT-EntityRef"
4571 />[68]&nbsp;&nbsp;&nbsp;
4572 </td>
4573 <td><code>EntityRef</code></td>
4574 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4575 <td>
4576 <code>'&amp;' <a href="#NT-Name">Name</a> ';'</code>
4577 </td>
4578 <td><a href="#wf-entdeclared">[WFC: Entity Declared]</a></td>
4579 </tr>
4580 <tr valign="baseline">
4581 <td />
4582 <td />
4583 <td />
4584 <td />
4585 <td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td>
4586 </tr>
4587 <tr valign="baseline">
4588 <td />
4589 <td />
4590 <td />
4591 <td />
4592 <td><a href="#textent">[WFC: Parsed Entity]</a></td>
4593 </tr>
4594 <tr valign="baseline">
4595 <td />
4596 <td />
4597 <td />
4598 <td />
4599 <td><a href="#norecursion">[WFC: No Recursion]</a></td>
4600 </tr>
4601 </tbody>
4602 <tbody>
4603 <tr valign="baseline">
4604 <td>
4605 <a
4606 name="NT-PEReference"
4607 id="NT-PEReference"
4608 />[69]&nbsp;&nbsp;&nbsp;
4609 </td>
4610 <td><code>PEReference</code></td>
4611 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4612 <td>
4613 <code>'%' <a href="#NT-Name">Name</a> ';'</code>
4614 </td>
4615 <td><a href="#vc-entdeclared">[VC: Entity Declared]</a></td>
4616 </tr>
4617 <tr valign="baseline">
4618 <td />
4619 <td />
4620 <td />
4621 <td />
4622 <td><a href="#norecursion">[WFC: No Recursion]</a></td>
4623 </tr>
4624 <tr valign="baseline">
4625 <td />
4626 <td />
4627 <td />
4628 <td />
4629 <td><a href="#indtd">[WFC: In DTD]</a></td>
4630 </tr>
4631 </tbody>
4632 </table>
4633 <div class="constraint">
4634 <p class="prefix">
4635 <a name="wf-entdeclared" id="wf-entdeclared" /><b
4636 >Well-formedness constraint: Entity Declared</b
4637 >
4638 </p>
4639 <p>
4640 In a document without any DTD, a document with only an internal
4641 DTD subset which contains no parameter entity references, or a
4642 document with "
4643 <code>standalone='yes'</code>
4644 ", for an entity reference that does not occur within the external
4645 subset or a parameter entity, the
4646 <a href="#NT-Name">Name</a> given in the entity reference
4647 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4648 <a title="match" href="#dt-match">match</a> that in an
4649 <a href="#sec-entity-decl"><cite>entity declaration</cite></a>
4650 that does not occur within the external subset or a parameter
4651 entity, except that well-formed documents need not declare any of
4652 the following entities: <code>amp</code>, <code>lt</code>,
4653 <code>gt</code>, <code>apos</code>, <code>quot</code>. The
4654 declaration of a general entity
4655 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4656 precede any reference to it which appears in a default value in an
4657 attribute-list declaration.
4658 </p>
4659 <p>
4660 Note that non-validating processors are
4661 <a href="#include-if-valid"><cite>not obligated to</cite></a> read
4662 and process entity declarations occurring in parameter entities or
4663 in the external subset; for such documents, the rule that an
4664 entity must be declared is a well-formedness constraint only if
4665 <a href="#sec-rmd"><cite>standalone='yes'</cite></a
4666 >.
4667 </p>
4668 </div>
4669 <div class="constraint">
4670 <p class="prefix">
4671 <a name="vc-entdeclared" id="vc-entdeclared" /><b
4672 >Validity constraint: Entity Declared</b
4673 >
4674 </p>
4675 <p>
4676 In a document with an external subset or parameter entity
4677 references<span
4678 >, if the document is not standalone (either
4679 "<code>standalone='no'</code>" is specified or there is no
4680 standalone declaration), then</span
4681 >
4682 the <a href="#NT-Name">Name</a> given in the entity reference
4683 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4684 <a title="match" href="#dt-match">match</a> that in an
4685 <a href="#sec-entity-decl"><cite>entity declaration</cite></a
4686 >. For interoperability, valid documents
4687 <em class="rfc2119" title="Keyword in RFC 2119 context"
4688 >SHOULD</em
4689 >
4690 declare the entities <code>amp</code>, <code>lt</code>,
4691 <code>gt</code>, <code>apos</code>, <code>quot</code>, in the form
4692 specified in
4693 <a href="#sec-predefined-ent"><b>4.6 Predefined Entities</b></a
4694 >. The declaration of a parameter entity
4695 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4696 precede any reference to it. Similarly, the declaration of a
4697 general entity
4698 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
4699 precede any attribute-list declaration containing a default value
4700 with a direct or indirect reference to that general entity.
4701 </p>
4702 </div>
4703 <div class="constraint">
4704 <p class="prefix">
4705 <a name="textent" id="textent" /><b
4706 >Well-formedness constraint: Parsed Entity</b
4707 >
4708 </p>
4709 <p>
4710 An entity reference
4711 <em class="rfc2119" title="Keyword in RFC 2119 context"
4712 >MUST NOT</em
4713 >
4714 contain the name of an
4715 <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a
4716 >. Unparsed entities may be referred to only in
4717 <a title="Attribute Value" href="#dt-attrval">attribute values</a>
4718 declared to be of type <b>ENTITY</b> or <b>ENTITIES</b>.
4719 </p>
4720 </div>
4721 <div class="constraint">
4722 <p class="prefix">
4723 <a name="norecursion" id="norecursion" /><b
4724 >Well-formedness constraint: No Recursion</b
4725 >
4726 </p>
4727 <p>
4728 A parsed entity
4729 <em class="rfc2119" title="Keyword in RFC 2119 context"
4730 >MUST NOT</em
4731 >
4732 contain a recursive reference to itself, either directly or
4733 indirectly.
4734 </p>
4735 </div>
4736 <div class="constraint">
4737 <p class="prefix">
4738 <a name="indtd" id="indtd" /><b
4739 >Well-formedness constraint: In DTD</b
4740 >
4741 </p>
4742 <p>
4743 Parameter-entity references
4744 <em class="rfc2119" title="Keyword in RFC 2119 context"
4745 >MUST NOT</em
4746 >
4747 appear outside the
4748 <a title="Document Type Declaration" href="#dt-doctype">DTD</a>.
4749 </p>
4750 </div>
4751 <p>Examples of character and entity references:</p>
4752 <div class="exampleInner">
4753 <pre>
4754 Type &lt;key&gt;less-than&lt;/key&gt; (&amp;#x3C;) to save options.
4755 This document was prepared on &amp;docdate; and
4756 is classified &amp;security-level;.</pre
4757 >
4758 </div>
4759 <p>Example of a parameter-entity reference:</p>
4760 <div class="exampleInner">
4761 <pre>
4762 &lt;!-- declare the parameter entity "ISOLat2"... --&gt;
4763 &lt;!ENTITY % ISOLat2
4764 SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" &gt;
4765 &lt;!-- ... now reference it. --&gt;
4766 %ISOLat2;</pre
4767 >
4768 </div>
4769 </div>
4770 <div class="div2">
4771 <h3>
4772 <a name="sec-entity-decl" id="sec-entity-decl" />4.2 Entity
4773 Declarations
4774 </h3>
4775 <p>
4776 [<a name="dt-entdecl" id="dt-entdecl" title="entity declaration"
4777 >Definition</a
4778 >: Entities are declared thus:]
4779 </p>
4780 <h5><a name="d0e4163" id="d0e4163" />Entity Declaration</h5>
4781 <table class="scrap" summary="Scrap">
4782 <tbody>
4783 <tr valign="baseline">
4784 <td>
4785 <a
4786 name="NT-EntityDecl"
4787 id="NT-EntityDecl"
4788 />[70]&nbsp;&nbsp;&nbsp;
4789 </td>
4790 <td><code>EntityDecl</code></td>
4791 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4792 <td>
4793 <code>
4794 <a href="#NT-GEDecl">GEDecl</a>
4795 | <a href="#NT-PEDecl">PEDecl</a>
4796 </code>
4797 </td>
4798 </tr>
4799 <tr valign="baseline">
4800 <td>
4801 <a name="NT-GEDecl" id="NT-GEDecl" />[71]&nbsp;&nbsp;&nbsp;
4802 </td>
4803 <td><code>GEDecl</code></td>
4804 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4805 <td>
4806 <code
4807 >'&lt;!ENTITY' <a href="#NT-S">S</a>
4808 <a href="#NT-Name">Name</a>
4809 <a href="#NT-S">S</a>
4810 <a href="#NT-EntityDef">EntityDef</a>
4811 <a href="#NT-S">S</a>? '&gt;'</code
4812 >
4813 </td>
4814 </tr>
4815 <tr valign="baseline">
4816 <td>
4817 <a name="NT-PEDecl" id="NT-PEDecl" />[72]&nbsp;&nbsp;&nbsp;
4818 </td>
4819 <td><code>PEDecl</code></td>
4820 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4821 <td>
4822 <code
4823 >'&lt;!ENTITY' <a href="#NT-S">S</a> '%'
4824 <a href="#NT-S">S</a>
4825 <a href="#NT-Name">Name</a>
4826 <a href="#NT-S">S</a>
4827 <a href="#NT-PEDef">PEDef</a>
4828 <a href="#NT-S">S</a>? '&gt;'</code
4829 >
4830 </td>
4831 </tr>
4832 <tr valign="baseline">
4833 <td>
4834 <a
4835 name="NT-EntityDef"
4836 id="NT-EntityDef"
4837 />[73]&nbsp;&nbsp;&nbsp;
4838 </td>
4839 <td><code>EntityDef</code></td>
4840 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4841 <td>
4842 <code>
4843 <a href="#NT-EntityValue">EntityValue</a>
4844 | (<a href="#NT-ExternalID">ExternalID</a>
4845 <a href="#NT-NDataDecl">NDataDecl</a>?)</code
4846 >
4847 </td>
4848 </tr>
4849 <tr valign="baseline">
4850 <td>
4851 <a name="NT-PEDef" id="NT-PEDef" />[74]&nbsp;&nbsp;&nbsp;
4852 </td>
4853 <td><code>PEDef</code></td>
4854 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4855 <td>
4856 <code>
4857 <a href="#NT-EntityValue">EntityValue</a> |
4858 <a href="#NT-ExternalID">ExternalID</a>
4859 </code>
4860 </td>
4861 </tr>
4862 </tbody>
4863 </table>
4864 <p>
4865 The <a href="#NT-Name">Name</a> identifies the entity in an
4866 <a title="Entity Reference" href="#dt-entref">entity reference</a>
4867 or, in the case of an unparsed entity, in the value of an
4868 <b>ENTITY</b> or <b>ENTITIES</b> attribute. If the same entity is
4869 declared more than once, the first declaration encountered is
4870 binding; at user option, an XML processor
4871 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
4872 issue a warning if entities are declared multiple times.
4873 </p>
4874 <div class="div3">
4875 <h4>
4876 <a name="sec-internal-ent" id="sec-internal-ent" />4.2.1 Internal
4877 Entities
4878 </h4>
4879 <p>
4880 [<a
4881 name="dt-internent"
4882 id="dt-internent"
4883 title="Internal Entity Replacement Text"
4884 >Definition</a
4885 >: If the entity definition is an
4886 <a href="#NT-EntityValue">EntityValue</a>, the defined entity is
4887 called an <b>internal entity</b>. There is no separate physical
4888 storage object, and the content of the entity is given in the
4889 declaration.] Note that some processing of entity and character
4890 references in the
4891 <a title="Literal Entity Value" href="#dt-litentval"
4892 >literal entity value</a
4893 >
4894 may be required to produce the correct
4895 <a title="Replacement Text" href="#dt-repltext"
4896 >replacement text</a
4897 >: see
4898 <a href="#intern-replacement"
4899 ><b>4.5 Construction of Entity Replacement Text</b></a
4900 >.
4901 </p>
4902 <p>
4903 An internal entity is a
4904 <a title="Text Entity" href="#dt-parsedent">parsed entity</a>.
4905 </p>
4906 <p>Example of an internal entity declaration:</p>
4907 <div class="exampleInner">
4908 <pre>
4909 &lt;!ENTITY Pub-Status "This is a pre-release of the
4910 specification."&gt;</pre
4911 >
4912 </div>
4913 </div>
4914 <div class="div3">
4915 <h4>
4916 <a name="sec-external-ent" id="sec-external-ent" />4.2.2 External
4917 Entities
4918 </h4>
4919 <p>
4920 [<a name="dt-extent" id="dt-extent" title="External Entity"
4921 >Definition</a
4922 >: If the entity is not internal, it is an <b>external entity</b>,
4923 declared as follows:]
4924 </p>
4925 <h5>
4926 <a name="d0e4313" id="d0e4313" />External Entity Declaration
4927 </h5>
4928 <table class="scrap" summary="Scrap">
4929 <tbody>
4930 <tr valign="baseline">
4931 <td>
4932 <a
4933 name="NT-ExternalID"
4934 id="NT-ExternalID"
4935 />[75]&nbsp;&nbsp;&nbsp;
4936 </td>
4937 <td><code>ExternalID</code></td>
4938 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4939 <td>
4940 <code
4941 >'SYSTEM' <a href="#NT-S">S</a>
4942 <a href="#NT-SystemLiteral">SystemLiteral</a>
4943 </code>
4944 </td>
4945 </tr>
4946 <tr valign="baseline">
4947 <td />
4948 <td />
4949 <td />
4950 <td>
4951 <code
4952 >| 'PUBLIC' <a href="#NT-S">S</a>
4953 <a href="#NT-PubidLiteral">PubidLiteral</a>
4954 <a href="#NT-S">S</a>
4955 <a href="#NT-SystemLiteral">SystemLiteral</a>
4956 </code>
4957 </td>
4958 </tr>
4959 </tbody>
4960 <tbody>
4961 <tr valign="baseline">
4962 <td>
4963 <a
4964 name="NT-NDataDecl"
4965 id="NT-NDataDecl"
4966 />[76]&nbsp;&nbsp;&nbsp;
4967 </td>
4968 <td><code>NDataDecl</code></td>
4969 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
4970 <td>
4971 <code>
4972 <a href="#NT-S">S</a> 'NDATA' <a href="#NT-S">S</a>
4973 <a href="#NT-Name">Name</a>
4974 </code>
4975 </td>
4976 <td><a href="#not-declared">[VC: Notation Declared]</a></td>
4977 </tr>
4978 </tbody>
4979 </table>
4980 <p>
4981 If the <a href="#NT-NDataDecl">NDataDecl</a> is present, this is a
4982 general
4983 <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a
4984 >; otherwise it is a parsed entity.
4985 </p>
4986 <div class="constraint">
4987 <p class="prefix">
4988 <a name="not-declared" id="not-declared" /><b
4989 >Validity constraint: Notation Declared</b
4990 >
4991 </p>
4992 <p>
4993 The <a href="#NT-Name">Name</a>
4994 <em class="rfc2119" title="Keyword in RFC 2119 context"
4995 >MUST</em
4996 >
4997 match the declared name of a
4998 <a title="Notation" href="#dt-notation">notation</a>.
4999 </p>
5000 </div>
5001 <p>
5002 [<a name="dt-sysid" id="dt-sysid" title="System Identifier"
5003 >Definition</a
5004 >: The <a href="#NT-SystemLiteral">SystemLiteral</a> is called the
5005 entity's <b>system identifier</b>. It is meant to be converted to
5006 a URI reference (as defined in
5007 <a href="#rfc3986">[IETF RFC 3986]</a>), as part of the process of
5008 dereferencing it to obtain input for the XML processor to
5009 construct the entity's replacement text.] It is an error for a
5010 fragment identifier (beginning with a <code>#</code> character) to
5011 be part of a system identifier. Unless otherwise provided by
5012 information outside the scope of this specification (e.g. a
5013 special XML element type defined by a particular DTD, or a
5014 processing instruction defined by a particular application
5015 specification), relative URIs are relative to the location of the
5016 resource within which the entity declaration occurs. This is
5017 defined to be the external entity containing the '&lt;' which
5018 starts the declaration, at the point when it is parsed as a
5019 declaration. A URI might thus be relative to the
5020 <a title="Document Entity" href="#dt-docent">document entity</a>,
5021 to the entity containing the
5022 <a title="Document Type Declaration" href="#dt-doctype"
5023 >external DTD subset</a
5024 >, or to some other
5025 <a title="External Entity" href="#dt-extent"
5026 >external parameter entity</a
5027 >. Attempts to retrieve the resource identified by a URI may be
5028 redirected at the parser level (for example, in an entity
5029 resolver) or below (at the protocol level, for example, via an
5030 HTTP <code>Location:</code> header). In the absence of additional
5031 information outside the scope of this specification within the
5032 resource, the base URI of a resource is always the URI of the
5033 actual resource returned. In other words, it is the URI of the
5034 resource retrieved after all redirection has occurred.
5035 </p>
5036 <p>
5037 System identifiers (and other XML strings meant to be used as URI
5038 references) may contain characters that, according to
5039 <a href="#rfc3986">[IETF RFC 3986]</a>, must be escaped before a
5040 URI can be used to retrieve the referenced resource. The
5041 characters to be escaped are the control characters #x0 to #x1F
5042 and #x7F (most of which cannot appear in XML), space #x20, the
5043 delimiters '&lt;' #x3C, '&gt;' #x3E and '"' #x22, the
5044 <em>unwise</em> characters '{' #x7B, '}' #x7D, '|' #x7C, '\' #x5C,
5045 '^' #x5E and '`' #x60, as well as all characters above #x7F. Since
5046 escaping is not always a fully reversible process, it
5047 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5048 be performed only when absolutely necessary and as late as
5049 possible in a processing chain. In particular, neither the process
5050 of converting a relative URI to an absolute one nor the process of
5051 passing a URI reference to a process or software component
5052 responsible for dereferencing it
5053 <em class="rfc2119" title="Keyword in RFC 2119 context"
5054 >SHOULD</em
5055 >
5056 trigger escaping. When escaping does occur, it
5057 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5058 be performed as follows:
5059 </p>
5060 <ol class="enumar">
5061 <li>
5062 <p>
5063 Each character to be escaped is represented in UTF-8
5064 <span><a href="#Unicode">[Unicode]</a></span> as one or more
5065 bytes.
5066 </p>
5067 </li>
5068 <li>
5069 <p>
5070 The resulting bytes are escaped with the URI escaping
5071 mechanism (that is, converted to <code>%</code> <var>HH</var>,
5072 where HH is the hexadecimal notation of the byte value).
5073 </p>
5074 </li>
5075 <li>
5076 <p>
5077 The original character is replaced by the resulting character
5078 sequence.
5079 </p>
5080 </li>
5081 </ol>
5082 <div class="note">
5083 <p class="prefix"><b>Note:</b></p>
5084 <p>
5085 In a future edition of this specification, the XML Core Working
5086 Group intends to replace the preceding paragraph and list of
5087 steps with a normative reference to an upcoming revision of IETF
5088 RFC 3987, which will define "Legacy Extended IRIs (LEIRIs)".
5089 When this revision is available, it is the intent of the XML
5090 Core WG to use it to replace language similar to the above in
5091 any future revisions of XML-related specifications under its
5092 purview.
5093 </p>
5094 </div>
5095 <p>
5096 [<a name="dt-pubid" id="dt-pubid" title="Public identifier"
5097 >Definition</a
5098 >: In addition to a system identifier, an external identifier may
5099 include a <b>public identifier</b>.] An XML processor attempting
5100 to retrieve the entity's content may use any combination of the
5101 public and system identifiers as well as additional information
5102 outside the scope of this specification to try to generate an
5103 alternative URI reference. If the processor is unable to do so, it
5104 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5105 use the URI reference specified in the system literal. Before a
5106 match is attempted, all strings of white space in the public
5107 identifier
5108 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5109 be normalized to single space characters (#x20), and leading and
5110 trailing white space
5111 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5112 be removed.
5113 </p>
5114 <p>Examples of external entity declarations:</p>
5115 <div class="exampleInner">
5116 <pre>
5117 &lt;!ENTITY open-hatch
5118 SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
5119 &lt;!ENTITY open-hatch
5120 PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
5121 "http://www.textuality.com/boilerplate/OpenHatch.xml"&gt;
5122 &lt;!ENTITY hatch-pic
5123 SYSTEM "../grafix/OpenHatch.gif"
5124 NDATA gif &gt;</pre
5125 >
5126 </div>
5127 </div>
5128 </div>
5129 <div class="div2">
5130 <h3>
5131 <a name="TextEntities" id="TextEntities" />4.3 Parsed Entities
5132 </h3>
5133 <div class="div3">
5134 <h4>
5135 <a name="sec-TextDecl" id="sec-TextDecl" />4.3.1 The Text
5136 Declaration
5137 </h4>
5138 <p>
5139 External parsed entities
5140 <em class="rfc2119" title="Keyword in RFC 2119 context"
5141 >SHOULD</em
5142 >
5143 each begin with a <b>text declaration</b>.
5144 </p>
5145 <h5><a name="d0e4481" id="d0e4481" />Text Declaration</h5>
5146 <table class="scrap" summary="Scrap">
5147 <tbody>
5148 <tr valign="baseline">
5149 <td>
5150 <a
5151 name="NT-TextDecl"
5152 id="NT-TextDecl"
5153 />[77]&nbsp;&nbsp;&nbsp;
5154 </td>
5155 <td><code>TextDecl</code></td>
5156 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
5157 <td>
5158 <code
5159 >'&lt;?xml' <a href="#NT-VersionInfo">VersionInfo</a>?
5160 <a href="#NT-EncodingDecl">EncodingDecl</a>
5161 <a href="#NT-S">S</a>? '?&gt;'</code
5162 >
5163 </td>
5164 </tr>
5165 </tbody>
5166 </table>
5167 <p>
5168 The text declaration
5169 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5170 be provided literally, not by reference to a parsed entity. The
5171 text declaration
5172 <em class="rfc2119" title="Keyword in RFC 2119 context"
5173 >MUST NOT</em
5174 >
5175 appear at any position other than the beginning of an external
5176 parsed entity. The text declaration in an external parsed entity
5177 is not considered part of its
5178 <a title="Replacement Text" href="#dt-repltext"
5179 >replacement text</a
5180 >.
5181 </p>
5182 </div>
5183 <div class="div3">
5184 <h4>
5185 <a name="wf-entities" id="wf-entities" />4.3.2 Well-Formed Parsed
5186 Entities
5187 </h4>
5188 <p>
5189 The document entity is well-formed if it matches the production
5190 labeled <a href="#NT-document">document</a>. An external general
5191 parsed entity is well-formed if it matches the production labeled
5192 <a href="#NT-extParsedEnt">extParsedEnt</a>. All external
5193 parameter entities are well-formed by definition.
5194 </p>
5195 <div class="note">
5196 <p class="prefix"><b>Note:</b></p>
5197 <p>
5198 Only parsed entities that are referenced directly or indirectly
5199 within the document are required to be well-formed.
5200 </p>
5201 </div>
5202 <h5>
5203 <a name="d0e4524" id="d0e4524" />Well-Formed External Parsed
5204 Entity
5205 </h5>
5206 <table class="scrap" summary="Scrap">
5207 <tbody>
5208 <tr valign="baseline">
5209 <td>
5210 <a
5211 name="NT-extParsedEnt"
5212 id="NT-extParsedEnt"
5213 />[78]&nbsp;&nbsp;&nbsp;
5214 </td>
5215 <td><code>extParsedEnt</code></td>
5216 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
5217 <td>
5218 <code>
5219 <a href="#NT-TextDecl">TextDecl</a>?
5220 <a href="#NT-content">content</a>
5221 </code>
5222 </td>
5223 </tr>
5224 </tbody>
5225 </table>
5226 <p>
5227 An internal general parsed entity is well-formed if its
5228 replacement text matches the production labeled
5229 <a href="#NT-content">content</a>. All internal parameter entities
5230 are well-formed by definition.
5231 </p>
5232 <p>
5233 A consequence of well-formedness in general entities is that the
5234 logical and physical structures in an XML document are properly
5235 nested; no <a title="Start-Tag" href="#dt-stag">start-tag</a>,
5236 <a title="End Tag" href="#dt-etag">end-tag</a>,
5237 <a title="Empty" href="#dt-empty">empty-element tag</a>,
5238 <a title="Element" href="#dt-element">element</a>,
5239 <a title="Comment" href="#dt-comment">comment</a>,
5240 <a title="Processing instruction" href="#dt-pi"
5241 >processing instruction</a
5242 >,
5243 <a title="Character Reference" href="#dt-charref"
5244 >character reference</a
5245 >, or
5246 <a title="Entity Reference" href="#dt-entref">entity reference</a>
5247 can begin in one entity and end in another.
5248 </p>
5249 </div>
5250 <div class="div3">
5251 <h4>
5252 <a name="charencoding" id="charencoding" />4.3.3 Character
5253 Encoding in Entities
5254 </h4>
5255 <p>
5256 Each external parsed entity in an XML document may use a different
5257 encoding for its characters. All XML processors
5258 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5259 be able to read entities in both the UTF-8 and UTF-16 encodings.
5260 The terms "UTF-8" and "UTF-16" in this specification do not apply
5261 to
5262
5263 <span
5264 >related character encodings, including but not limited to
5265 UTF-16BE, UTF-16LE, or CESU-8.</span
5266 >
5267 </p>
5268 <p>
5269 Entities encoded in UTF-16
5270 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5271 and entities encoded in UTF-8
5272 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
5273 begin with the Byte Order Mark described by Annex H of
5274 <a href="#ISO10646-2000">[ISO/IEC 10646:2000]</a>, section
5275 <span>16.8</span> of <a href="#Unicode">[Unicode]</a> (the ZERO
5276 WIDTH NO-BREAK SPACE character, #xFEFF). This is an encoding
5277 signature, not part of either the markup or the character data of
5278 the XML document. XML processors
5279 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5280 be able to use this character to differentiate between UTF-8 and
5281 UTF-16 encoded documents.
5282 </p>
5283 <p>
5284 If the replacement text of an external entity is to begin with the
5285 character U+FEFF, and no text declaration is present, then a Byte
5286 Order Mark MUST be present, whether the entity is encoded in UTF-8
5287 or UTF-16.
5288 </p>
5289 <p>
5290 Although an XML processor is required to read only entities in the
5291 UTF-8 and UTF-16 encodings, it is recognized that other encodings
5292 are used around the world, and it may be desired for XML
5293 processors to read entities that use them. In the absence of
5294 external character encoding information (such as MIME headers),
5295 parsed entities which are stored in an encoding other than UTF-8
5296 or UTF-16
5297 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5298 begin with a text declaration (see
5299 <a href="#sec-TextDecl"><b>4.3.1 The Text Declaration</b></a
5300 >) containing an encoding declaration:
5301 </p>
5302 <h5><a name="d0e4623" id="d0e4623" />Encoding Declaration</h5>
5303 <table class="scrap" summary="Scrap">
5304 <tbody>
5305 <tr valign="baseline">
5306 <td>
5307 <a
5308 name="NT-EncodingDecl"
5309 id="NT-EncodingDecl"
5310 />[80]&nbsp;&nbsp;&nbsp;
5311 </td>
5312 <td><code>EncodingDecl</code></td>
5313 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
5314 <td>
5315 <code>
5316 <a href="#NT-S">S</a> 'encoding'
5317 <a href="#NT-Eq">Eq</a> ('"'
5318 <a href="#NT-EncName">EncName</a> '"' | "'"
5319 <a href="#NT-EncName">EncName</a> "'" )
5320 </code>
5321 </td>
5322 </tr>
5323 </tbody>
5324 <tbody>
5325 <tr valign="baseline">
5326 <td>
5327 <a
5328 name="NT-EncName"
5329 id="NT-EncName"
5330 />[81]&nbsp;&nbsp;&nbsp;
5331 </td>
5332 <td><code>EncName</code></td>
5333 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
5334 <td><code>[A-Za-z] ([A-Za-z0-9._] | '-')*</code></td>
5335 <td>
5336 <i>/* Encoding name contains only Latin characters */</i>
5337 </td>
5338 </tr>
5339 </tbody>
5340 </table>
5341 <p>
5342 In the
5343 <a title="Document Entity" href="#dt-docent">document entity</a>,
5344 the encoding declaration is part of the
5345 <a title="XML Declaration" href="#dt-xmldecl">XML declaration</a>.
5346 The <a href="#NT-EncName">EncName</a> is the name of the encoding
5347 used.
5348 </p>
5349 <p>
5350 In an encoding declaration, the values "
5351 <code>UTF-8</code>
5352 ", "
5353 <code>UTF-16</code>
5354 ", "
5355 <code>ISO-10646-UCS-2</code>
5356 ", and "
5357 <code>ISO-10646-UCS-4</code>
5358 "
5359 <em class="rfc2119" title="Keyword in RFC 2119 context"
5360 >SHOULD</em
5361 >
5362 be used for the various encodings and transformations of Unicode /
5363 ISO/IEC 10646, the values "
5364 <code>ISO-8859-1</code>
5365 ", "
5366 <code>ISO-8859-2</code>
5367 ", ... "
5368 <code>ISO-8859-</code>
5369 <var>n</var>
5370 " (where <var>n</var> is the part number)
5371 <em class="rfc2119" title="Keyword in RFC 2119 context"
5372 >SHOULD</em
5373 >
5374 be used for the parts of ISO 8859, and the values "
5375 <code>ISO-2022-JP</code>
5376 ", "
5377 <code>Shift_JIS</code>
5378 ", and "
5379 <code>EUC-JP</code>
5380 "
5381 <em class="rfc2119" title="Keyword in RFC 2119 context"
5382 >SHOULD</em
5383 >
5384 be used for the various encoded forms of JIS X-0208-1997. It is
5385 <em class="rfc2119" title="Keyword in RFC 2119 context"
5386 >RECOMMENDED</em
5387 >
5388 that character encodings registered (as <em>charset</em>s) with
5389 the Internet Assigned Numbers Authority
5390 <a href="#IANA">[IANA-CHARSETS]</a>, other than those just listed,
5391 be referred to using their registered names; other encodings
5392 <em class="rfc2119" title="Keyword in RFC 2119 context"
5393 >SHOULD</em
5394 >
5395 use names starting with an "x-" prefix. XML processors
5396 <em class="rfc2119" title="Keyword in RFC 2119 context"
5397 >SHOULD</em
5398 >
5399 match character encoding names in a case-insensitive way and
5400 <em class="rfc2119" title="Keyword in RFC 2119 context"
5401 >SHOULD</em
5402 >
5403 either interpret an IANA-registered name as the encoding
5404 registered at IANA for that name or treat it as unknown
5405 (processors are, of course, not required to support all
5406 IANA-registered encodings).
5407 </p>
5408 <p>
5409 In the absence of information provided by an external transport
5410 protocol (e.g. HTTP or MIME), it is a
5411 <a title="Fatal Error" href="#dt-fatal">fatal error</a> for an
5412 entity including an encoding declaration to be presented to the
5413 XML processor in an encoding other than that named in the
5414 declaration, or for an entity which begins with neither a Byte
5415 Order Mark nor an encoding declaration to use an encoding other
5416 than UTF-8. Note that since ASCII is a subset of UTF-8, ordinary
5417 ASCII entities do not strictly need an encoding declaration.
5418 </p>
5419 <p>
5420 It is a
5421 <a title="Fatal Error" href="#dt-fatal">fatal error</a> for a
5422 <a href="#NT-TextDecl">TextDecl</a> to occur other than at the
5423 beginning of an external entity.
5424 </p>
5425 <p>
5426 It is a
5427 <a title="Fatal Error" href="#dt-fatal">fatal error</a> when an
5428 XML processor encounters an entity with an encoding that it is
5429 unable to process. It is a
5430 <a title="Fatal Error" href="#dt-fatal">fatal error</a> if an XML
5431 entity is determined (via default, encoding declaration, or
5432 higher-level protocol) to be in a certain encoding but contains
5433 byte sequences that are not legal in that encoding. Specifically,
5434 it is a fatal error if an entity encoded in UTF-8 contains any
5435 <span>ill-formed</span> code unit sequences, as defined in
5436 <span>section 3.9 of </span> Unicode
5437 <span><a href="#Unicode">[Unicode]</a></span
5438 >. Unless an encoding is determined by a higher-level protocol, it
5439 is also a
5440 <a title="Fatal Error" href="#dt-fatal">fatal error</a> if an XML
5441 entity contains no encoding declaration and its content is not
5442 legal UTF-8 or UTF-16.
5443 </p>
5444 <p>
5445 Examples of text declarations containing encoding declarations:
5446 </p>
5447 <div class="exampleInner">
5448 <pre>
5449 &lt;?xml encoding='UTF-8'?&gt;
5450 &lt;?xml encoding='EUC-JP'?&gt;</pre
5451 >
5452 </div>
5453 </div>
5454 </div>
5455 <div class="div2">
5456 <h3>
5457 <a name="entproc" id="entproc" />4.4 XML Processor Treatment of
5458 Entities and References
5459 </h3>
5460 <p>
5461 The table below summarizes the contexts in which character
5462 references, entity references, and invocations of unparsed entities
5463 might appear and the
5464 <em class="rfc2119" title="Keyword in RFC 2119 context"
5465 >REQUIRED</em
5466 >
5467 behavior of an
5468 <a title="XML Processor" href="#dt-xml-proc">XML processor</a> in
5469 each case. The labels in the leftmost column describe the
5470 recognition context:
5471 </p>
5472 <dl>
5473 <dt class="label">Reference in Content</dt>
5474 <dd>
5475 <p>
5476 as a reference anywhere after the
5477 <a title="Start-Tag" href="#dt-stag">start-tag</a> and before
5478 the <a title="End Tag" href="#dt-etag">end-tag</a> of an
5479 element; corresponds to the nonterminal
5480 <a href="#NT-content">content</a>.
5481 </p>
5482 </dd>
5483 <dt class="label">Reference in Attribute Value</dt>
5484 <dd>
5485 <p>
5486 as a reference within either the value of an attribute in a
5487 <a title="Start-Tag" href="#dt-stag">start-tag</a>, or a default
5488 value in an
5489 <a title="Attribute-List Declaration" href="#dt-attdecl"
5490 >attribute declaration</a
5491 >; corresponds to the nonterminal
5492 <a href="#NT-AttValue">AttValue</a>.
5493 </p>
5494 </dd>
5495 <dt class="label">Occurs as Attribute Value</dt>
5496 <dd>
5497 <p>
5498 as a <a href="#NT-Name">Name</a>, not a reference, appearing
5499 either as the value of an attribute which has been declared as
5500 type <b>ENTITY</b>, or as one of the space-separated tokens in
5501 the value of an attribute which has been declared as type
5502 <b>ENTITIES</b>.
5503 </p>
5504 </dd>
5505 <dt class="label">Reference in Entity Value</dt>
5506 <dd>
5507 <p>
5508 as a reference within a parameter or internal entity's
5509 <a title="Literal Entity Value" href="#dt-litentval"
5510 >literal entity value</a
5511 >
5512 in the entity's declaration; corresponds to the nonterminal
5513 <a href="#NT-EntityValue">EntityValue</a>.
5514 </p>
5515 </dd>
5516 <dt class="label">Reference in DTD</dt>
5517 <dd>
5518 <p>
5519 as a reference within either the internal or external subsets of
5520 the
5521 <a title="Document Type Declaration" href="#dt-doctype">DTD</a>,
5522 but outside of an <a href="#NT-EntityValue">EntityValue</a>,
5523 <a href="#NT-AttValue">AttValue</a>, <a href="#NT-PI">PI</a>,
5524 <a href="#NT-Comment">Comment</a>,
5525 <a href="#NT-SystemLiteral">SystemLiteral</a>,
5526 <a href="#NT-PubidLiteral">PubidLiteral</a>, or the contents of
5527 an ignored conditional section (see
5528 <a href="#sec-condition-sect"><b>3.4 Conditional Sections</b></a
5529 >).
5530 </p>
5531 <p>.</p>
5532 </dd>
5533 </dl>
5534 <p></p>
5535 <table border="1" frame="border" cellpadding="7">
5536 <tbody align="center">
5537 <tr>
5538 <td rowspan="2" />
5539 <td colspan="4" align="center" valign="bottom">Entity Type</td>
5540 <td rowspan="2" align="center">Character</td>
5541 </tr>
5542 <tr align="center" valign="bottom">
5543 <td>Parameter</td>
5544 <td>Internal General</td>
5545 <td>External Parsed General</td>
5546 <td>Unparsed</td>
5547 </tr>
5548 <tr align="center" valign="middle">
5549 <td align="right">Reference in Content</td>
5550 <td>
5551 <a href="#not-recognized"><cite>Not recognized</cite></a>
5552 </td>
5553 <td>
5554 <a href="#included"><cite>Included</cite></a>
5555 </td>
5556 <td>
5557 <a href="#include-if-valid"
5558 ><cite>Included if validating</cite></a
5559 >
5560 </td>
5561 <td>
5562 <a href="#forbidden"><cite>Forbidden</cite></a>
5563 </td>
5564 <td>
5565 <a href="#included"><cite>Included</cite></a>
5566 </td>
5567 </tr>
5568 <tr align="center" valign="middle">
5569 <td align="right">Reference in Attribute Value</td>
5570 <td>
5571 <a href="#not-recognized"><cite>Not recognized</cite></a>
5572 </td>
5573 <td>
5574 <a href="#inliteral"><cite>Included in literal</cite></a>
5575 </td>
5576 <td>
5577 <a href="#forbidden"><cite>Forbidden</cite></a>
5578 </td>
5579 <td>
5580 <a href="#forbidden"><cite>Forbidden</cite></a>
5581 </td>
5582 <td>
5583 <a href="#included"><cite>Included</cite></a>
5584 </td>
5585 </tr>
5586 <tr align="center" valign="middle">
5587 <td align="right">Occurs as Attribute Value</td>
5588 <td>
5589 <a href="#not-recognized"><cite>Not recognized</cite></a>
5590 </td>
5591 <td>
5592 <a href="#forbidden"><cite>Forbidden</cite></a>
5593 </td>
5594 <td>
5595 <a href="#forbidden"><cite>Forbidden</cite></a>
5596 </td>
5597 <td>
5598 <a href="#notify"><cite>Notify</cite></a>
5599 </td>
5600 <td>
5601 <a href="#not-recognized"><cite>Not recognized</cite></a>
5602 </td>
5603 </tr>
5604 <tr align="center" valign="middle">
5605 <td align="right">Reference in EntityValue</td>
5606 <td>
5607 <a href="#inliteral"><cite>Included in literal</cite></a>
5608 </td>
5609 <td>
5610 <a href="#bypass"><cite>Bypassed</cite></a>
5611 </td>
5612 <td>
5613 <a href="#bypass"><cite>Bypassed</cite></a>
5614 </td>
5615 <td>
5616 <a href="#error"><cite>Error</cite></a>
5617 </td>
5618 <td>
5619 <a href="#included"><cite>Included</cite></a>
5620 </td>
5621 </tr>
5622 <tr align="center" valign="middle">
5623 <td align="right">Reference in DTD</td>
5624 <td>
5625 <a href="#as-PE"><cite>Included as PE</cite></a>
5626 </td>
5627 <td>
5628 <a href="#forbidden"><cite>Forbidden</cite></a>
5629 </td>
5630 <td>
5631 <a href="#forbidden"><cite>Forbidden</cite></a>
5632 </td>
5633 <td>
5634 <a href="#forbidden"><cite>Forbidden</cite></a>
5635 </td>
5636 <td>
5637 <a href="#forbidden"><cite>Forbidden</cite></a>
5638 </td>
5639 </tr>
5640 </tbody>
5641 </table>
5642 <div class="div3">
5643 <h4>
5644 <a name="not-recognized" id="not-recognized" />4.4.1 Not
5645 Recognized
5646 </h4>
5647 <p>
5648 Outside the DTD, the <code>%</code> character has no special
5649 significance; thus, what would be parameter entity references in
5650 the DTD are not recognized as markup in
5651 <a href="#NT-content">content</a>. Similarly, the names of
5652 unparsed entities are not recognized except when they appear in
5653 the value of an appropriately declared attribute.
5654 </p>
5655 </div>
5656 <div class="div3">
5657 <h4><a name="included" id="included" />4.4.2 Included</h4>
5658 <p>
5659 [<a name="dt-include" id="dt-include" title="Include"
5660 >Definition</a
5661 >: An entity is <b>included</b> when its
5662 <a title="Replacement Text" href="#dt-repltext"
5663 >replacement text</a
5664 >
5665 is retrieved and processed, in place of the reference itself, as
5666 though it were part of the document at the location the reference
5667 was recognized.] The replacement text may contain both
5668 <a title="Character Data" href="#dt-chardata">character data</a>
5669 and (except for parameter entities)
5670 <a title="Markup" href="#dt-markup">markup</a>, which
5671 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5672 be recognized in the usual way. (The string "
5673 <code>AT&amp;amp;T;</code>
5674 " expands to "
5675 <code>AT&amp;T;</code>
5676 " and the remaining ampersand is not recognized as an
5677 entity-reference delimiter.) A character reference is
5678 <b>included</b> when the indicated character is processed in place
5679 of the reference itself.
5680 </p>
5681 </div>
5682 <div class="div3">
5683 <h4>
5684 <a name="include-if-valid" id="include-if-valid" />4.4.3 Included
5685 If Validating
5686 </h4>
5687 <p>
5688 When an XML processor recognizes a reference to a parsed entity,
5689 in order to <a title="Validity" href="#dt-valid">validate</a> the
5690 document, the processor
5691 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5692 <a title="Include" href="#dt-include">include</a> its replacement
5693 text. If the entity is external, and the processor is not
5694 attempting to validate the XML document, the processor
5695 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>,
5696 but need not, include the entity's replacement text. If a
5697 non-validating processor does not include the replacement text, it
5698 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5699 inform the application that it recognized, but did not read, the
5700 entity.
5701 </p>
5702 <p>
5703 This rule is based on the recognition that the automatic inclusion
5704 provided by the SGML and XML entity mechanism, primarily designed
5705 to support modularity in authoring, is not necessarily appropriate
5706 for other applications, in particular document browsing. Browsers,
5707 for example, when encountering an external parsed entity
5708 reference, might choose to provide a visual indication of the
5709 entity's presence and retrieve it for display only on demand.
5710 </p>
5711 </div>
5712 <div class="div3">
5713 <h4><a name="forbidden" id="forbidden" />4.4.4 Forbidden</h4>
5714 <p>
5715 The following are forbidden, and constitute
5716 <a title="Fatal Error" href="#dt-fatal">fatal errors</a>:
5717 </p>
5718 <ul>
5719 <li>
5720 <p>
5721 the appearance of a reference to an
5722 <a title="Unparsed Entity" href="#dt-unparsed"
5723 >unparsed entity</a
5724 >, except in the <a href="#NT-EntityValue">EntityValue</a> in
5725 an entity declaration.
5726 </p>
5727 </li>
5728 <li>
5729 <p>
5730 the appearance of any character or general-entity reference in
5731 the DTD except within an
5732 <a href="#NT-EntityValue">EntityValue</a> or
5733 <a href="#NT-AttValue">AttValue</a>.
5734 </p>
5735 </li>
5736 <li>
5737 <p>a reference to an external entity in an attribute value.</p>
5738 </li>
5739 </ul>
5740 </div>
5741 <div class="div3">
5742 <h4>
5743 <a name="inliteral" id="inliteral" />4.4.5 Included in Literal
5744 </h4>
5745 <p>
5746 When an
5747 <a title="Entity Reference" href="#dt-entref">entity reference</a>
5748 appears in an attribute value, or a parameter entity reference
5749 appears in a literal entity value, its
5750 <a title="Replacement Text" href="#dt-repltext"
5751 >replacement text</a
5752 >
5753 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5754 be processed in place of the reference itself as though it were
5755 part of the document at the location the reference was recognized,
5756 except that a single or double quote character in the replacement
5757 text
5758 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5759 always be treated as a normal data character and
5760 <em class="rfc2119" title="Keyword in RFC 2119 context"
5761 >MUST NOT</em
5762 >
5763 terminate the literal. For example, this is well-formed:
5764 </p>
5765 <div class="exampleInner">
5766 <pre>
5767 &lt;!ENTITY % YN '"Yes"' &gt;
5768 &lt;!ENTITY WhatHeSaid "He said %YN;" &gt;</pre
5769 >
5770 </div>
5771 <p>while this is not:</p>
5772 <div class="exampleInner">
5773 <pre>
5774 &lt;!ENTITY EndAttr "27'" &gt;
5775 &lt;element attribute='a-&amp;EndAttr;&gt;</pre
5776 >
5777 </div>
5778 </div>
5779 <div class="div3">
5780 <h4><a name="notify" id="notify" />4.4.6 Notify</h4>
5781 <p>
5782 When the name of an
5783 <a title="Unparsed Entity" href="#dt-unparsed">unparsed entity</a>
5784 appears as a token in the value of an attribute of declared type
5785 <b>ENTITY</b> or <b>ENTITIES</b>, a validating processor
5786 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5787 inform the application of the
5788 <a title="System Identifier" href="#dt-sysid">system</a> and
5789 <a title="Public identifier" href="#dt-pubid">public</a> (if any)
5790 identifiers for both the entity and its associated
5791 <a title="Notation" href="#dt-notation">notation</a>.
5792 </p>
5793 </div>
5794 <div class="div3">
5795 <h4><a name="bypass" id="bypass" />4.4.7 Bypassed</h4>
5796 <p>
5797 When a general entity reference appears in the
5798 <a href="#NT-EntityValue">EntityValue</a> in an entity
5799 declaration, it
5800 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5801 be bypassed and left as is.
5802 </p>
5803 </div>
5804 <div class="div3">
5805 <h4><a name="as-PE" id="as-PE" />4.4.8 Included as PE</h4>
5806 <p>
5807 Just as with external parsed entities, parameter entities need
5808 only be
5809 <a href="#include-if-valid"><cite>included if validating</cite></a
5810 >. When a parameter-entity reference is recognized in the DTD and
5811 included, its
5812 <a title="Replacement Text" href="#dt-repltext"
5813 >replacement text</a
5814 >
5815 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5816 be enlarged by the attachment of one leading and one following
5817 space (#x20) character; the intent is to constrain the replacement
5818 text of parameter entities to contain an integral number of
5819 grammatical tokens in the DTD. This behavior
5820 <em class="rfc2119" title="Keyword in RFC 2119 context"
5821 >MUST NOT</em
5822 >
5823 apply to parameter entity references within entity values; these
5824 are described in
5825 <a href="#inliteral"><b>4.4.5 Included in Literal</b></a
5826 >.
5827 </p>
5828 </div>
5829 <div class="div3">
5830 <h4><a name="error" id="error" />4.4.9 Error</h4>
5831 <p>
5832 It is an <a title="Error" href="#dt-error">error</a> for a
5833 reference to an unparsed entity to appear in the
5834 <a href="#NT-EntityValue">EntityValue</a> in an entity
5835 declaration.
5836 </p>
5837 </div>
5838 </div>
5839 <div class="div2">
5840 <h3>
5841 <a name="intern-replacement" id="intern-replacement" />4.5
5842 Construction of Entity Replacement Text
5843 </h3>
5844 <p>
5845 In discussing the treatment of entities, it is useful to distinguish
5846 two forms of the entity's value. [<a
5847 name="dt-litentval"
5848 id="dt-litentval"
5849 title="Literal Entity Value"
5850 >Definition</a
5851 >: For an internal entity, the <b>literal entity value</b> is the
5852 quoted string actually present in the entity declaration,
5853 corresponding to the non-terminal
5854 <a href="#NT-EntityValue">EntityValue</a>.] [<a
5855 name="dt-extlitentval"
5856 id="dt-extlitentval"
5857 title="Literal Entity Value"
5858 >Definition</a
5859 >: For an external entity, the <b>literal entity value</b> is the
5860 exact text contained in the entity.] [<a
5861 name="dt-repltext"
5862 id="dt-repltext"
5863 title="Replacement Text"
5864 >Definition</a
5865 >: For an internal entity, the <b>replacement text</b> is the
5866 content of the entity, after replacement of character references and
5867 parameter-entity references.] [<a
5868 name="dt-extrepltext"
5869 id="dt-extrepltext"
5870 title="Replacement Text"
5871 >Definition</a
5872 >: For an external entity, the <b>replacement text</b> is the
5873 content of the entity, after stripping the text declaration (leaving
5874 any surrounding whitespace) if there is one but without any
5875 replacement of character references or parameter-entity references.]
5876 </p>
5877 <p>
5878 The literal entity value as given in an internal entity declaration
5879 (<a href="#NT-EntityValue">EntityValue</a>) may contain character,
5880 parameter-entity, and general-entity references. Such references
5881 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
5882 contained entirely within the literal entity value. The actual
5883 replacement text that is
5884 <a title="Include" href="#dt-include">included</a> (or
5885 <a title="" href="#inliteral">included in literal</a>) as described
5886 above
5887 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5888 contain the <em>replacement text</em> of any parameter entities
5889 referred to, and
5890 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5891 contain the character referred to, in place of any character
5892 references in the literal entity value; however, general-entity
5893 references
5894 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
5895 left as-is, unexpanded. For example, given the following
5896 declarations:
5897 </p>
5898 <div class="exampleInner">
5899 <pre>
5900 &lt;!ENTITY % pub "&amp;#xc9;ditions Gallimard" &gt;
5901 &lt;!ENTITY rights "All rights reserved" &gt;
5902 &lt;!ENTITY book "La Peste: Albert Camus,
5903 &amp;#xA9; 1947 %pub;. &amp;rights;" &gt;</pre
5904 >
5905 </div>
5906 <p>
5907 then the replacement text for the entity "
5908 <code>book</code>
5909 " is:
5910 </p>
5911 <div class="exampleInner">
5912 <pre>
5913 La Peste: Albert Camus,
5914 © 1947 Éditions Gallimard. &amp;rights;</pre
5915 >
5916 </div>
5917 <p>
5918 The general-entity reference "
5919 <code>&amp;rights;</code>
5920 " would be expanded should the reference "
5921 <code>&amp;book;</code>
5922 " appear in the document's content or an attribute value.
5923 </p>
5924 <p>
5925 These simple rules may have complex interactions; for a detailed
5926 discussion of a difficult example, see
5927 <a href="#sec-entexpand"
5928 ><b>D Expansion of Entity and Character References</b></a
5929 >.
5930 </p>
5931 </div>
5932 <div class="div2">
5933 <h3>
5934 <a name="sec-predefined-ent" id="sec-predefined-ent" />4.6
5935 Predefined Entities
5936 </h3>
5937 <p>
5938 [<a name="dt-escape" id="dt-escape" title="escape">Definition</a>:
5939 Entity and character references may both be used to
5940 <b>escape</b> the left angle bracket, ampersand, and other
5941 delimiters. A set of general entities (<code>amp</code>,
5942 <code>lt</code>, <code>gt</code>, <code>apos</code>,
5943 <code>quot</code>) is specified for this purpose. Numeric character
5944 references may also be used; they are expanded immediately when
5945 recognized and
5946 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
5947 treated as character data, so the numeric character references "
5948 <code>&amp;#60;</code>
5949 " and "
5950 <code>&amp;#38;</code>
5951 " may be used to escape <code>&lt;</code> and
5952 <code>&amp;</code> when they occur in character data.]
5953 </p>
5954 <p>
5955 All XML processors
5956 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
5957 recognize these entities whether they are declared or not.
5958 <a title="For interoperability" href="#dt-interop"
5959 >For interoperability</a
5960 >, valid XML documents
5961 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>
5962 declare these entities, like any others, before using them. If the
5963 entities <code>lt</code> or <code>amp</code> are declared, they
5964 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
5965 declared as internal entities whose replacement text is a character
5966 reference to the respective character (less-than sign or ampersand)
5967 being escaped; the double escaping is
5968 <em class="rfc2119" title="Keyword in RFC 2119 context"
5969 >REQUIRED</em
5970 >
5971 for these entities so that references to them produce a well-formed
5972 result. If the entities <code>gt</code>, <code>apos</code>, or
5973 <code>quot</code> are declared, they
5974 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be
5975 declared as internal entities whose replacement text is the single
5976 character being escaped (or a character reference to that character;
5977 the double escaping here is
5978 <em class="rfc2119" title="Keyword in RFC 2119 context"
5979 >OPTIONAL</em
5980 >
5981 but harmless). For example:
5982 </p>
5983 <div class="exampleInner">
5984 <pre>
5985 &lt;!ENTITY lt "&amp;#38;#60;"&gt;
5986 &lt;!ENTITY gt "&amp;#62;"&gt;
5987 &lt;!ENTITY amp "&amp;#38;#38;"&gt;
5988 &lt;!ENTITY apos "&amp;#39;"&gt;
5989 &lt;!ENTITY quot "&amp;#34;"&gt;</pre
5990 >
5991 </div>
5992 </div>
5993 <div class="div2">
5994 <h3>
5995 <a name="Notations" id="Notations" />4.7 Notation Declarations
5996 </h3>
5997 <p>
5998 [<a name="dt-notation" id="dt-notation" title="Notation"
5999 >Definition</a
6000 >: <b>Notations</b> identify by name the format of
6001 <a title="Unparsed Entity" href="#dt-unparsed">unparsed entities</a
6002 >, the format of elements which bear a notation attribute, or the
6003 application to which a
6004 <a title="Processing instruction" href="#dt-pi"
6005 >processing instruction</a
6006 >
6007 is addressed.]
6008 </p>
6009 <p>
6010 [<a name="dt-notdecl" id="dt-notdecl" title="Notation Declaration"
6011 >Definition</a
6012 >:
6013 <b>Notation declarations</b>
6014 provide a name for the notation, for use in entity and
6015 attribute-list declarations and in attribute specifications, and an
6016 external identifier for the notation which may allow an XML
6017 processor or its client application to locate a helper application
6018 capable of processing data in the given notation.]
6019 </p>
6020 <h5><a name="d0e5457" id="d0e5457" />Notation Declarations</h5>
6021 <table class="scrap" summary="Scrap">
6022 <tbody>
6023 <tr valign="baseline">
6024 <td>
6025 <a
6026 name="NT-NotationDecl"
6027 id="NT-NotationDecl"
6028 />[82]&nbsp;&nbsp;&nbsp;
6029 </td>
6030 <td><code>NotationDecl</code></td>
6031 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6032 <td>
6033 <code
6034 >'&lt;!NOTATION' <a href="#NT-S">S</a>
6035 <a href="#NT-Name">Name</a>
6036 <a href="#NT-S">S</a> (<a href="#NT-ExternalID"
6037 >ExternalID</a
6038 >
6039 | <a href="#NT-PublicID">PublicID</a>)
6040 <a href="#NT-S">S</a>? '&gt;'</code
6041 >
6042 </td>
6043 <td>
6044 <a href="#UniqueNotationName">[VC: Unique Notation Name]</a>
6045 </td>
6046 </tr>
6047 </tbody>
6048 <tbody>
6049 <tr valign="baseline">
6050 <td>
6051 <a
6052 name="NT-PublicID"
6053 id="NT-PublicID"
6054 />[83]&nbsp;&nbsp;&nbsp;
6055 </td>
6056 <td><code>PublicID</code></td>
6057 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6058 <td>
6059 <code
6060 >'PUBLIC' <a href="#NT-S">S</a>
6061 <a href="#NT-PubidLiteral">PubidLiteral</a>
6062 </code>
6063 </td>
6064 </tr>
6065 </tbody>
6066 </table>
6067 <div class="constraint">
6068 <p class="prefix">
6069 <a name="UniqueNotationName" id="UniqueNotationName" /><b
6070 >Validity constraint: Unique Notation Name</b
6071 >
6072 </p>
6073 <p>
6074 A given <a href="#NT-Name">Name</a>
6075 <em class="rfc2119" title="Keyword in RFC 2119 context"
6076 >MUST NOT</em
6077 >
6078 be declared in more than one notation declaration.
6079 </p>
6080 </div>
6081 <p>
6082 XML processors
6083 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
6084 provide applications with the name and external identifier(s) of any
6085 notation declared and referred to in an attribute value, attribute
6086 definition, or entity declaration. They
6087 <em class="rfc2119" title="Keyword in RFC 2119 context">MAY</em>
6088 additionally resolve the external identifier into the
6089 <a title="System Identifier" href="#dt-sysid">system identifier</a>,
6090 file name, or other information needed to allow the application to
6091 call a processor for data in the notation described. (It is not an
6092 error, however, for XML documents to declare and refer to notations
6093 for which notation-specific applications are not available on the
6094 system where the XML processor or application is running.)
6095 </p>
6096 </div>
6097 <div class="div2">
6098 <h3>
6099 <a name="sec-doc-entity" id="sec-doc-entity" />4.8 Document Entity
6100 </h3>
6101 <p>
6102 [<a name="dt-docent" id="dt-docent" title="Document Entity"
6103 >Definition</a
6104 >: The <b>document entity</b> serves as the root of the entity tree
6105 and a starting-point for an
6106 <a title="XML Processor" href="#dt-xml-proc">XML processor</a>.]
6107 This specification does not specify how the document entity is to be
6108 located by an XML processor; unlike other entities, the document
6109 entity has no name and might well appear on a processor input stream
6110 without any identification at all.
6111 </p>
6112 </div>
6113 </div>
6114 <div class="div1">
6115 <h2><a name="sec-conformance" id="sec-conformance" />5 Conformance</h2>
6116 <div class="div2">
6117 <h3>
6118 <a name="proc-types" id="proc-types" />5.1 Validating and
6119 Non-Validating Processors
6120 </h3>
6121 <p>
6122 Conforming
6123 <a title="XML Processor" href="#dt-xml-proc">XML processors</a> fall
6124 into two classes: validating and non-validating.
6125 </p>
6126 <p>
6127 Validating and non-validating processors alike
6128 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
6129 report violations of this specification's well-formedness
6130 constraints in the content of the
6131 <a title="Document Entity" href="#dt-docent">document entity</a> and
6132 any other
6133 <a title="Text Entity" href="#dt-parsedent">parsed entities</a> that
6134 they read.
6135 </p>
6136 <p>
6137 [<a
6138 name="dt-validating"
6139 id="dt-validating"
6140 title="Validating Processor"
6141 >Definition</a
6142 >:
6143 <b>Validating processors</b>
6144 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>,
6145 at user option, report violations of the constraints expressed by
6146 the declarations in the
6147 <a title="Document Type Declaration" href="#dt-doctype">DTD</a>, and
6148 failures to fulfill the validity constraints given in this
6149 specification.] To accomplish this, validating XML processors
6150 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
6151 read and process the entire DTD and all external parsed entities
6152 referenced in the document.
6153 </p>
6154 <p>
6155 Non-validating processors are
6156 <em class="rfc2119" title="Keyword in RFC 2119 context"
6157 >REQUIRED</em
6158 >
6159 to check only the
6160 <a title="Document Entity" href="#dt-docent">document entity</a>,
6161 including the entire internal DTD subset, for well-formedness. [<a
6162 name="dt-use-mdecl"
6163 id="dt-use-mdecl"
6164 title="Process Declarations"
6165 >Definition</a
6166 >: While they are not required to check the document for validity,
6167 they are
6168 <em class="rfc2119" title="Keyword in RFC 2119 context"
6169 >REQUIRED</em
6170 >
6171 to <b>process</b> all the declarations they read in the internal DTD
6172 subset and in any parameter entity that they read, up to the first
6173 reference to a parameter entity that they do <em>not</em> read; that
6174 is to say, they
6175 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
6176 use the information in those declarations to
6177 <a href="#AVNormalize"><cite>normalize</cite></a> attribute values,
6178 <a href="#included"><cite>include</cite></a> the replacement text of
6179 internal entities, and supply
6180 <a href="#sec-attr-defaults"
6181 ><cite>default attribute values</cite></a
6182 >.] Except when <code>standalone="yes"</code>, they
6183 <em class="rfc2119" title="Keyword in RFC 2119 context"
6184 >MUST NOT</em
6185 >
6186 <a title="Process Declarations" href="#dt-use-mdecl">process</a>
6187 <a title="entity declaration" href="#dt-entdecl"
6188 >entity declarations</a
6189 >
6190 or
6191 <a title="Attribute-List Declaration" href="#dt-attdecl"
6192 >attribute-list declarations</a
6193 >
6194 encountered after a reference to a parameter entity that is not
6195 read, since the entity may have contained overriding declarations;
6196 when <code>standalone="yes"</code>, processors
6197 <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em>
6198 process these declarations.
6199 </p>
6200 <p>
6201 Note that when processing invalid documents with a non-validating
6202 processor the application may not be presented with consistent
6203 information. For example, several requirements for uniqueness within
6204 the document may not be met, including more than one element with
6205 the same id, duplicate declarations of elements or notations with
6206 the same name, etc. In these cases the behavior of the parser with
6207 respect to reporting such information to the application is
6208 undefined.
6209 </p>
6210 </div>
6211 <div class="div2">
6212 <h3>
6213 <a name="safe-behavior" id="safe-behavior" />5.2 Using XML
6214 Processors
6215 </h3>
6216 <p>
6217 The behavior of a validating XML processor is highly predictable; it
6218 must read every piece of a document and report all well-formedness
6219 and validity violations. Less is required of a non-validating
6220 processor; it need not read any part of the document other than the
6221 document entity. This has two effects that may be important to users
6222 of XML processors:
6223 </p>
6224 <ul>
6225 <li>
6226 <p>
6227 Certain well-formedness errors, specifically those that require
6228 reading external entities, may fail to be detected by a
6229 non-validating processor. Examples include the constraints
6230 entitled
6231 <a href="#wf-entdeclared"><cite>Entity Declared</cite></a
6232 >, <a href="#textent"><cite>Parsed Entity</cite></a
6233 >, and <a href="#norecursion"><cite>No Recursion</cite></a
6234 >, as well as some of the cases described as
6235 <a href="#forbidden"><cite>forbidden</cite></a> in
6236 <a href="#entproc"
6237 ><b
6238 >4.4 XML Processor Treatment of Entities and References</b
6239 ></a
6240 >.
6241 </p>
6242 </li>
6243 <li>
6244 <p>
6245 The information passed from the processor to the application may
6246 vary, depending on whether the processor reads parameter and
6247 external entities. For example, a non-validating processor may
6248 fail to
6249 <a href="#AVNormalize"><cite>normalize</cite></a> attribute
6250 values, <a href="#included"><cite>include</cite></a> the
6251 replacement text of internal entities, or supply
6252 <a href="#sec-attr-defaults"
6253 ><cite>default attribute values</cite></a
6254 >, where doing so depends on having read declarations in
6255 external or parameter entities<span
6256 >, or in the internal subset after an unread parameter entity
6257 reference</span
6258 >.
6259 </p>
6260 </li>
6261 </ul>
6262 <p>
6263 For maximum reliability in interoperating between different XML
6264 processors, applications which use non-validating processors
6265 <em class="rfc2119" title="Keyword in RFC 2119 context"
6266 >SHOULD NOT</em
6267 >
6268 rely on any behaviors not required of such processors. Applications
6269 which require DTD facilities not related to validation (such as the
6270 declaration of default attributes and internal entities that are or
6271 may be specified in external entities)
6272 <em class="rfc2119" title="Keyword in RFC 2119 context">SHOULD</em>
6273 use validating XML processors.
6274 </p>
6275 </div>
6276 </div>
6277 <div class="div1">
6278 <h2><a name="sec-notation" id="sec-notation" />6 Notation</h2>
6279 <p>
6280 The formal grammar of XML is given in this specification using a
6281 simple Extended Backus-Naur Form (EBNF) notation. Each rule in the
6282 grammar defines one symbol, in the form
6283 </p>
6284 <div class="exampleInner"><pre>symbol ::= expression</pre></div>
6285 <p>
6286 Symbols are written with an initial capital letter if they are the
6287 start symbol of a regular language, otherwise with an initial
6288 lowercase letter. Literal strings are quoted.
6289 </p>
6290 <p>
6291 Within the expression on the right-hand side of a rule, the following
6292 expressions are used to match strings of one or more characters:
6293 </p>
6294 <dl>
6295 <dt class="label">
6296 <code>#xN</code>
6297 </dt>
6298 <dd>
6299 <p>
6300 where <code>N</code> is a hexadecimal integer, the expression
6301 matches the character whose number (code point) in ISO/IEC 10646
6302 is <code>N</code>. The number of leading zeros in the
6303 <code>#xN</code> form is insignificant.
6304 </p>
6305 </dd>
6306 <dt class="label"><code>[a-zA-Z]</code>, <code>[#xN-#xN]</code></dt>
6307 <dd>
6308 <p>
6309 matches any <a href="#NT-Char">Char</a> with a value in the
6310 range(s) indicated (inclusive).
6311 </p>
6312 </dd>
6313 <dt class="label"><code>[abc]</code>, <code>[#xN#xN#xN]</code></dt>
6314 <dd>
6315 <p>
6316 matches any <a href="#NT-Char">Char</a> with a value among the
6317 characters enumerated. Enumerations and ranges can be mixed in one
6318 set of brackets.
6319 </p>
6320 </dd>
6321 <dt class="label"><code>[^a-z]</code>, <code>[^#xN-#xN]</code></dt>
6322 <dd>
6323 <p>
6324 matches any <a href="#NT-Char">Char</a> with a value
6325 <em>outside</em> the range indicated.
6326 </p>
6327 </dd>
6328 <dt class="label"><code>[^abc]</code>, <code>[^#xN#xN#xN]</code></dt>
6329 <dd>
6330 <p>
6331 matches any <a href="#NT-Char">Char</a> with a value not among the
6332 characters given. Enumerations and ranges of forbidden values can
6333 be mixed in one set of brackets.
6334 </p>
6335 </dd>
6336 <dt class="label">
6337 <code>"string"</code>
6338 </dt>
6339 <dd>
6340 <p>
6341 matches a literal string
6342 <a title="match" href="#dt-match">matching</a> that given inside
6343 the double quotes.
6344 </p>
6345 </dd>
6346 <dt class="label">
6347 <code>'string'</code>
6348 </dt>
6349 <dd>
6350 <p>
6351 matches a literal string
6352 <a title="match" href="#dt-match">matching</a> that given inside
6353 the single quotes.
6354 </p>
6355 </dd>
6356 </dl>
6357 <p>
6358 These symbols may be combined to match more complex patterns as
6359 follows, where <code>A</code> and <code>B</code> represent simple
6360 expressions:
6361 </p>
6362 <dl>
6363 <dt class="label">(<code>expression</code>)</dt>
6364 <dd>
6365 <p>
6366 <code>expression</code> is treated as a unit and may be combined
6367 as described in this list.
6368 </p>
6369 </dd>
6370 <dt class="label">
6371 <code>A?</code>
6372 </dt>
6373 <dd>
6374 <p>matches <code>A</code> or nothing; optional <code>A</code>.</p>
6375 </dd>
6376 <dt class="label">
6377 <code>A B</code>
6378 </dt>
6379 <dd>
6380 <p>
6381 matches <code>A</code> followed by <code>B</code>. This operator
6382 has higher precedence than alternation; thus
6383 <code>A B | C D</code> is identical to <code>(A B) | (C D)</code>.
6384 </p>
6385 </dd>
6386 <dt class="label">
6387 <code>A | B</code>
6388 </dt>
6389 <dd>
6390 <p>matches <code>A</code> or <code>B</code>.</p>
6391 </dd>
6392 <dt class="label">
6393 <code>A - B</code>
6394 </dt>
6395 <dd>
6396 <p>
6397 matches any string that matches <code>A</code> but does not match
6398 <code>B</code>.
6399 </p>
6400 </dd>
6401 <dt class="label">
6402 <code>A+</code>
6403 </dt>
6404 <dd>
6405 <p>
6406 matches one or more occurrences of <code>A</code>. Concatenation
6407 has higher precedence than alternation; thus
6408 <code>A+ | B+</code> is identical to <code>(A+) | (B+)</code>.
6409 </p>
6410 </dd>
6411 <dt class="label">
6412 <code>A*</code>
6413 </dt>
6414 <dd>
6415 <p>
6416 matches zero or more occurrences of <code>A</code>. Concatenation
6417 has higher precedence than alternation; thus
6418 <code>A* | B*</code> is identical to <code>(A*) | (B*)</code>.
6419 </p>
6420 </dd>
6421 </dl>
6422 <p>Other notations used in the productions are:</p>
6423 <dl>
6424 <dt class="label">
6425 <code>/* ... */</code>
6426 </dt>
6427 <dd><p>comment.</p></dd>
6428 <dt class="label">
6429 <code>[ wfc: ... ]</code>
6430 </dt>
6431 <dd>
6432 <p>
6433 well-formedness constraint; this identifies by name a constraint
6434 on
6435 <a title="Well-Formed" href="#dt-wellformed">well-formed</a>
6436 documents associated with a production.
6437 </p>
6438 </dd>
6439 <dt class="label">
6440 <code>[ vc: ... ]</code>
6441 </dt>
6442 <dd>
6443 <p>
6444 validity constraint; this identifies by name a constraint on
6445 <a title="Validity" href="#dt-valid">valid</a> documents
6446 associated with a production.
6447 </p>
6448 </dd>
6449 </dl>
6450 <p></p>
6451 </div>
6452 </div>
6453 <div class="back">
6454 <div class="div1">
6455 <h2><a name="sec-bibliography" id="sec-bibliography" />A References</h2>
6456 <div class="div2">
6457 <h3>
6458 <a name="sec-existing-stds" id="sec-existing-stds" />A.1 Normative
6459 References
6460 </h3>
6461 <dl>
6462 <dt class="label"><a name="IANA" id="IANA" />IANA-CHARSETS</dt>
6463 <dd>
6464 (Internet Assigned Numbers Authority)
6465 <a href="http://www.iana.org/assignments/character-sets"
6466 ><cite>Official Names for Character Sets</cite></a
6467 >, ed. Keld Simonsen et al. (See
6468 http://www.iana.org/assignments/character-sets.)
6469 </dd>
6470 <dt class="label">
6471 <a name="rfc2119" id="rfc2119" />IETF RFC 2119
6472 </dt>
6473 <dd>
6474 IETF (Internet Engineering Task Force).
6475 <a href="http://www.ietf.org/rfc/rfc2119.txt"
6476 ><cite
6477 >RFC 2119: Key words for use in RFCs to Indicate Requirement
6478 Levels</cite
6479 ></a
6480 >. Scott Bradner, 1997. (See http://www.ietf.org/rfc/rfc2119.txt.)
6481 </dd>
6482 <dt class="label"><a name="RFC1766" />IETF BCP 47</dt>
6483 <dd>
6484 IETF (Internet Engineering Task Force).
6485 <cite
6486 >BCP 47, consisting of
6487 <a href="http://tools.ietf.org/html/rfc4646"
6488 >RFC 4646: Tags for Identifying Languages</a
6489 >, and
6490 <a href="http://tools.ietf.org/html/rfc4647"
6491 >RFC 4647: Matching of Language Tags</a
6492 ></cite
6493 >, A. Phillips, M. Davis. 2006.
6494 </dd>
6495 <dt class="label">
6496 <a name="rfc3986" id="rfc3986" />IETF RFC 3986
6497 </dt>
6498 <dd>
6499 IETF (Internet Engineering Task Force).
6500 <a href="http://www.ietf.org/rfc/rfc3986.txt"
6501 ><cite
6502 >RFC 3986: Uniform Resource Identifier (URI): Generic
6503 Syntax</cite
6504 ></a
6505 >. T. Berners-Lee, R. Fielding, L. Masinter. 2005. (See
6506 http://www.ietf.org/rfc/rfc3986.txt.)
6507 </dd>
6508 <dt class="label">
6509 <a name="ISO10646" id="ISO10646" />ISO/IEC 10646
6510 </dt>
6511 <dd>
6512 ISO (International Organization for Standardization).
6513 <cite
6514 >ISO/IEC 10646-1:2000. Information technology — Universal
6515 Multiple-Octet Coded Character Set (UCS) — Part 1: Architecture
6516 and Basic Multilingual Plane</cite
6517 >
6518 and
6519 <cite
6520 >ISO/IEC 10646-2:2001. Information technology — Universal
6521 Multiple-Octet Coded Character Set (UCS) — Part 2: Supplementary
6522 Planes</cite
6523 >, as, from time to time, amended, replaced by a new edition or
6524 expanded by the addition of new parts. [Geneva]: International
6525 Organization for Standardization. (See
6526 <a href="http://www.iso.org/iso/home.htm"
6527 >http://www.iso.org/iso/home.htm</a
6528 >
6529 for the latest version.)
6530 </dd>
6531 <dt class="label">
6532 <a name="ISO10646-2000" id="ISO10646-2000" />ISO/IEC 10646:2000
6533 </dt>
6534 <dd>
6535 ISO (International Organization for Standardization).
6536 <cite
6537 >ISO/IEC 10646-1:2000. Information technology — Universal
6538 Multiple-Octet Coded Character Set (UCS) — Part 1: Architecture
6539 and Basic Multilingual Plane.</cite
6540 >
6541 [Geneva]: International Organization for Standardization, 2000.
6542 </dd>
6543 <dt class="label"><a name="Unicode" id="Unicode" />Unicode</dt>
6544 <dd>
6545 The Unicode Consortium.
6546 <em>The Unicode Standard, Version <span>5.0.0,</span></em>
6547 <span
6548 >defined by: The Unicode Standard, Version 5.0 (Boston, MA,
6549 Addison-Wesley, 2007. ISBN 0-321-48091-0)</span
6550 >.
6551 </dd>
6552 <dt class="label">
6553 <a name="unipart15" id="unipart15" />UnicodeNormal
6554 </dt>
6555 <dd>
6556 The Unicode Consortium.
6557 <a href="http://unicode.org/reports/tr15/"
6558 ><cite>Unicode normalization forms</cite></a
6559 >. Mark Davis and Martin Durst. 2008. (See
6560 http://unicode.org/reports/tr15/.)
6561 </dd>
6562 </dl>
6563 </div>
6564 <div class="div2">
6565 <h3><a name="null" id="null" />A.2 Other References</h3>
6566 <dl>
6567 <dt class="label"><a name="Aho" id="Aho" />Aho/Ullman</dt>
6568 <dd>
6569 Aho, Alfred V., Ravi Sethi, and Jeffrey D. Ullman.
6570 <cite>Compilers: Principles, Techniques, and Tools</cite>.
6571 Reading: Addison-Wesley, 1986, rpt. corr. 1988.
6572 </dd>
6573 <dt class="label"><a name="ABK" id="ABK" />Brüggemann-Klein</dt>
6574 <dd>
6575 Brüggemann-Klein, Anne.
6576 <a
6577 href="ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps"
6578 ><cite>Formal Models in Document Processing</cite></a
6579 >. Habilitationsschrift. Faculty of Mathematics at the University
6580 of Freiburg, 1993. (See
6581 ftp://ftp.informatik.uni-freiburg.de/documents/papers/brueggem/habil.ps.)
6582 </dd>
6583 <dt class="label">
6584 <a name="ABKDW" id="ABKDW" />Brüggemann-Klein and Wood
6585 </dt>
6586 <dd>
6587 Brüggemann-Klein, Anne, and Derick Wood.
6588 <cite>Deterministic Regular Languages</cite>. Universität
6589 Freiburg, Institut für Informatik, Bericht 38, Oktober 1991.
6590 Extended abstract in A. Finkel, M. Jantzen, Hrsg., STACS 1992, S.
6591 173-184. Springer-Verlag, Berlin 1992. Lecture Notes in Computer
6592 Science 577. Full version titled
6593 <cite>One-Unambiguous Regular Languages</cite> in Information and
6594 Computation 140 (2): 229-253, February 1998.
6595 </dd>
6596 <dt class="label"><a name="Clark" id="Clark" />Clark</dt>
6597 <dd>
6598 James Clark.
6599 <a href="http://www.w3.org/TR/NOTE-sgml-xml-971215"
6600 ><cite>Comparison of SGML and XML</cite></a
6601 >. (See http://www.w3.org/TR/NOTE-sgml-xml-971215.)
6602 </dd>
6603 <dt class="label"><a name="IANA-LANGCODES" />IANA-LANGCODES</dt>
6604 <dd>
6605 (Internet Assigned Numbers Authority)
6606 <a href="http://www.iana.org/assignments/language-subtag-registry"
6607 ><cite>Registry of Language Tags</cite></a
6608 >
6609 (See http://www.iana.org/assignments/language-subtag-registry.)
6610 </dd>
6611 <dt class="label">
6612 <a name="RFC2141" id="RFC2141" />IETF RFC 2141
6613 </dt>
6614 <dd>
6615 IETF (Internet Engineering Task Force).
6616 <a href="http://www.ietf.org/rfc/rfc2141.txt"
6617 ><cite>RFC 2141: URN Syntax</cite></a
6618 >, ed. R. Moats. 1997. (See http://www.ietf.org/rfc/rfc2141.txt.)
6619 </dd>
6620 <dt class="label">
6621 <a name="rfc2376" id="rfc2376" />IETF RFC 3023
6622 </dt>
6623 <dd>
6624 IETF (Internet Engineering Task Force).
6625 <a href="http://www.ietf.org/rfc/rfc3023.txt"
6626 ><cite>RFC 3023: XML Media Types</cite></a
6627 >. eds. M. Murata, S. St.Laurent, D. Kohn. 2001. (See
6628 http://www.ietf.org/rfc/rfc3023.txt.)
6629 </dd>
6630 <dt class="label">
6631 <a name="rfc2781" id="rfc2781" />IETF RFC 2781
6632 </dt>
6633 <dd>
6634 IETF (Internet Engineering Task Force).
6635 <a href="http://www.ietf.org/rfc/rfc2781.txt"
6636 ><cite>RFC 2781: UTF-16, an encoding of ISO 10646</cite></a
6637 >, ed. P. Hoffman, F. Yergeau. 2000. (See
6638 http://www.ietf.org/rfc/rfc2781.txt.)
6639 </dd>
6640 <dt class="label"><a name="ISO639" id="ISO639" />ISO 639</dt>
6641 <dd>
6642 (International Organization for Standardization).
6643 <cite
6644 >ISO 639:1988 (E). Code for the representation of names of
6645 languages.</cite
6646 >
6647 [Geneva]: International Organization for Standardization, 1988.
6648 </dd>
6649 <dt class="label"><a name="ISO3166" id="ISO3166" />ISO 3166</dt>
6650 <dd>
6651 (International Organization for Standardization).
6652 <cite
6653 >ISO 3166-1:1997 (E). Codes for the representation of names of
6654 countries and their subdivisions — Part 1: Country codes</cite
6655 >
6656 [Geneva]: International Organization for Standardization, 1997.
6657 </dd>
6658 <dt class="label"><a name="ISO8879" id="ISO8879" />ISO 8879</dt>
6659 <dd>
6660 ISO (International Organization for Standardization).
6661 <cite
6662 >ISO 8879:1986(E). Information processing — Text and Office
6663 Systems — Standard Generalized Markup Language (SGML).</cite
6664 >
6665 First edition — 1986-10-15. [Geneva]: International Organization
6666 for Standardization, 1986.
6667 </dd>
6668 <dt class="label">
6669 <a name="ISO10744" id="ISO10744" />ISO/IEC 10744
6670 </dt>
6671 <dd>
6672 ISO (International Organization for Standardization).
6673 <cite
6674 >ISO/IEC 10744-1992 (E). Information technology —
6675 Hypermedia/Time-based Structuring Language (HyTime).
6676 </cite>
6677 [Geneva]: International Organization for Standardization, 1992.
6678 <em>Extended Facilities Annexe.</em> [Geneva]: International
6679 Organization for Standardization, 1996.
6680 </dd>
6681 <dt class="label"><a name="websgml" id="websgml" />WEBSGML</dt>
6682 <dd>
6683 ISO (International Organization for Standardization).
6684 <a href="http://www.sgmlsource.com/8879/n0029.htm"
6685 ><cite
6686 >ISO 8879:1986 TC2. Information technology — Document
6687 Description and Processing Languages</cite
6688 ></a
6689 >. [Geneva]: International Organization for Standardization, 1998.
6690 (See http://www.sgmlsource.com/8879/n0029.htm.)
6691 </dd>
6692 <dt class="label">
6693 <a name="xml-names" id="xml-names" />XML Names
6694 </dt>
6695 <dd>
6696 Tim Bray, Dave Hollander, and Andrew Layman, editors.
6697 <a href="http://www.w3.org/TR/xml-names/"
6698 ><cite>Namespaces in XML</cite></a
6699 >. Textuality, Hewlett-Packard, and Microsoft. World Wide Web
6700 Consortium, 1999. (See http://www.w3.org/TR/xml-names/.)
6701 </dd>
6702 </dl>
6703 </div>
6704 </div>
6705 <div class="div1">
6706 <h2><a name="CharClasses" id="CharClasses" />B Character Classes</h2>
6707 <p>
6708 Because of changes to productions
6709 <a href="#NT-NameStartChar">[4]</a> and <a href="#NT-Name">[5]</a>,
6710 the productions in this Appendix are now orphaned and not used anymore
6711 in determining name characters. This Appendix may be removed in a
6712 future edition of this specification; other specifications that wish
6713 to refer to the productions herein should do so by means of a
6714 reference to the relevant production(s) in the
6715 <a href="http://www.w3.org/TR/2006/REC-xml-20060816/"
6716 >Fourth Edition</a
6717 >
6718 of this specification.
6719 </p>
6720 <p>
6721 Following the characteristics defined in the Unicode standard,
6722 characters are classed as base characters (among others, these contain
6723 the alphabetic characters of the Latin alphabet), ideographic
6724 characters, and combining characters (among others, this class
6725 contains most diacritics). Digits and extenders are also
6726 distinguished.
6727 </p>
6728 <h5><a name="CHARACTERS" id="CHARACTERS" />Characters</h5>
6729 <table class="scrap" summary="Scrap">
6730 <tbody>
6731 <tr valign="baseline">
6732 <td>
6733 <a name="NT-Letter" id="NT-Letter" />[84]&nbsp;&nbsp;&nbsp;
6734 </td>
6735 <td><code>Letter</code></td>
6736 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6737 <td>
6738 <code>
6739 <a href="#NT-BaseChar">BaseChar</a> |
6740 <a href="#NT-Ideographic">Ideographic</a>
6741 </code>
6742 </td>
6743 </tr>
6744 <tr valign="baseline">
6745 <td>
6746 <a name="NT-BaseChar" id="NT-BaseChar" />[85]&nbsp;&nbsp;&nbsp;
6747 </td>
6748 <td><code>BaseChar</code></td>
6749 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6750 <td>
6751 <code
6752 >[#x0041-#x005A] |&nbsp;[#x0061-#x007A] |&nbsp;[#x00C0-#x00D6]
6753 |&nbsp;[#x00D8-#x00F6] |&nbsp;[#x00F8-#x00FF]
6754 |&nbsp;[#x0100-#x0131] |&nbsp;[#x0134-#x013E]
6755 |&nbsp;[#x0141-#x0148] |&nbsp;[#x014A-#x017E]
6756 |&nbsp;[#x0180-#x01C3] |&nbsp;[#x01CD-#x01F0]
6757 |&nbsp;[#x01F4-#x01F5] |&nbsp;[#x01FA-#x0217]
6758 |&nbsp;[#x0250-#x02A8] |&nbsp;[#x02BB-#x02C1] |&nbsp;#x0386
6759 |&nbsp;[#x0388-#x038A] |&nbsp;#x038C |&nbsp;[#x038E-#x03A1]
6760 |&nbsp;[#x03A3-#x03CE] |&nbsp;[#x03D0-#x03D6] |&nbsp;#x03DA
6761 |&nbsp;#x03DC |&nbsp;#x03DE |&nbsp;#x03E0
6762 |&nbsp;[#x03E2-#x03F3] |&nbsp;[#x0401-#x040C]
6763 |&nbsp;[#x040E-#x044F] |&nbsp;[#x0451-#x045C]
6764 |&nbsp;[#x045E-#x0481] |&nbsp;[#x0490-#x04C4]
6765 |&nbsp;[#x04C7-#x04C8] |&nbsp;[#x04CB-#x04CC]
6766 |&nbsp;[#x04D0-#x04EB] |&nbsp;[#x04EE-#x04F5]
6767 |&nbsp;[#x04F8-#x04F9] |&nbsp;[#x0531-#x0556] |&nbsp;#x0559
6768 |&nbsp;[#x0561-#x0586] |&nbsp;[#x05D0-#x05EA]
6769 |&nbsp;[#x05F0-#x05F2] |&nbsp;[#x0621-#x063A]
6770 |&nbsp;[#x0641-#x064A] |&nbsp;[#x0671-#x06B7]
6771 |&nbsp;[#x06BA-#x06BE] |&nbsp;[#x06C0-#x06CE]
6772 |&nbsp;[#x06D0-#x06D3] |&nbsp;#x06D5 |&nbsp;[#x06E5-#x06E6]
6773 |&nbsp;[#x0905-#x0939] |&nbsp;#x093D |&nbsp;[#x0958-#x0961]
6774 |&nbsp;[#x0985-#x098C] |&nbsp;[#x098F-#x0990]
6775 |&nbsp;[#x0993-#x09A8] |&nbsp;[#x09AA-#x09B0] |&nbsp;#x09B2
6776 |&nbsp;[#x09B6-#x09B9] |&nbsp;[#x09DC-#x09DD]
6777 |&nbsp;[#x09DF-#x09E1] |&nbsp;[#x09F0-#x09F1]
6778 |&nbsp;[#x0A05-#x0A0A] |&nbsp;[#x0A0F-#x0A10]
6779 |&nbsp;[#x0A13-#x0A28] |&nbsp;[#x0A2A-#x0A30]
6780 |&nbsp;[#x0A32-#x0A33] |&nbsp;[#x0A35-#x0A36]
6781 |&nbsp;[#x0A38-#x0A39] |&nbsp;[#x0A59-#x0A5C] |&nbsp;#x0A5E
6782 |&nbsp;[#x0A72-#x0A74] |&nbsp;[#x0A85-#x0A8B] |&nbsp;#x0A8D
6783 |&nbsp;[#x0A8F-#x0A91] |&nbsp;[#x0A93-#x0AA8]
6784 |&nbsp;[#x0AAA-#x0AB0] |&nbsp;[#x0AB2-#x0AB3]
6785 |&nbsp;[#x0AB5-#x0AB9] |&nbsp;#x0ABD |&nbsp;#x0AE0
6786 |&nbsp;[#x0B05-#x0B0C] |&nbsp;[#x0B0F-#x0B10]
6787 |&nbsp;[#x0B13-#x0B28] |&nbsp;[#x0B2A-#x0B30]
6788 |&nbsp;[#x0B32-#x0B33] |&nbsp;[#x0B36-#x0B39] |&nbsp;#x0B3D
6789 |&nbsp;[#x0B5C-#x0B5D] |&nbsp;[#x0B5F-#x0B61]
6790 |&nbsp;[#x0B85-#x0B8A] |&nbsp;[#x0B8E-#x0B90]
6791 |&nbsp;[#x0B92-#x0B95] |&nbsp;[#x0B99-#x0B9A] |&nbsp;#x0B9C
6792 |&nbsp;[#x0B9E-#x0B9F] |&nbsp;[#x0BA3-#x0BA4]
6793 |&nbsp;[#x0BA8-#x0BAA] |&nbsp;[#x0BAE-#x0BB5]
6794 |&nbsp;[#x0BB7-#x0BB9] |&nbsp;[#x0C05-#x0C0C]
6795 |&nbsp;[#x0C0E-#x0C10] |&nbsp;[#x0C12-#x0C28]
6796 |&nbsp;[#x0C2A-#x0C33] |&nbsp;[#x0C35-#x0C39]
6797 |&nbsp;[#x0C60-#x0C61] |&nbsp;[#x0C85-#x0C8C]
6798 |&nbsp;[#x0C8E-#x0C90] |&nbsp;[#x0C92-#x0CA8]
6799 |&nbsp;[#x0CAA-#x0CB3] |&nbsp;[#x0CB5-#x0CB9] |&nbsp;#x0CDE
6800 |&nbsp;[#x0CE0-#x0CE1] |&nbsp;[#x0D05-#x0D0C]
6801 |&nbsp;[#x0D0E-#x0D10] |&nbsp;[#x0D12-#x0D28]
6802 |&nbsp;[#x0D2A-#x0D39] |&nbsp;[#x0D60-#x0D61]
6803 |&nbsp;[#x0E01-#x0E2E] |&nbsp;#x0E30 |&nbsp;[#x0E32-#x0E33]
6804 |&nbsp;[#x0E40-#x0E45] |&nbsp;[#x0E81-#x0E82] |&nbsp;#x0E84
6805 |&nbsp;[#x0E87-#x0E88] |&nbsp;#x0E8A |&nbsp;#x0E8D
6806 |&nbsp;[#x0E94-#x0E97] |&nbsp;[#x0E99-#x0E9F]
6807 |&nbsp;[#x0EA1-#x0EA3] |&nbsp;#x0EA5 |&nbsp;#x0EA7
6808 |&nbsp;[#x0EAA-#x0EAB] |&nbsp;[#x0EAD-#x0EAE] |&nbsp;#x0EB0
6809 |&nbsp;[#x0EB2-#x0EB3] |&nbsp;#x0EBD |&nbsp;[#x0EC0-#x0EC4]
6810 |&nbsp;[#x0F40-#x0F47] |&nbsp;[#x0F49-#x0F69]
6811 |&nbsp;[#x10A0-#x10C5] |&nbsp;[#x10D0-#x10F6] |&nbsp;#x1100
6812 |&nbsp;[#x1102-#x1103] |&nbsp;[#x1105-#x1107] |&nbsp;#x1109
6813 |&nbsp;[#x110B-#x110C] |&nbsp;[#x110E-#x1112] |&nbsp;#x113C
6814 |&nbsp;#x113E |&nbsp;#x1140 |&nbsp;#x114C |&nbsp;#x114E
6815 |&nbsp;#x1150 |&nbsp;[#x1154-#x1155] |&nbsp;#x1159
6816 |&nbsp;[#x115F-#x1161] |&nbsp;#x1163 |&nbsp;#x1165
6817 |&nbsp;#x1167 |&nbsp;#x1169 |&nbsp;[#x116D-#x116E]
6818 |&nbsp;[#x1172-#x1173] |&nbsp;#x1175 |&nbsp;#x119E
6819 |&nbsp;#x11A8 |&nbsp;#x11AB |&nbsp;[#x11AE-#x11AF]
6820 |&nbsp;[#x11B7-#x11B8] |&nbsp;#x11BA |&nbsp;[#x11BC-#x11C2]
6821 |&nbsp;#x11EB |&nbsp;#x11F0 |&nbsp;#x11F9
6822 |&nbsp;[#x1E00-#x1E9B] |&nbsp;[#x1EA0-#x1EF9]
6823 |&nbsp;[#x1F00-#x1F15] |&nbsp;[#x1F18-#x1F1D]
6824 |&nbsp;[#x1F20-#x1F45] |&nbsp;[#x1F48-#x1F4D]
6825 |&nbsp;[#x1F50-#x1F57] |&nbsp;#x1F59 |&nbsp;#x1F5B
6826 |&nbsp;#x1F5D |&nbsp;[#x1F5F-#x1F7D] |&nbsp;[#x1F80-#x1FB4]
6827 |&nbsp;[#x1FB6-#x1FBC] |&nbsp;#x1FBE |&nbsp;[#x1FC2-#x1FC4]
6828 |&nbsp;[#x1FC6-#x1FCC] |&nbsp;[#x1FD0-#x1FD3]
6829 |&nbsp;[#x1FD6-#x1FDB] |&nbsp;[#x1FE0-#x1FEC]
6830 |&nbsp;[#x1FF2-#x1FF4] |&nbsp;[#x1FF6-#x1FFC] |&nbsp;#x2126
6831 |&nbsp;[#x212A-#x212B] |&nbsp;#x212E |&nbsp;[#x2180-#x2182]
6832 |&nbsp;[#x3041-#x3094] |&nbsp;[#x30A1-#x30FA]
6833 |&nbsp;[#x3105-#x312C] |&nbsp;[#xAC00-#xD7A3]
6834 </code>
6835 </td>
6836 </tr>
6837 <tr valign="baseline">
6838 <td>
6839 <a
6840 name="NT-Ideographic"
6841 id="NT-Ideographic"
6842 />[86]&nbsp;&nbsp;&nbsp;
6843 </td>
6844 <td><code>Ideographic</code></td>
6845 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6846 <td>
6847 <code
6848 >[#x4E00-#x9FA5] |&nbsp;#x3007 |&nbsp;[#x3021-#x3029]
6849 </code>
6850 </td>
6851 </tr>
6852 <tr valign="baseline">
6853 <td>
6854 <a
6855 name="NT-CombiningChar"
6856 id="NT-CombiningChar"
6857 />[87]&nbsp;&nbsp;&nbsp;
6858 </td>
6859 <td><code>CombiningChar</code></td>
6860 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6861 <td>
6862 <code
6863 >[#x0300-#x0345] |&nbsp;[#x0360-#x0361] |&nbsp;[#x0483-#x0486]
6864 |&nbsp;[#x0591-#x05A1] |&nbsp;[#x05A3-#x05B9]
6865 |&nbsp;[#x05BB-#x05BD] |&nbsp;#x05BF |&nbsp;[#x05C1-#x05C2]
6866 |&nbsp;#x05C4 |&nbsp;[#x064B-#x0652] |&nbsp;#x0670
6867 |&nbsp;[#x06D6-#x06DC] |&nbsp;[#x06DD-#x06DF]
6868 |&nbsp;[#x06E0-#x06E4] |&nbsp;[#x06E7-#x06E8]
6869 |&nbsp;[#x06EA-#x06ED] |&nbsp;[#x0901-#x0903] |&nbsp;#x093C
6870 |&nbsp;[#x093E-#x094C] |&nbsp;#x094D |&nbsp;[#x0951-#x0954]
6871 |&nbsp;[#x0962-#x0963] |&nbsp;[#x0981-#x0983] |&nbsp;#x09BC
6872 |&nbsp;#x09BE |&nbsp;#x09BF |&nbsp;[#x09C0-#x09C4]
6873 |&nbsp;[#x09C7-#x09C8] |&nbsp;[#x09CB-#x09CD] |&nbsp;#x09D7
6874 |&nbsp;[#x09E2-#x09E3] |&nbsp;#x0A02 |&nbsp;#x0A3C
6875 |&nbsp;#x0A3E |&nbsp;#x0A3F |&nbsp;[#x0A40-#x0A42]
6876 |&nbsp;[#x0A47-#x0A48] |&nbsp;[#x0A4B-#x0A4D]
6877 |&nbsp;[#x0A70-#x0A71] |&nbsp;[#x0A81-#x0A83] |&nbsp;#x0ABC
6878 |&nbsp;[#x0ABE-#x0AC5] |&nbsp;[#x0AC7-#x0AC9]
6879 |&nbsp;[#x0ACB-#x0ACD] |&nbsp;[#x0B01-#x0B03] |&nbsp;#x0B3C
6880 |&nbsp;[#x0B3E-#x0B43] |&nbsp;[#x0B47-#x0B48]
6881 |&nbsp;[#x0B4B-#x0B4D] |&nbsp;[#x0B56-#x0B57]
6882 |&nbsp;[#x0B82-#x0B83] |&nbsp;[#x0BBE-#x0BC2]
6883 |&nbsp;[#x0BC6-#x0BC8] |&nbsp;[#x0BCA-#x0BCD] |&nbsp;#x0BD7
6884 |&nbsp;[#x0C01-#x0C03] |&nbsp;[#x0C3E-#x0C44]
6885 |&nbsp;[#x0C46-#x0C48] |&nbsp;[#x0C4A-#x0C4D]
6886 |&nbsp;[#x0C55-#x0C56] |&nbsp;[#x0C82-#x0C83]
6887 |&nbsp;[#x0CBE-#x0CC4] |&nbsp;[#x0CC6-#x0CC8]
6888 |&nbsp;[#x0CCA-#x0CCD] |&nbsp;[#x0CD5-#x0CD6]
6889 |&nbsp;[#x0D02-#x0D03] |&nbsp;[#x0D3E-#x0D43]
6890 |&nbsp;[#x0D46-#x0D48] |&nbsp;[#x0D4A-#x0D4D] |&nbsp;#x0D57
6891 |&nbsp;#x0E31 |&nbsp;[#x0E34-#x0E3A] |&nbsp;[#x0E47-#x0E4E]
6892 |&nbsp;#x0EB1 |&nbsp;[#x0EB4-#x0EB9] |&nbsp;[#x0EBB-#x0EBC]
6893 |&nbsp;[#x0EC8-#x0ECD] |&nbsp;[#x0F18-#x0F19] |&nbsp;#x0F35
6894 |&nbsp;#x0F37 |&nbsp;#x0F39 |&nbsp;#x0F3E |&nbsp;#x0F3F
6895 |&nbsp;[#x0F71-#x0F84] |&nbsp;[#x0F86-#x0F8B]
6896 |&nbsp;[#x0F90-#x0F95] |&nbsp;#x0F97 |&nbsp;[#x0F99-#x0FAD]
6897 |&nbsp;[#x0FB1-#x0FB7] |&nbsp;#x0FB9 |&nbsp;[#x20D0-#x20DC]
6898 |&nbsp;#x20E1 |&nbsp;[#x302A-#x302F] |&nbsp;#x3099
6899 |&nbsp;#x309A
6900 </code>
6901 </td>
6902 </tr>
6903 <tr valign="baseline">
6904 <td><a name="NT-Digit" id="NT-Digit" />[88]&nbsp;&nbsp;&nbsp;</td>
6905 <td><code>Digit</code></td>
6906 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6907 <td>
6908 <code
6909 >[#x0030-#x0039] |&nbsp;[#x0660-#x0669] |&nbsp;[#x06F0-#x06F9]
6910 |&nbsp;[#x0966-#x096F] |&nbsp;[#x09E6-#x09EF]
6911 |&nbsp;[#x0A66-#x0A6F] |&nbsp;[#x0AE6-#x0AEF]
6912 |&nbsp;[#x0B66-#x0B6F] |&nbsp;[#x0BE7-#x0BEF]
6913 |&nbsp;[#x0C66-#x0C6F] |&nbsp;[#x0CE6-#x0CEF]
6914 |&nbsp;[#x0D66-#x0D6F] |&nbsp;[#x0E50-#x0E59]
6915 |&nbsp;[#x0ED0-#x0ED9] |&nbsp;[#x0F20-#x0F29]
6916 </code>
6917 </td>
6918 </tr>
6919 <tr valign="baseline">
6920 <td>
6921 <a name="NT-Extender" id="NT-Extender" />[89]&nbsp;&nbsp;&nbsp;
6922 </td>
6923 <td><code>Extender</code></td>
6924 <td>&nbsp;&nbsp;&nbsp;::=&nbsp;&nbsp;&nbsp;</td>
6925 <td>
6926 <code
6927 >#x00B7 |&nbsp;#x02D0 |&nbsp;#x02D1 |&nbsp;#x0387
6928 |&nbsp;#x0640 |&nbsp;#x0E46 |&nbsp;#x0EC6 |&nbsp;#x3005
6929 |&nbsp;[#x3031-#x3035] |&nbsp;[#x309D-#x309E]
6930 |&nbsp;[#x30FC-#x30FE]
6931 </code>
6932 </td>
6933 </tr>
6934 </tbody>
6935 </table>
6936 <p>
6937 The character classes defined here can be derived from the Unicode 2.0
6938 character database as follows:
6939 </p>
6940 <ul>
6941 <li>
6942 <p>
6943 Name start characters must have one of the categories Ll, Lu, Lo,
6944 Lt, Nl.
6945 </p>
6946 </li>
6947 <li>
6948 <p>
6949 Name characters other than Name-start characters must have one of
6950 the categories Mc, Me, Mn, Lm, or Nd.
6951 </p>
6952 </li>
6953 <li>
6954 <p>
6955 Characters in the compatibility area (i.e. with character code
6956 greater than #xF900 and less than #xFFFE) are not allowed in XML
6957 names.
6958 </p>
6959 </li>
6960 <li>
6961 <p>
6962 Characters which have a font or compatibility decomposition (i.e.
6963 those with a "compatibility formatting tag" in field 5 of the
6964 database -- marked by field 5 beginning with a "&lt;") are not
6965 allowed.
6966 </p>
6967 </li>
6968 <li>
6969 <p>
6970 The following characters are treated as name-start characters
6971 rather than name characters, because the property file classifies
6972 them as Alphabetic: [#x02BB-#x02C1], #x0559, #x06E5, #x06E6.
6973 </p>
6974 </li>
6975 <li>
6976 <p>
6977 Characters #x20DD-#x20E0 are excluded (in accordance with Unicode
6978 2.0, section 5.14).
6979 </p>
6980 </li>
6981 <li>
6982 <p>
6983 Character #x00B7 is classified as an extender, because the
6984 property list so identifies it.
6985 </p>
6986 </li>
6987 <li>
6988 <p>
6989 Character #x0387 is added as a name character, because #x00B7 is
6990 its canonical equivalent.
6991 </p>
6992 </li>
6993 <li>
6994 <p>Characters ':' and '_' are allowed as name-start characters.</p>
6995 </li>
6996 <li><p>Characters '-' and '.' are allowed as name characters.</p></li>
6997 </ul>
6998 </div>
6999 <div class="div1">
7000 <h2>
7001 <a name="sec-xml-and-sgml" id="sec-xml-and-sgml" />C XML and SGML
7002 (Non-Normative)
7003 </h2>
7004 <p>
7005 XML is designed to be a subset of SGML, in that every XML document
7006 should also be a conforming SGML document. For a detailed comparison
7007 of the additional restrictions that XML places on documents beyond
7008 those of SGML, see <a href="#Clark">[Clark]</a>.
7009 </p>
7010 </div>
7011 <div class="div1">
7012 <h2>
7013 <a name="sec-entexpand" id="sec-entexpand" />D Expansion of Entity and
7014 Character References (Non-Normative)
7015 </h2>
7016 <p>
7017 This appendix contains some examples illustrating the sequence of
7018 entity- and character-reference recognition and expansion, as
7019 specified in
7020 <a href="#entproc"
7021 ><b>4.4 XML Processor Treatment of Entities and References</b></a
7022 >.
7023 </p>
7024 <p>If the DTD contains the declaration</p>
7025 <div class="exampleInner">
7026 <pre>
7027 &lt;!ENTITY example "&lt;p&gt;An ampersand (&amp;#38;#38;) may be escaped
7028 numerically (&amp;#38;#38;#38;) or with a general entity
7029 (&amp;amp;amp;).&lt;/p&gt;" &gt;</pre
7030 >
7031 </div>
7032 <p>
7033 then the XML processor will recognize the character references when it
7034 parses the entity declaration, and resolve them before storing the
7035 following string as the value of the entity "
7036 <code>example</code>
7037 ":
7038 </p>
7039 <div class="exampleInner">
7040 <pre>
7041 &lt;p&gt;An ampersand (&amp;#38;) may be escaped
7042 numerically (&amp;#38;#38;) or with a general entity
7043 (&amp;amp;amp;).&lt;/p&gt;</pre
7044 >
7045 </div>
7046 <p>
7047 A reference in the document to "
7048 <code>&amp;example;</code>
7049 " will cause the text to be reparsed, at which time the start- and
7050 end-tags of the <code>p</code> element will be recognized and the
7051 three references will be recognized and expanded, resulting in a
7052 <code>p</code> element with the following content (all data, no
7053 delimiters or markup):
7054 </p>
7055 <div class="exampleInner">
7056 <pre>
7057 An ampersand (&amp;) may be escaped
7058 numerically (&amp;#38;) or with a general entity
7059 (&amp;amp;).</pre
7060 >
7061 </div>
7062 <p>
7063 A more complex example will illustrate the rules and their effects
7064 fully. In the following example, the line numbers are solely for
7065 reference.
7066 </p>
7067 <div class="exampleInner">
7068 <pre>
7069 1 &lt;?xml version='1.0'?&gt;
7070 2 &lt;!DOCTYPE test [
7071 3 &lt;!ELEMENT test (#PCDATA) &gt;
7072 4 &lt;!ENTITY % xx '&amp;#37;zz;'&gt;
7073 5 &lt;!ENTITY % zz '&amp;#60;!ENTITY tricky "error-prone" &gt;' &gt;
7074 6 %xx;
7075 7 ]&gt;
7076 8 &lt;test&gt;This sample shows a &amp;tricky; method.&lt;/test&gt;</pre
7077 >
7078 </div>
7079 <p>This produces the following:</p>
7080 <ul>
7081 <li>
7082 <p>
7083 in line 4, the reference to character 37 is expanded immediately,
7084 and the parameter entity "
7085 <code>xx</code>
7086 " is stored in the symbol table with the value "
7087 <code>%zz;</code>
7088 ". Since the replacement text is not rescanned, the reference to
7089 parameter entity "
7090 <code>zz</code>
7091 " is not recognized. (And it would be an error if it were, since "
7092 <code>zz</code>
7093 " is not yet declared.)
7094 </p>
7095 </li>
7096 <li>
7097 <p>
7098 in line 5, the character reference "
7099 <code>&amp;#60;</code>
7100 " is expanded immediately and the parameter entity "
7101 <code>zz</code>
7102 " is stored with the replacement text "
7103 <code>&lt;!ENTITY tricky "error-prone" &gt;</code>
7104 ", which is a well-formed entity declaration.
7105 </p>
7106 </li>
7107 <li>
7108 <p>
7109 in line 6, the reference to "
7110 <code>xx</code>
7111 " is recognized, and the replacement text of "
7112 <code>xx</code>
7113 " (namely "
7114 <code>%zz;</code>
7115 ") is parsed. The reference to "
7116 <code>zz</code>
7117 " is recognized in its turn, and its replacement text ("
7118 <code>&lt;!ENTITY tricky "error-prone" &gt;</code>
7119 ") is parsed. The general entity "
7120 <code>tricky</code>
7121 " has now been declared, with the replacement text "
7122 <code>error-prone</code>
7123 ".
7124 </p>
7125 </li>
7126 <li>
7127 <p>
7128 in line 8, the reference to the general entity "
7129 <code>tricky</code>
7130 " is recognized, and it is expanded, so the full content of the
7131 <code>test</code> element is the self-describing (and
7132 ungrammatical) string
7133 <em>This sample shows a error-prone method.</em>
7134 </p>
7135 </li>
7136 </ul>
7137 <p>In the following example</p>
7138 <div class="exampleInner">
7139 <pre>
7140 &lt;!DOCTYPE foo [
7141 &lt;!ENTITY x "&amp;lt;"&gt;
7142 ]&gt;
7143 &lt;foo attr="&amp;x;"/&gt;</pre
7144 >
7145 </div>
7146 <p>
7147 the replacement text of x is the four characters "&amp;lt;" because
7148 references to general entities in entity values are
7149 <a href="#bypass"><cite>bypassed</cite></a
7150 >. The replacement text of lt is a character reference to the
7151 less-than character, for example the five characters "&amp;#60;" (see
7152 <a href="#sec-predefined-ent"><b>4.6 Predefined Entities</b></a
7153 >). Since neither of these contains a less-than character the result
7154 is well-formed.
7155 </p>
7156 <p>If the definition of x had been</p>
7157 <div class="exampleInner"><pre>&lt;!ENTITY x "&amp;#60;"&gt;</pre></div>
7158 <p>
7159 then the document would not have been well-formed, because the
7160 replacement text of x would be the single character "&lt;" which is
7161 not permitted in attribute values (see
7162 <a href="#CleanAttrVals"
7163 ><cite>WFC: No &lt; in Attribute Values</cite></a
7164 >).
7165 </p>
7166 </div>
7167 <div class="div1">
7168 <h2>
7169 <a name="determinism" id="determinism" />E Deterministic Content
7170 Models (Non-Normative)
7171 </h2>
7172 <p>
7173 As noted in
7174 <a href="#sec-element-content"><b>3.2.1 Element Content</b></a
7175 >, it is required that content models in element type declarations be
7176 deterministic. This requirement is
7177 <a title="For Compatibility" href="#dt-compat">for compatibility</a>
7178 with SGML (which calls deterministic content models "unambiguous");
7179 XML processors built using SGML systems may flag non-deterministic
7180 content models as errors.
7181 </p>
7182 <p>
7183 For example, the content model <code>((b, c) | (b, d))</code> is
7184 non-deterministic, because given an initial <code>b</code> the XML
7185 processor cannot know which <code>b</code> in the model is being
7186 matched without looking ahead to see which element follows the
7187 <code>b</code>. In this case, the two references to <code>b</code> can
7188 be collapsed into a single reference, making the model read
7189 <code>(b, (c | d))</code>. An initial <code>b</code> now clearly
7190 matches only a single name in the content model. The processor doesn't
7191 need to look ahead to see what follows; either <code>c</code> or
7192 <code>d</code> would be accepted.
7193 </p>
7194 <p>
7195 More formally: a finite state automaton may be constructed from the
7196 content model using the standard algorithms, e.g. algorithm 3.5 in
7197 section 3.9 of Aho, Sethi, and Ullman <a href="#Aho">[Aho/Ullman]</a>.
7198 In many such algorithms, a follow set is constructed for each position
7199 in the regular expression (i.e., each leaf node in the syntax tree for
7200 the regular expression); if any position has a follow set in which
7201 more than one following position is labeled with the same element type
7202 name, then the content model is in error and may be reported as an
7203 error.
7204 </p>
7205 <p>
7206 Algorithms exist which allow many but not all non-deterministic
7207 content models to be reduced automatically to equivalent deterministic
7208 models; see Brüggemann-Klein 1991
7209 <a href="#ABK">[Brüggemann-Klein]</a>.
7210 </p>
7211 </div>
7212 <div class="div1">
7213 <h2>
7214 <a name="sec-guessing" id="sec-guessing" />F Autodetection of
7215 Character Encodings (Non-Normative)
7216 </h2>
7217 <p>
7218 The XML encoding declaration functions as an internal label on each
7219 entity, indicating which character encoding is in use. Before an XML
7220 processor can read the internal label, however, it apparently has to
7221 know what character encoding is in use—which is what the internal
7222 label is trying to indicate. In the general case, this is a hopeless
7223 situation. It is not entirely hopeless in XML, however, because XML
7224 limits the general case in two ways: each implementation is assumed to
7225 support only a finite set of character encodings, and the XML encoding
7226 declaration is restricted in position and content in order to make it
7227 feasible to autodetect the character encoding in use in each entity in
7228 normal cases. Also, in many cases other sources of information are
7229 available in addition to the XML data stream itself. Two cases may be
7230 distinguished, depending on whether the XML entity is presented to the
7231 processor without, or with, any accompanying (external) information.
7232 We <span>will</span> consider
7233
7234 <span>these cases in turn.</span>
7235 </p>
7236 <div class="div2">
7237 <h3>
7238 <a
7239 name="sec-guessing-no-ext-info"
7240 id="sec-guessing-no-ext-info"
7241 />F.1 Detection Without External Encoding Information
7242 </h3>
7243 <p>
7244 Because each XML entity not accompanied by external encoding
7245 information and not in UTF-8 or UTF-16 encoding must begin with an
7246 XML encoding declaration, in which the first characters must be
7247 '<code>&lt;?xml</code>', any conforming processor can detect, after
7248 two to four octets of input, which of the following cases apply. In
7249 reading this list, it may help to know that in UCS-4, '&lt;' is "
7250 <code>#x0000003C</code>
7251 " and '?' is "
7252 <code>#x0000003F</code>
7253 ", and the Byte Order Mark required of UTF-16 data streams is "
7254 <code>#xFEFF</code>
7255 ". The notation
7256 <var>##</var> is used to denote any byte value except that two
7257 consecutive <var>##</var>s cannot be both 00.
7258 </p>
7259 <p>With a Byte Order Mark:</p>
7260 <table border="1" frame="border">
7261 <tbody>
7262 <tr>
7263 <td>
7264 <code>00 00 FE FF</code>
7265 </td>
7266 <td>UCS-4, big-endian machine (1234 order)</td>
7267 </tr>
7268 <tr>
7269 <td>
7270 <code>FF FE 00 00</code>
7271 </td>
7272 <td>UCS-4, little-endian machine (4321 order)</td>
7273 </tr>
7274 <tr>
7275 <td>
7276 <code>00 00 FF FE</code>
7277 </td>
7278 <td>UCS-4, unusual octet order (2143)</td>
7279 </tr>
7280 <tr>
7281 <td>
7282 <code>FE FF 00 00</code>
7283 </td>
7284 <td>UCS-4, unusual octet order (3412)</td>
7285 </tr>
7286 <tr>
7287 <td>
7288 <code>FE FF ## ##</code>
7289 </td>
7290 <td>UTF-16, big-endian</td>
7291 </tr>
7292 <tr>
7293 <td>
7294 <code>FF FE ## ##</code>
7295 </td>
7296 <td>UTF-16, little-endian</td>
7297 </tr>
7298 <tr>
7299 <td>
7300 <code>EF BB BF</code>
7301 </td>
7302 <td>UTF-8</td>
7303 </tr>
7304 </tbody>
7305 </table>
7306 <p>Without a Byte Order Mark:</p>
7307 <table border="1" frame="border">
7308 <tbody>
7309 <tr>
7310 <td>
7311 <code>00&nbsp;00&nbsp;00&nbsp;3C</code>
7312 </td>
7313 <td rowspan="4">
7314 UCS-4 or other encoding with a 32-bit code unit and ASCII
7315 characters encoded as ASCII values, in respectively big-endian
7316 (1234), little-endian (4321) and two unusual byte orders (2143
7317 and 3412). The encoding declaration must be read to determine
7318 which of UCS-4 or other supported 32-bit encodings applies.
7319 </td>
7320 </tr>
7321 <tr>
7322 <td>
7323 <code>3C 00 00 00</code>
7324 </td>
7325 </tr>
7326 <tr>
7327 <td>
7328 <code>00 00 3C 00</code>
7329 </td>
7330 </tr>
7331 <tr>
7332 <td>
7333 <code>00 3C 00 00</code>
7334 </td>
7335 </tr>
7336 <tr>
7337 <td>
7338 <code>00 3C 00 3F</code>
7339 </td>
7340 <td>
7341 UTF-16BE or big-endian ISO-10646-UCS-2 or other encoding with
7342 a 16-bit code unit in big-endian order and ASCII characters
7343 encoded as ASCII values (the encoding declaration must be read
7344 to determine which)
7345 </td>
7346 </tr>
7347 <tr>
7348 <td>
7349 <code>3C 00 3F 00</code>
7350 </td>
7351 <td>
7352 UTF-16LE or little-endian ISO-10646-UCS-2 or other encoding
7353 with a 16-bit code unit in little-endian order and ASCII
7354 characters encoded as ASCII values (the encoding declaration
7355 must be read to determine which)
7356 </td>
7357 </tr>
7358 <tr>
7359 <td>
7360 <code>3C 3F 78 6D</code>
7361 </td>
7362 <td>
7363 UTF-8, ISO 646, ASCII, some part of ISO 8859, Shift-JIS, EUC,
7364 or any other 7-bit, 8-bit, or mixed-width encoding which
7365 ensures that the characters of ASCII have their normal
7366 positions, width, and values; the actual encoding declaration
7367 must be read to detect which of these applies, but since all
7368 of these encodings use the same bit patterns for the relevant
7369 ASCII characters, the encoding declaration itself may be read
7370 reliably
7371 </td>
7372 </tr>
7373 <tr>
7374 <td>
7375 <code>4C 6F A7 94</code>
7376 </td>
7377 <td>
7378 EBCDIC (in some flavor; the full encoding declaration must be
7379 read to tell which code page is in use)
7380 </td>
7381 </tr>
7382 <tr>
7383 <td>Other</td>
7384 <td>
7385 UTF-8 without an encoding declaration, or else the data stream
7386 is mislabeled (lacking a required encoding declaration),
7387 corrupt, fragmentary, or enclosed in a wrapper of some kind
7388 </td>
7389 </tr>
7390 </tbody>
7391 </table>
7392 <div class="note">
7393 <p class="prefix"><b>Note:</b></p>
7394 <p>
7395 In cases above which do not require reading the encoding
7396 declaration to determine the encoding, section 4.3.3 still
7397 requires that the encoding declaration, if present, be read and
7398 that the encoding name be checked to match the actual encoding of
7399 the entity. Also, it is possible that new character encodings will
7400 be invented that will make it necessary to use the encoding
7401 declaration to determine the encoding, in cases where this is not
7402 required at present.
7403 </p>
7404 </div>
7405 <p>
7406 This level of autodetection is enough to read the XML encoding
7407 declaration and parse the character-encoding identifier, which is
7408 still necessary to distinguish the individual members of each family
7409 of encodings (e.g. to tell UTF-8 from 8859, and the parts of 8859
7410 from each other, or to distinguish the specific EBCDIC code page in
7411 use, and so on).
7412 </p>
7413 <p>
7414 Because the contents of the encoding declaration are restricted to
7415 characters from the ASCII repertoire (however encoded), a processor
7416 can reliably read the entire encoding declaration as soon as it has
7417 detected which family of encodings is in use. Since in practice, all
7418 widely used character encodings fall into one of the categories
7419 above, the XML encoding declaration allows reasonably reliable
7420 in-band labeling of character encodings, even when external sources
7421 of information at the operating-system or transport-protocol level
7422 are unreliable. Character encodings such as UTF-7 that make
7423 overloaded usage of ASCII-valued bytes may fail to be reliably
7424 detected.
7425 </p>
7426 <p>
7427 Once the processor has detected the character encoding in use, it
7428 can act appropriately, whether by invoking a separate input routine
7429 for each case, or by calling the proper conversion function on each
7430 character of input.
7431 </p>
7432 <p>
7433 Like any self-labeling system, the XML encoding declaration will not
7434 work if any software changes the entity's character set or encoding
7435 without updating the encoding declaration. Implementors of
7436 character-encoding routines should be careful to ensure the accuracy
7437 of the internal and external information used to label the entity.
7438 </p>
7439 </div>
7440 <div class="div2">
7441 <h3>
7442 <a
7443 name="sec-guessing-with-ext-info"
7444 id="sec-guessing-with-ext-info"
7445 />F.2 Priorities in the Presence of External Encoding Information
7446 </h3>
7447 <p>
7448 The second possible case occurs when the XML entity is accompanied
7449 by encoding information, as in some file systems and some network
7450 protocols. When multiple sources of information are available, their
7451 relative priority and the preferred method of handling conflict
7452 should be specified as part of the higher-level protocol used to
7453 deliver XML. In particular, please refer to
7454 <a href="#rfc2376">[IETF RFC 3023]</a> or its successor, which
7455 defines the <code>text/xml</code> and
7456 <code>application/xml</code> MIME types and provides some useful
7457 guidance. In the interests of interoperability, however, the
7458 following rule is recommended.
7459 </p>
7460 <ul>
7461 <li>
7462 <p>
7463 If an XML entity is in a file, the Byte-Order Mark and encoding
7464 declaration are used (if present) to determine the character
7465 encoding.
7466 </p>
7467 </li>
7468 </ul>
7469 </div>
7470 </div>
7471 <div class="div1">
7472 <h2>
7473 <a name="sec-xml-wg" id="sec-xml-wg" />G W3C XML Working Group
7474 (Non-Normative)
7475 </h2>
7476 <p>
7477 This specification was prepared and approved for publication by the
7478 W3C XML Working Group (WG). WG approval of this specification does not
7479 necessarily imply that all WG members voted for its approval. The
7480 current and former participants of the XML WG are:
7481 </p>
7482 <ul>
7483 <li>Jon Bosak, Sun (<i>Chair</i>)</li>
7484 <li>James Clark (<i>Technical Lead</i>)</li>
7485 <li>Tim Bray, Textuality and Netscape (<i>XML Co-editor</i>)</li>
7486 <li>Jean Paoli, Microsoft (<i>XML Co-editor</i>)</li>
7487 <li>C. M. Sperberg-McQueen, U. of Ill. (<i>XML Co-editor</i>)</li>
7488 <li>Dan Connolly, W3C (<i>W3C Liaison</i>)</li>
7489 <li>Paula Angerstein, Texcel</li>
7490 <li>Steve DeRose, INSO</li>
7491 <li>Dave Hollander, HP</li>
7492 <li>Eliot Kimber, ISOGEN</li>
7493 <li>Eve Maler, ArborText</li>
7494 <li>Tom Magliery, NCSA</li>
7495 <li>Murray Maloney, SoftQuad, Grif SA, Muzmo and Veo Systems</li>
7496 <li>MURATA Makoto (FAMILY Given), Fuji Xerox Information Systems</li>
7497 <li>Joel Nava, Adobe</li>
7498 <li>Conleth O'Connell, Vignette</li>
7499 <li>Peter Sharpe, SoftQuad</li>
7500 <li>John Tigue, DataChannel</li>
7501 </ul>
7502 </div>
7503 <div class="div1">
7504 <h2>
7505 <a name="sec-core-wg" id="sec-core-wg" />H W3C XML Core Working Group
7506 (Non-Normative)
7507 </h2>
7508 <p>
7509 The <span>fifth</span> edition of this specification was prepared by
7510 the W3C XML Core Working Group (WG). The participants in the WG at the
7511 time of publication of this edition were:
7512 </p>
7513 <ul>
7514 <li>John Cowan, Google</li>
7515 <li>Andrew Fang, PTC-Arbortext</li>
7516 <li>Paul Grosso, PTC-Arbortext (<i>Co-Chair</i>)</li>
7517 <li>Konrad Lanz, A-SIT</li>
7518 <li>Glenn Marcy, IBM</li>
7519 <li>Henry Thompson, W3C (<i>Staff Contact</i>)</li>
7520 <li>Richard Tobin, University of Edinburgh</li>
7521 <li>Daniel Veillard</li>
7522 <li>Norman Walsh, Mark Logic (<i>Co-Chair</i>)</li>
7523 <li>François Yergeau</li>
7524 </ul>
7525 </div>
7526 <div class="div1">
7527 <h2>
7528 <a name="prod-notes" id="prod-notes" />I Production Notes
7529 (Non-Normative)
7530 </h2>
7531 <p>
7532 This edition was encoded in a slightly modified version of the
7533 <a href="http://www.w3.org/2002/xmlspec/dtd/2.10/xmlspec.dtd"
7534 >XMLspec DTD, v2.10</a
7535 >. The XHTML versions were produced with a combination of the
7536 <a href="http://www.w3.org/2002/xmlspec/xhtml/1.13/xmlspec.xsl"
7537 >xmlspec.xsl</a
7538 >,
7539 <a href="http://www.w3.org/2002/xmlspec/xhtml/1.13/diffspec.xsl"
7540 >diffspec.xsl</a
7541 >, and <a href="REC-xml.xsl">REC-xml.xsl</a> XSLT stylesheets.
7542 </p>
7543 </div>
7544 <div class="div1">
7545 <h2>
7546 <a name="sec-suggested-names" id="sec-suggested-names" />J Suggestions
7547 for XML Names (Non-Normative)
7548 </h2>
7549 <p>
7550 The following suggestions define what is believed to be best practice
7551 in the construction of XML names used as element names, attribute
7552 names, processing instruction targets, entity names, notation names,
7553 and the values of attributes of type ID, and are intended as guidance
7554 for document authors and schema designers. All references to Unicode
7555 are understood with respect to a particular version of the Unicode
7556 Standard greater than or equal to 5.0; which version should be used is
7557 left to the discretion of the document author or schema designer.
7558 </p>
7559 <p>
7560 The first two suggestions are directly derived from the rules given
7561 for identifiers in Standard Annex #31 (UAX #31) of the Unicode
7562 Standard, version 5.0 <a href="#Unicode">[Unicode]</a>, and exclude
7563 all control characters, enclosing nonspacing marks, non-decimal
7564 numbers, private-use characters, punctuation characters (with the
7565 noted exceptions), symbol characters, unassigned codepoints, and white
7566 space characters. The other suggestions are mostly derived from
7567 Appendix B in previous editions of this specification.
7568 </p>
7569 <ol class="enumar">
7570 <li>
7571 <p>
7572 The first character of any name should have a Unicode property of
7573 ID_Start, or else be '_' #x5F.
7574 </p>
7575 </li>
7576 <li>
7577 <p>
7578 Characters other than the first should have a Unicode property of
7579 ID_Continue, or be one of the characters listed in the table
7580 entitled "Characters for Natural Language Identifiers" in UAX #31,
7581 with the exception of "'" #x27 and "’" #x2019.
7582 </p>
7583 </li>
7584 <li>
7585 <p>
7586 Characters in names should be expressed using Normalization Form C
7587 as defined in <a href="#unipart15">[UnicodeNormal]</a>.
7588 </p>
7589 </li>
7590 <li>
7591 <p>
7592 Ideographic characters which have a canonical decomposition
7593 (including those in the ranges [#xF900-#xFAFF] and
7594 [#x2F800-#x2FFFD], with 12 exceptions) should not be used in
7595 names.
7596 </p>
7597 </li>
7598 <li>
7599 <p>
7600 Characters which have a compatibility decomposition (those with a
7601 "compatibility formatting tag" in field 5 of the Unicode Character
7602 Database -- marked by field 5 beginning with a "&lt;") should not
7603 be used in names. This suggestion does not apply to characters
7604 which despite their compatibility decompositions are in regular
7605 use in their scripts, for example #x0E33 THAI CHARACTER SARA AM or
7606 #x0EB3 LAO CHARACTER AM.
7607 </p>
7608 </li>
7609 <li>
7610 <p>
7611 Combining characters meant for use with symbols only (including
7612 those in the ranges [#x20D0-#x20EF] and [#x1D165-#x1D1AD]) should
7613 not be used in names.
7614 </p>
7615 </li>
7616 <li>
7617 <p>
7618 The interlinear annotation characters ([#xFFF9-#xFFFB]) should not
7619 be used in names.
7620 </p>
7621 </li>
7622 <li>
7623 <p>Variation selector characters should not be used in names.</p>
7624 </li>
7625 <li>
7626 <p>
7627 Names which are nonsensical, unpronounceable, hard to read, or
7628 easily confusable with other names should not be employed.
7629 </p>
7630 </li>
7631 </ol>
7632 </div>
7633 </div>
7634 <script
7635 type="application/javascript"
7636 src="https://www.w3.org/scripts/TR/fixup.js"
7637 ></script>
7638 </body>
7639 </html>