REC-xml-19980210.xml 156 KB

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