6.13 An EBNF Example: XML and DTD Formalized

XML:

[1] document ::=

prolog element Misc*

[39]element ::=

EmptyElemTag | STag content ETag

[40]STag ::=

'<' Name (S Attribute)* S? '>'

[42]ETag ::=

'</' Name S? '>'

[44]EmptyElemTag::=

'<' Name (S Attribute)* S? '/>'

[41]Attribute ::=

Name Eq AttValue

[5] Name ::=

(Letter | '_' | ':') (NameChar)*

[4] NameChar ::=

Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender

[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? ')'