[1] document ::= prolog element Misc* PS (Links on this page do not work)

Tokens & options to be recognised

[2] Char::= #x9 | #xA | #xD | [#x20-#xD7FF]

[3] S ::= (#x20 | #x9 | #xD | #xA)+

[26] VersionNum::= ([a-zA-Z0-9_.:] | '-')+

[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*

[5] Name ::= (Letter | '_' | ':') (NameChar)*

[4] NameChar ::= Letter | Digit |'.'|'-'|'_'|':'| CombiningChar | Extender

[84] Letter ::= BaseChar | Ideographic

[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")

[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"

[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]

 

 

[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?

[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

'<?xml'

'<?xml'

[24] VersionInfo ::=

S

'version'

Eq

('

VersionNum

' |"

VersionNum

")

S

'version'

Eq ::= S? '=' S?

('

VersionNum

' |"

VersionNum

")

[80] EncodingDecl ::= S

'encoding'

Eq

('"'

EncName

'"' | "'"

EncName

"'" )

S

'encoding'

Eq ::= S? '=' S?

('"'

EncName

'"' | "'"

EncName

"'" )

SDDecl ::=

S

'standalone'

Eq

(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))

S

'standalone'

Eq

(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))

S?

S?

'?>'

'?>'

 

[27] Misc ::= Comment | PI | S

[15] Comment ::= '<!--'

(( Char - '-') |('-' (Char - '-)))*

'-->'

'<!--'

(( Char - '-') | ('-' (Char - '-)))*

'-->'

[16] PI ::= '<?'

PITarget

(S (Char* - (Char* '?>' Char*)))? '?>'

'<?'

[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

(S (Char* - (Char* '?>' Char*)))? '?>'

S

S

 

[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl | PEReference | S)* ']' S?)? '>' [ VC: Root Element Type ]

'<!DOCTYPE'

'<!DOCTYPE'

S

S

Name

Name

75] ExternalID ::= 'SYSTEM' S SystemLiteral

| 'PUBLIC'

S

PubidLiteral

S

SystemLiteral

'SYSTEM'

S

| 'PUBLIC'

[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'"

S

[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")

[29] markupdecl ::=

elementdecl

| AttlistDecl

| EntityDecl

| NotationDecl

| PI

| Comment

[45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'

[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children

[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'

[47] children ::= (choice | seq) ('?' | '*' | '+')?

choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'

[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'

[52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'

[53] AttDef ::= S Name S AttType S DefaultDecl

[54] AttType ::= StringType | TokenizedType | EnumeratedType [55] StringType ::= 'CDATA' [56] TokenizedType ::= 'ID'| 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'

[70] EntityDecl ::= GEDecl | PEDecl

[71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'

[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)

[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'

[69] PEReference ::= '%' Name ';'

[67] Reference ::= EntityRef | CharRef

[68] EntityRef ::= '&' Name ';'

[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'

[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral

[76] NDataDecl ::= S 'NDATA' S Name

[72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'

[74] PEDef ::= EntityValue | ExternalID

[82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'

[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l'))

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

[69] PEReference ::= '%'

Name

';'

[ VC: Entity Declared ]

[ WFC: No Recursion ]

[ WFC: In DTD ]

'%'

Name

';'

[ VC: Entity Declared ] the Name given in the entity reference must match that in an entity declaration

[ WFC: No Recursion ]

[ WFC: In DTD ]

'>'

 

 

[39] element ::= EmptyElemTag | STag content ETag

[ WFC: Element Type Match ] [ VC: Element Valid ]

[44] EmptyElemTag ::= '<' Name

(S Attribute)*

S? '/>'

[ WFC: Unique Att Spec ]

'<'

'<'

Name

Name

[41] Attribute ::=

Name Eq AttValue

Name

Eq

[10] AttValue ::= '"' ([^<&"] | Reference)* '"'

'/>'

'/>'

[40] STag ::= '<' Name (S Attribute)* S?

'>'

'<'

'<'

Name

Name

(S Attribute)* S?

[41] Attribute ::= Name Eq AttValue

'>'

'>'

[43] content ::= (element |

CharData |

Reference |

CDSect |

PI |

Comment)*

[39] element ::= EmptyElemTag | STag content ETag

[39] element ::= EmptyElemTag | STag content ETag

[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*)

[67] Reference ::= EntityRef | CharRef

[67] Reference ::= EntityRef | CharRef

[18] CDSect ::=

CDStart

CData CDEnd

[19] CDStart ::= '<![CDATA['

[20] CData ::= (Char* - (Char* ']]>' Char*))

[21] CDEnd ::= ']]>'

[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

[16] PI ::= '<?' PITarget (S (Char* - (Char* '?>' Char*)))? '?>'

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'

[42] ETag ::= '</' Name

S?

'>'

'</'

'</'

Name

Name

S?

S?

'>'

'>'