HydraXML Grammar

Grammar for HydraXML

A complete grammar for MinXML in HydraXML, 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

HydraXML ::= D* Element
Element ::= StartTag (D? Name S? (':'|'+:') S? )? HydraXML* D? EndTag | FusedTag
StartTag ::= '<' S? Name ( S Attributes)* S? '>'
EndTag ::= '</' S? Name S? '>'
FusedTag ::= '<' S? Name S? Attributes S? '/' '>'
Attribute ::= Name S? ( ( '='|'+=') S? AttValue ) | ( (':'|'+:') S? JSONString )
Name ::= NCName | JSONString
NCName ::= [http://www.w3.org/TR/xml-names/#NT-NCName]
AttValue ::= '"' ([^&<"]|Reference)* '"' | "'" ([^&<']|Reference)* "'"
JSONString ::= '"' ([^"\]|Escape)* '"' | "'" ([^'\]|Escape)* "'"
Escape ::= '\' ( ["'\/bfnrt] | 'u' Hex Hex Hex Hex | Reference )
Reference ::= '&' (NamedCharacterReference|[0-9]+|'x' Hex+ )';'
NamedCharacterReference ::= [http://www.w3.org/TR/html5/syntax.html#named-character-references]
Hex ::= [0-9a-fA-F]
D ::= ( S? Comment )+ S?
S ::= (#x20 | #x9 | #xD | #xA)+
Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* '-->'
Char ::= [http://www.w3.org/TR/REC-xml/#NT-Char]

Railroad Diagram

HydraXML

HydraXML.png

Element

Element.png

StartTag

StartTag.png

EndTag

EndTag.png

FusedTag

FusedTag.png

Attribute

Attribute.png

Name

Name.png

NCName

NCName.png

AttValue

AttValue.png

JSONString

JSONString.png

Escape

Escape.png

Reference

Reference.png

NamedCharacterReference

NamedCharacterReference.png

Hex

Hex.png

D

D.png

S

S.png

Comment

Comment.png

Char

Char.png