XML Grammar

document prolog element (misc)*
char [\t\n\r -\x0000D7FF\x0000E000-\x0000FFFD\x00010000-\x0010FFFF]
s [ \t\r\n]+
name‑start‑char [:A-Z_a-z\x000000C0-\x000000D6\x000000D8-\x000000F6\x000000F8-\x000002FF\x00000370-\x0000037D\x0000037F-\x00001FFF\x0000200C-\x0000200D\x00002070-\x0000218F\x00002C00-\x00002FEF\x00003001-\x0000D7FF\x0000F900-\x0000FDCF\x0000FDF0-\x0000FFFD\x00010000-\x000EFFFF]
name‑char name‑start‑char | [-.0-9\x000000B7\x00000300-\x0000036F\x0000203F-\x00002040]
name name‑start‑char name‑char*
names name ( name)*
nm‑token name‑char+
nm‑tokens nm‑token ( nm‑token)*
prolog xml‑decl? misc* (doc‑type‑decl misc*)?
xml‑decl <?xml version‑info encoding‑decl? sd‑decl? s? ?>
version‑info s version eq version‑number
version‑num 1 . [0-9]+
version‑num‑dq \" version‑num \"
version‑num‑sq \' version‑num \'
version‑number version‑num‑dq | version‑num‑sq
encoding‑decl s encoding eq enc‑name
encoding‑name [A-Za-z] [A-Za-z0-9._-]*
enc‑name‑dq \" encoding‑name \"
enc‑name‑sq \' encoding‑name \'
enc‑name enc‑name‑dq | enc‑name‑sq
sd‑decl s standalone eq yes‑no
doc‑type‑decl <!DOCTYPE s name (s external‑id)? s? ([ int‑subset ] s?)? >
external‑id (SYSTEM s system‑literal) | (PUBLIC s pub‑id‑literal s system‑literal)
system‑literal (\" ([^\"]*) \") | (\' ([^\']*) \')
pub‑id‑literal \" (pub‑id‑char*) \" | \' ((pub‑id‑char\')*) \'
pub‑id‑char [ \r\n] | [a-zA-Z0-9] | [-\'()+,./:=?;!*#@$_%]
int‑subset (markup‑decl | decl‑sep)*
markup‑decl element‑decl | attlist‑decl | entity‑decl | notation‑decl | pi | comment
decl‑sep pe‑reference | s
element‑decl <!ELEMENT s name s content‑spec s? >
content‑spec EMPTY | ANY | mixed | children
children (choice | seq) (? | * | +)?
cp (name | choice | seq) (? | * | +)?
choice ( s? cp (s? | s? cp)+ s? )
seq ( s? cp (s? , s? cp)* s? )
mixed ( s? #PCDATA (s? | s? name)* s? )* | ( s? #PCDATA s? )
attlist‑decl <!ATTLIST s name att‑def* s? >
att‑def s name s att‑type s default‑decl
att‑type string‑type | tokenized‑type | enumerated‑type
string‑type CDATA
tokenized‑type ID | IDREF | IDREFS | ENTITY | ENTITIES | NMTOKEN | NMTOKENS
enumerated‑type notation‑type | enumeration
notation‑type NOTATION s ( s? name (s? | s? name)* s? )
enumeration ( s? nm‑token (s? | s? nm‑token)* s? )
default‑decl #REQUIRED | #IMPLIED | ((#FIXED s)? att‑value)
entity‑decl ge‑decl | pe‑decl
ge‑decl <!ENTITY s name s entity‑def s? >
pe‑decl <!ENTITY s % s name s pe‑def s? >
entity‑def entity‑value | (external‑id ndata‑decl?)
pe‑def entity‑value | external‑id
entity‑value \" ([^%&\"] | pe‑reference | reference)* \" | \' ([^%&\'] | pe‑reference | reference)* \'
ndata‑decl s NDATA s name
pe‑reference % name ;
notation‑decl <!NOTATION s name s (external‑id | public‑id) s? >
public‑id PUBLIC s pub‑id‑literal
element < name (s attribute)* s? (/> | > content etag)
etag </ name s? >
content char‑data? ((element | reference | cd‑sect | pi | comment) char‑data?)*
char‑data‑char [^<&]
char‑data char‑data‑char*([^<&]* ]]> [^<&]*)
cd‑sect <![CDATA[ char]]>* ]]>
attribute name eq att‑value
att‑value‑dq \" ([^<&\"] | reference)* \"
att‑value‑sq \' ([^<&\'] | reference)* \'
att‑value att‑value‑dq | att‑value‑sq
entity‑ref & name ;
dec‑code‑point [0-9]+
hex‑code‑point [0-9a-fA-F]+
char‑ref &# dec‑code‑point ; | &#x hex‑code‑point ;
reference entity‑ref | char‑ref
misc comment | pi | s
comment <!-- (char- | - char-)* -->
pi <? pi‑target s char?>* ?>
pi‑target namexml
xml [xX] [mM] [lL]
eq s? = s?
yes‑no \"yes\" | \"no\"