[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
[3] S ::= (#x20 | #x9 | #xD | #xA)+
[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'"
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'"
[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")
[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"
[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)
Example:
<!-- declarations for <head> & <body> -->
[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'
[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))
[18] CDSect ::= CDStart CData CDEnd
[19] CDStart ::= '<![CDATA['
[20] CData ::= (Char* - (Char* ']]>' Char*))
[21] CDEnd ::= ']]>'
Example:
<![CDATA[<greeting>Hello, world!</greeting>]]>
Example:
<?xml version="1.0"?>
<greeting>Hello, world!</greeting>
Example:
<greeting>Hello, world!</greeting>
[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[24] VersionInfo ::= S 'version' Eq (' VersionNum ' | " VersionNum ")
[26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')+
[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '>'
[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment
[30] extSubset ::= TextDecl? extSubsetDecl
[31] extSubsetDecl ::= ( markupdecl | conditionalSect | PEReference | S )*
Example:
<?xml version="1.0"?>
<!DOCTYPE greeting SYSTEM "hello.dtd">
<greeting>Hello, world!</greeting>
Example:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE greeting [
<!ELEMENT greeting (#PCDATA)>
]>
<greeting>Hello, world!</greeting>
Example:
<?xml version="1.0" standalone='yes'?>
Example:
<!ATTLIST poem xml:space (default|preserve) 'preserve'>
[33] LanguageID ::= Langcode ('-' Subcode)*
[34] Langcode ::= ISO639Code | IanaCode | UserCode
[35] ISO639Code ::= ([a-z] | [A-Z]) ([a-z] | [A-Z])
[36] IanaCode ::= ('i' | 'I') '-' ([a-z] | [A-Z])+
[37] UserCode ::= ('x' | 'X') '-' ([a-z] | [A-Z])+
[38] Subcode ::= ([a-z] | [A-Z])+
Example:
<p xml:lang="en">The quick brown fox jumps over the lazy dog.</p>
<p xml:lang="en-GB">What colour is it?</p>
<p xml:lang="en-US">What color is it?</p>
<sp who="Faust" desc='leise' xml:lang="de">
<l>Habe nun, ach! Philosophie,</l>
<l>Juristerei, und Medizin</l>
<l>und leider auch Theologie</l>
<l>durchaus studiert mit heißem Bemüh'n.</l>
</sp>
Example:
xml:lang NMTOKEN #IMPLIED
Example:
<!ATTLIST poem xml:lang NMTOKEN 'fr'>
<!ATTLIST gloss xml:lang NMTOKEN 'en'>
<!ATTLIST note xml:lang NMTOKEN 'en'>
[39] element ::= EmptyElemTag | STag content ETag
Example:
<termdef id="dt-dog" term="dog">
Example:
</termdef>
Example:
<IMG align="left"
src="http://www.w3.org/Icons/WWW/w3c_home" />
<br></br>
<br/>
Example:
<!ELEMENT br EMPTY>
<!ELEMENT p (#PCDATA|emph)* >
<!ELEMENT %name.para; %content.para; >
<!ELEMENT container ANY>
[47] children ::= (choice | seq) ('?' | '*' | '+')?
[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
Example:
<!ELEMENT spec (front, body, back?)>
<!ELEMENT div1 (head, (p | list | note)*, div2*)>
<!ELEMENT dictionary-body (%div.mix; | %dict.mix;)*>
Example:
<!ELEMENT p (#PCDATA|a|ul|b|i|em)*>
<!ELEMENT p (#PCDATA | %font; | %phrase; | %special; | %form;)* >
<!ELEMENT b (#PCDATA)>
[54] AttType ::= StringType | TokenizedType | EnumeratedType
[55] StringType ::= 'CDATA'
[56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'
[57] EnumeratedType ::= NotationType | Enumeration
[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
Example:
<!ATTLIST termdef
id ID #REQUIRED
name CDATA #IMPLIED>
<!ATTLIST list
type (bullets|ordered|glossary) "ordered">
<!ATTLIST form
method CDATA #FIXED "POST">
[61] conditionalSect ::= includeSect | ignoreSect
[62] includeSect ::= '<![' S? 'INCLUDE' S? '[' extSubsetDecl ']]>'
[63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' ignoreSectContents* ']]>'
[64] ignoreSectContents ::= Ignore ('<![' ignoreSectContents ']]>' Ignore)*
Example:
<!ENTITY % draft 'INCLUDE' >
<!ENTITY % final 'IGNORE' >
<![%draft;[
<!ELEMENT book (comments*, title, body, supplements?)>
]]>
<![%final;[
<!ELEMENT book (title, body, supplements?)>
]]>
[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
&#x
", the digits and
letters up to the terminating ;
provide a hexadecimal
representation of the character's code point in ISO/IEC 10646.
If it begins just with "&#
", the digits up to the terminating
;
provide a decimal representation of the character's
code point.
[67] Reference ::= EntityRef | CharRef
[68] EntityRef ::= '&' Name ';'
[69] PEReference ::= '%' Name ';'
Example:
Type <key>less-than</key> (<) to save options.
This document was prepared on &docdate; and
is classified &security-level;.
Example:
<!-- declare the parameter entity "ISOLat2"... -->
<!ENTITY % ISOLat2
SYSTEM "http://www.xml.com/iso/isolat2-xml.entities" >
<!-- ... now reference it. -->
%ISOLat2;
[70] EntityDecl ::= GEDecl | PEDecl
[71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'
[72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
[74] PEDef ::= EntityValue | ExternalID
Example:
<!ENTITY Pub-Status "This is a pre-release of the
specification.">
[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral
Example:
<!ENTITY open-hatch
SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY open-hatch
PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
"http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic
SYSTEM "../grafix/OpenHatch.gif"
NDATA gif >
[77] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" )
[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
Example:
<?xml encoding='UTF-8'?>
<?xml encoding='EUC-JP'?>
Example:
<!ENTITY % YN '"Yes"' >
<!ENTITY WhatHeSaid "He said &YN;" >
Example:
<!ENTITY EndAttr "27'" >
<element attribute='a-&EndAttr;>
Example:
<!ENTITY % pub "Éditions Gallimard" >
<!ENTITY rights "All rights reserved" >
<!ENTITY book "La Peste: Albert Camus,
© 1947 %pub;. &rights;" >
Example:
La Peste: Albert Camus,
© 1947 Éditions Gallimard. &rights;
Example:
<!ENTITY lt "&#60;">
<!ENTITY gt ">">
<!ENTITY amp "&#38;">
<!ENTITY apos "'">
<!ENTITY quot """>
[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
[83] PublicID ::= 'PUBLIC' S PubidLiteral
Example:
symbol ::= expression
[84] Letter ::= BaseChar | Ideographic
[85] BaseChar ::= [A-Z] | [a-z] | [À-Ö] | [Ø-ö] | [ø-ÿ] | [Ā-ı] | [Ĵ-ľ] | [Ł-ň] | [Ŋ-ž] | [ƀ-ǃ] | [Ǎ-ǰ] | [Ǵ-ǵ] | [Ǻ-ȗ] | [ɐ-ʨ] | [ʻ-ˁ] | Ά | [Έ-Ί] | Ό | [Ύ-Ρ] | [Σ-ώ] | [ϐ-ϖ] | Ϛ | Ϝ | Ϟ | Ϡ | [Ϣ-ϳ] | [Ё-Ќ] | [Ў-я] | [ё-ќ] | [ў-ҁ] | [Ґ-ӄ] | [Ӈ-ӈ] | [Ӌ-ӌ] | [Ӑ-ӫ] | [Ӯ-ӵ] | [Ӹ-ӹ] | [Ա-Ֆ] | ՙ | [ա-ֆ] | [א-ת] | [װ-ײ] | [ء-غ] | [ف-ي] | [ٱ-ڷ] | [ں-ھ] | [ۀ-ێ] | [ې-ۓ] | ە | [ۥ-ۦ] | [अ-ह] | ऽ | [क़-ॡ] | [অ-ঌ] | [এ-ঐ] | [ও-ন] | [প-র] | ল | [শ-হ] | [ড়-ঢ়] | [য়-ৡ] | [ৰ-ৱ] | [ਅ-ਊ] | [ਏ-ਐ] | [ਓ-ਨ] | [ਪ-ਰ] | [ਲ-ਲ਼] | [ਵ-ਸ਼] | [ਸ-ਹ] | [ਖ਼-ੜ] | ਫ਼ | [ੲ-ੴ] | [અ-ઋ] | ઍ | [એ-ઑ] | [ઓ-ન] | [પ-ર] | [લ-ળ] | [વ-હ] | ઽ | ૠ | [ଅ-ଌ] | [ଏ-ଐ] | [ଓ-ନ] | [ପ-ର] | [ଲ-ଳ] | [ଶ-ହ] | ଽ | [ଡ଼-ଢ଼] | [ୟ-ୡ] | [அ-ஊ] | [எ-ஐ] | [ஒ-க] | [ங-ச] | ஜ | [ஞ-ட] | [ண-த] | [ந-ப] | [ம-வ] | [ஷ-ஹ] | [అ-ఌ] | [ఎ-ఐ] | [ఒ-న] | [ప-ళ] | [వ-హ] | [ౠ-ౡ] | [ಅ-ಌ] | [ಎ-ಐ] | [ಒ-ನ] | [ಪ-ಳ] | [ವ-ಹ] | ೞ | [ೠ-ೡ] | [അ-ഌ] | [എ-ഐ] | [ഒ-ന] | [പ-ഹ] | [ൠ-ൡ] | [ก-ฮ] | ะ | [า-ำ] | [เ-ๅ] | [ກ-ຂ] | ຄ | [ງ-ຈ] | ຊ | ຍ | [ດ-ທ] | [ນ-ຟ] | [ມ-ຣ] | ລ | ວ | [ສ-ຫ] | [ອ-ຮ] | ະ | [າ-ຳ] | ຽ | [ເ-ໄ] | [ཀ-ཇ] | [ཉ-ཀྵ] | [Ⴀ-Ⴥ] | [ა-ჶ] | ᄀ | [ᄂ-ᄃ] | [ᄅ-ᄇ] | ᄉ | [ᄋ-ᄌ] | [ᄎ-ᄒ] | ᄼ | ᄾ | ᅀ | ᅌ | ᅎ | ᅐ | [ᅔ-ᅕ] | ᅙ | [ᅟ-ᅡ] | ᅣ | ᅥ | ᅧ | ᅩ | [ᅭ-ᅮ] | [ᅲ-ᅳ] | ᅵ | ᆞ | ᆨ | ᆫ | [ᆮ-ᆯ] | [ᆷ-ᆸ] | ᆺ | [ᆼ-ᇂ] | ᇫ | ᇰ | ᇹ | [Ḁ-ẛ] | [Ạ-ỹ] | [ἀ-ἕ] | [Ἐ-Ἕ] | [ἠ-ὅ] | [Ὀ-Ὅ] | [ὐ-ὗ] | Ὑ | Ὓ | Ὕ | [Ὗ-ώ] | [ᾀ-ᾴ] | [ᾶ-ᾼ] | ι | [ῂ-ῄ] | [ῆ-ῌ] | [ῐ-ΐ] | [ῖ-Ί] | [ῠ-Ῥ] | [ῲ-ῴ] | [ῶ-ῼ] | Ω | [K-Å] | ℮ | [ↀ-ↂ] | [ぁ-ゔ] | [ァ-ヺ] | [ㄅ-ㄬ] | [가-힣]
[86] Ideographic ::= [一-龥] | 〇 | [〡-〩]
[87] CombiningChar ::= [̀-ͅ] | [͠-͡] | [҃-҆] | [֑-֡] | [֣-ֹ] | [ֻ-ֽ] | ֿ | [ׁ-ׂ] | ׄ | [ً-ْ] | ٰ | [ۖ-ۜ] | [-۟] | [۠-ۤ] | [ۧ-ۨ] | [۪-ۭ] | [ँ-ः] | ़ | [ा-ौ] | ् | [॑-॔] | [ॢ-ॣ] | [ঁ-ঃ] | ় | া | ি | [ী-ৄ] | [ে-ৈ] | [ো-্] | ৗ | [ৢ-ৣ] | ਂ | ਼ | ਾ | ਿ | [ੀ-ੂ] | [ੇ-ੈ] | [ੋ-੍] | [ੰ-ੱ] | [ઁ-ઃ] | ઼ | [ા-ૅ] | [ે-ૉ] | [ો-્] | [ଁ-ଃ] | ଼ | [ା-ୃ] | [େ-ୈ] | [ୋ-୍] | [ୖ-ୗ] | [ஂ-ஃ] | [ா-ூ] | [ெ-ை] | [ொ-்] | ௗ | [ఁ-ః] | [ా-ౄ] | [ె-ై] | [ొ-్] | [ౕ-ౖ] | [ಂ-ಃ] | [ಾ-ೄ] | [ೆ-ೈ] | [ೊ-್] | [ೕ-ೖ] | [ം-ഃ] | [ാ-ൃ] | [െ-ൈ] | [ൊ-്] | ൗ | ั | [ิ-ฺ] | [็-๎] | ັ | [ິ-ູ] | [ົ-ຼ] | [່-ໍ] | [༘-༙] | ༵ | ༷ | ༹ | ༾ | ༿ | [ཱ-྄] | [྆-ྋ] | [ྐ-ྕ] | ྗ | [ྙ-ྭ] | [ྱ-ྷ] | ྐྵ | [⃐-⃜] | ⃡ | [〪-〯] | ゙ | ゚
[88] Digit ::= [0-9] | [٠-٩] | [۰-۹] | [०-९] | [০-৯] | [੦-੯] | [૦-૯] | [୦-୯] | [௧-௯] | [౦-౯] | [೦-೯] | [൦-൯] | [๐-๙] | [໐-໙] | [༠-༩]
[89] Extender ::= · | ː | ˑ | · | ـ | ๆ | ໆ | 々 | [〱-〵] | [ゝ-ゞ] | [ー-ヾ]
Example:
<!ENTITY example "<p>An ampersand (&#38;) may be escaped
numerically (&#38;#38;) or with a general entity
(&amp;).</p>" >
Example:
<p>An ampersand (&) may be escaped
numerically (&#38;) or with a general entity
(&amp;).</p>
Example:
An ampersand (&) may be escaped
numerically (&) or with a general entity
(&).
Example:
1 <?xml version='1.0'?>
2 <!DOCTYPE test [
3 <!ELEMENT test (#PCDATA) >
4 <!ENTITY % xx '%zz;'>
5 <!ENTITY % zz '<!ENTITY tricky "error-prone" >' >
6 %xx;
7 ]>
8 <test>This sample shows a &tricky; method.</test>
Reformatted by Sean M. Burke