Chapter 18. Compact Syntax Reference
This reference follows the formal description of the compact
syntax described as an EBNF (Extended Backus-Naur Form, a syntax that
doesn’t include annotation syntax) 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
, and literalSegment
),
each alternative is documented separately. The grammar from the
specification has been slightly simplified to suppress definitions
that were used only once; nevertheless, the meaning has been kept
unchanged.
Here is the full EBNF grammar that’s used as the basis for this reference:
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" ...
Get RELAX NG now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.