REC-xml-19980210.xml 156 KB

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