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"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 doesn’t capture the restrictions applied after simplification. The simplification process and restrictions are described in detail in Chapter 15. The main restrictions are also mentioned for each element in the “Restrictions” section.
3.21.105.193