RELAX NG by Eric van der Vlist will be published by O'Reilly & Associates (ISBN: 0596004214)

You are welcome to use our annotation system to give your feedback.


Chapter 18:Compact syntax reference guide

This quick reference guide follows the formal description of the compact syntax described as an EBNF grammar. Each definition of the EBNF grammar is documented. When a definition includes a long list of alternatives (as is the case for pattern, nameClass or literalSegment), each alternative is documented separately. The grammar from the specification has been slightly simplified to suppress definitions which were used only once; nevertheless, the meaning has been kept unchanged.

[Note]Note

The EBNF grammar is a summary which does not include annotation syntax.

Here is the full EBNF grammar which was used as a basis for this guide:

topLevel            ::= 
decl* (
pattern|
grammarContent*)
decl                ::= "namespace" 
identifierOrKeyword "=" 
namespaceURILiteral
                        |"default" "namespace" [
identifierOrKeyword] "=" 
namespaceURILiteral
                        |"datatypes" 
identifierOrKeyword "=" 
literal
pattern             ::= "element" 
nameClass "{" 
pattern "}"
                        |"attribute" 
nameClass "{" 
pattern "}"
                        |
pattern ("," 
pattern)+
                        |
pattern ("&" 
pattern)+
                        |
pattern ("|" 
pattern)+
                        |
pattern "?"
                        |
pattern "*"
                        |
pattern "+"
                        |"list" "{" 
pattern "}"
                        |"mixed" "{" 
pattern "}"
                        |
identifier
                        |"parent" 
identifier
                        |"empty"
                        |"text"
                        |[
datatypeName] 
literal
                        |
datatypeName ["{" 
param* "}"] [
exceptPattern]
                        |"notAllowed"
                        |"external" 
literal [
inherit]
                        |"grammar" "{" 
grammarContent* "}"
                        |"(" 
pattern ")"
param               ::= 
identifierOrKeyword "=" 
literal
exceptPattern       ::= "-" 
pattern
grammarContent      ::= 
start
                        |
define
                        |"div" "{" 
grammarContent* "}"
                        |"include" 
literal [
inherit] ["{" 
includeContent* "}"]
includeContent      ::= 
define
                        |
start
                        |"div" "{" 
includeContent* "}"
start               ::= "start" 
assignMethod 
pattern
define              ::= 
identifier 
assignMethod 
pattern
assignMethod        ::= "="
                        |"|="
                        |"&="
nameClass           ::= 
name
                        |
NCName ":*" [
exceptNameClass]
                        |"*" [
exceptNameClass]
                        |
nameClass "|" 
nameClass
                        |"(" 
nameClass ")"
name                ::= 
identifierOrKeyword
                        |
CName
exceptNameClass     ::= "-" 
nameClass
datatypeName        ::= 
CName
                        |"string"
                        |"token"
namespaceURILiteral ::= 
literal
                        |"inherit"
inherit             ::= "inherit" "=" 
identifierOrKeyword
identifierOrKeyword ::= 
identifier
                        |
keyword
identifier          ::= (
NCName - 
keyword)
                        |
quotedIdentifier
quotedIdentifier    ::= "\" 
NCName
CName               ::= 
NCName ":" 
NCName
literal             ::= 
literalSegment ("~" 
literalSegment)+
literalSegment      ::= """ (
Char - (""" 
newline))* """
                        |"'" (
Char - ("'" 
newline))* "'"
                        |""""" (["""] ["""] (
Char - """))* """""
                        |"'''" (["'"] ["'"] (
Char - "'"))* "'''"
keyword             ::= "attribute"
                        |"default"
                        |"datatypes"
                        |"div"
                        |"element"
                        |"empty"
                        |"external"
                        |"grammar"
                        |"include"
                        |"inherit"
                        |"list"
                        |"mixed"
                        |"namespace"
                        |"notAllowed"
                        |"parent"
                        |"start"
                        |"string"
                        |"text"
                        |"token"

Note that EBNF dooesn't capture the restrictions applied after simplification. The simplification process and restrictions are detailed in "Chapter 15: Simplification And Restrictions". The main restrictions are also mentioned for each element in this chapter in the section titled "Restrictions".


You are welcome to use our annotation system to give your feedback.
[Annotations for this page]
All text is copyright Eric van der Vlist, Dyomedea. During development, I give permission for non-commercial copying for educational and review purposes. After publication, all text will be released under the Free Software Foundation GFDL.