The syntax grammar of XML
Anne Brüggemann-Klein, Derick Wood
Version 1.0, April 12, 2001
No
XML No
Rule
(1)
[1]
Document
::=
Prolog
Element
Misc
*
(2)
[9]
EntityValue
::=
DQuote
(
EntCharsNoDQuotes
|
PEReference
|
Reference
)*
DQuote
|
SQuote
(
EntCharsNoSQuotes
|
PEReference
|
Reference
)*
SQuote
(3)
[10]
AttValue
::=
DQuote
(
AttCharsNoDQuotes
|
Reference
)*
DQuote
|
SQuote
(
AttCharsNoSQuotes
|
Reference
)*
SQuote
(4)
[15]
Comment
::=
CommentOpen
CommentBody
CommentClose
(5)
[16]
PI
::=
PIOpen
PITarget
(
S
PIBody
)?
PIClose
(6)
[18]
CDSect
::=
CDStart
CData
CDEnd
(7)
[22]
Prolog
::=
XMLDecl
?
Misc
* (
DocTypeDecl
Misc
*)?
(8)
[23]
XMLDecl
::=
XMLDeclOpen
VersionInfo
EncodingDecl
?
SDDecl
?
S
?
PIClose
(9)
[24]
VersionInfo
::=
S
VersionKW
S
?
Eq
S
? (
SQuote
VersionNum
SQuote
|
DQuote
VersionNum
DQuote
)
(10)
[27]
Misc
::=
Comment
|
PI
|
S
(11)
[28]
DocTypeDecl
::=
DocTypeOpen
S
Name
(
S
ExternalID
)?
S
? (
BOpen
(
MarkupDecl
|
PEReference
|
S
)*
BClose
S
?)?
DeclClose
(12)
[29]
MarkupDecl
::=
ElementDecl
|
AttlistDecl
|
EntityDecl
|
NotationDecl
|
PI
|
Comment
(13)
[30]
ExtSubset
::=
TextDecl
?
ExtSubsetDecl
(14)
[31]
ExtSubsetDecl
::=
(
MarkupDecl
|
ConditionalSect
|
PEReference
|
S
)*
(15)
[32]
SDDecl
::=
S
StandAloneKW
S
?
Eq
S
?
YesOrNo
(16)
[39]
Element
::=
EmptyElemTag
|
STag
Content
ETag
(17)
[40]
STag
::=
STagOpen
Name
(
S
Attribute
)*
S
?
TagClose
(18)
[41]
Attribute
::=
Name
S
?
Eq
S
?
AttValue
(19)
[42]
ETag
::=
ETagOpen
Name
S
?
TagClose
(20)
[43]
Content
::=
(
Element
|
CharData
|
Reference
|
CDSect
|
PI
|
Comment
)*
(21)
[44]
EmptyElemTag
::=
STagOpen
Name
(
S
Attribute
)*
S
?
EmptyTagClose
(22)
[45]
ElementDecl
::=
ElementDeclOpen
S
Name
S
ContentSpec
S
?
DeclClose
(23)
[46]
ContentSpec
::=
EmptyKW
|
AnyKW
|
Mixed
|
Children
(24)
[47]
Children
::=
(
Choice
|
Seq
) (
QMark
|
Star
|
Plus
)?
(25)
[48]
Cp
::=
(
Name
|
Choice
|
Seq
) (
QMark
|
Star
|
Plus
)?
(26)
[49]
Choice
::=
POpen
S
?
Cp
(
S
?
Alt
S
?
Cp
)*
S
?
PClose
(27)
[50]
Seq
::=
POpen
S
?
Cp
(
S
?
Comma
S
?
Cp
)*
S
?
PClose
(28)
[51]
Mixed
::=
POpen
S
?
PCDataKW
(
S
?
Alt
S
?
Name
)*
S
?
PClose
Star
|
POpen
S
?
PCDataKW
S
?
PClose
(29)
[52]
AttlistDecl
::=
AttlistDeclOpen
S
Name
AttDef
*
S
?
DeclClose
(30)
[53]
AttDef
::=
S
Name
S
AttType
S
DefaultDecl
(31)
[54]
AttType
::=
StringType
|
TokenizedType
|
EnumeratedType
(32)
[57]
EnumeratedType
::=
NotationType
|
Enumeration
(33)
[58]
NotationType
::=
NotationKW
S
POpen
S
?
Name
(
S
?
Alt
S
?
Name
)*
S
?
PClose
(34)
[59]
Enumeration
::=
POpen
S
?
NmToken
(
S
?
Alt
S
?
NmToken
)*
S
?
PClose
(35)
[60]
DefaultDecl
::=
RequiredKW
|
ImpliedKW
| ((
FixedKW
S
)?
AttValue
)
(36)
[61]
ConditionalSect
::=
IncludeSect
|
IgnoreSect
(37)
[62]
IncludeSect
::=
SectOpen
S
?
IncludeKW
S
?
BOpen
ExtSubsetDecl
SectClose
(38)
[63]
IgnoreSect
::=
SectOpen
S
?
IgnoreKW
S
?
BOpen
IgnoreSectContents
*
SectClose
(39)
[64]
IgnoreSectContents
::=
Ignore
(
SectOpen
IgnoreSectContents
SectClose
Ignore
)*
(40)
[67]
Reference
::=
EntityRef
|
CharRef
(41)
[70]
EntityDecl
::=
GEDecl
|
PEDecl
(42)
[71]
GEDecl
::=
EntityDeclOpen
S
Name
S
EntityDef
S
?
DeclClose
(43)
[72]
PEDecl
::=
EntityDeclOpen
S
Percent
S
Name
S
PEDef
S
?
DeclClose
(44)
[73]
EntityDef
::=
EntityValue
| (
ExternalID
NDataDecl
?)
(45)
[74]
PEDef
::=
EntityValue
|
ExternalID
(46)
[75]
ExternalID
::=
SystemKW
S
SystemLiteral
|
PublicKW
S
PubidLiteral
S
SystemLiteral
(47)
[76]
NDataDecl
::=
S
NDataKW
S
Name
(48)
[77]
TextDecl
::=
XMLDeclOpen
VersionInfo
?
EncodingDecl
S
?
PIClose
(49)
[78]
ExtParsedEnt
::=
TextDecl
?
Content
(50)
[79]
ExtPE
::=
TextDecl
?
ExtSubsetDecl
(51)
[80]
EncodingDecl
::=
S
EncodingKW
S
?
Eq
S
? (
DQuote
EncName
DQuote
|
SQuote
EncName
SQuote
)
(52)
[82]
NotationDecl
::=
NotationDeclOpen
S
Name
S
(
ExternalID
|
PublicID
)
S
?
DeclClose
(53)
[83]
PublicID
::=
PublicKW
S
PubidLiteral