MinXML Grammar

Grammar for MinXML

A complete grammar for MinXML in EBNF, together with railroad diagram. courtesy of the excellent Railroad Diagram Generator. Note that it is mandatory to discard comments and whitespaces (Comment+S).

EBNF Grammar

MinXML ::= Element | D MinXML
Element ::= StartTag MinXML* D? EndTag | FusedTag
StartTag ::= '<' S? NCName ( S Attributes)* S? '>'
EndTag ::= '</' S? NCName S? '>'
FusedTag ::= '<' S? NCName S? Attributes S? '/' '>'
Attribute ::= NCName S? '=' S? AttValue
NCName ::= [http://www.w3.org/TR/xml-names/#NT-NCName]
AttValue ::= '"' ([^&<"]|Reference)* '"' | "'" ([^&<']|Reference)* "'"
Reference ::= '&' ('lt'|'gt'|'amp'|'quot'|'apos'|[0-9]+|'x'[0-9A-Fa-F]+)';'
D ::= ( S? Comment )+ S?
Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Char ::= [http://www.w3.org/TR/REC-xml/#NT-Char]
S ::= (#x20 | #x9 | #xD | #xA)+

Railroad Diagram

MinXML

MinXML.png

Element

Element.png

StartTag

StartTag.png

EndTag

EndTag.png

FusedTag

FusedTag.png

Attribute

Attribute.png

NCName

NCName.png

AttValue

AttValue.png

Reference

Reference.png

D (for Discard)

D.png

Comment

Comment.png

Char

Char.png

S

S.png