XML

Sintaxes completas representadas por Diagrama Sintático - Diagrama de Sintaxe (ver convenções) ou BNF (ver convenções).
Diagrama Sintático - Diagrama de Sintaxe | Diagrama Sintático - Diagrama de Sintaxe e BNF | BNF
xml : prolog element Comment
prolog : XMLDDecl? Comment (doctypedecl Comment)?
element : EmptyElementTag | stag content etag
Comment : '<!--' ('-'? Char_)* '-->'
XMLDecl : <'?'xml VersionInfo EncodingDecl? SDDecl? '?'>
doctypedecl : <'!'DOCTYPE Name ExternalID? ('[' intSubset ']')? >
EmptyElementTag : '<' Name Attribute* '/>'
stag : '<' Name Attribute* '>'
content : CharData? ((element | Reference | CDSect | Comment) CharData?)*
VersionInfo : 'version''='("'" VersionNum "'" | '"' VersionNum '"')
EncodingDecl : 'encoding''='('"' EncName '"' | "'" EncName "'" )
SDDecl : 'standalone''='(("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
ExternalID : 'SYSTEM' SystemLiteral | 'PUBLIC' PubidLiteral SystemLiteral
intSubset : (markupdecl | DeclSep)*
Attribute : Name '=' AttValue
Reference : EntityRef | CharRef
markupdecl : elementdecl | AttlistDecl | EntityDecl | NotationDecl | Comment
DeclSep : PEReference | ['WFC: PE Between Declarations']
EntityRef : '&' Name ';'
elementdecl : '<!ELEMENT' Name contentspec '>'
AttlistDecl : '<!ATTLIST' Name AttDef* '>'
EntityDecl : GEDecl | PEDecl
NotationDecl : '<!NOTATION' Name (ExternalID | 'PUBLIC' PubidLiteral) '>'
PEReference : '%' Name ';'
contentspec : 'EMPTY' | 'ANY' | Mixed | children
AttDef : Name AttType DefaultDecl
GEDecl : '<!ENTITY' Name EntityDef '>'
PEDecl : '<!ENTITY' '%' Name PEDef '>'
Mixed : '(' '#PCDATA' Name* ')*' | '(' '#PCDATA' ')'
children : (choice | seq) ('?' | '*' | '+')?
AttType : 'CDATA' | 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' | 'NOTATION' '(' Name* ')' | '(' Nmtoken* ')'
DefaultDecl : '#REQUIRED' | '#IMPLIED' | ('#FIXED'? AttValue)
EntityDef : EntityValue | ExternalID ('NDATA' Name)?
PEDef : EntityValue | ExternalID
choice : '(' cp+ ')'
seq : '(' cp ( ',' cp )* ')'
EntityValue : '"' ([^%&"] | PEReference | Reference)* '"'
cp : (Name | choice | seq) ('?' | '*' | '+')?
extSubset : TextDecl? extSubsetDecl
TextDecl : '<?xml' VersionInfo? EncodingDecl '?>'
extSubsetDecl : ( markupdecl | conditionalSect | DeclSep)*
conditionalSect : '<![' 'INCLUDE' '[' extSubsetDecl ']]>' | '<![' 'IGNORE' '[' ignoreSectContents* ']]>'
ignoreSectContents : Ignore ('<![' ignoreSectContents ']]>' Ignore)*
Ignore : Char* '-' (Char* ('<![' | ']]>') Char*)
extParsedEnt : TextDecl? content
symbol : expression
CharRef : '&#' ['0-9']+ ';' | '' ['0-9a-fA-F']+ ';'
VersionNum : '1.' ['0-9']+
EncName : ['A-Za-z'] (['A-Za-z0-9._'] | '-')*