by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)
grammar — Grammar pattern
"grammar" "{" grammarContent* "}" |
(pattern), attribute, datatypeName param exceptPattern, element, list, mixed, pattern&pattern, pattern*, pattern+, pattern,pattern, pattern?, pattern|pattern
The grammar pattern encapsulates the definitions of start and named patterns.
The most common use of grammar is to validate XML documents. In this case, the start pattern specifies which elements can be used as the document root element. The grammar pattern may also be used to write modular schemas. Here, the start pattern specifies which nodes must be matched by the grammar at the location in which it appears in the schema.
In every case, the named patterns defined in a grammar are considered to be local to this grammar. Note that the top-level grammar is implicit for the compact syntax.
grammar { author-element= element author { attribute id {text}, name-element, born-element, died-element? } book-element = element book { attribute id {text}, attribute available {text}, isbn-element, title-element, author-element *, character-element* } born-element = element born {text} character-element = element character { attribute id {text}, name-element, born-element, qualification-element } died-element = element died {text} isbn-element = element isbn {text} name-element = element name {text} qualification-element = element qualification {text} title-element = element title {attribute xml:lang {text}, text} start = element library { book-element + } } author-element = grammar { start = element author { attribute id { text }, name-element, born-element, died-element? } name-element = element name { text } born-element = element born { text } died-element = element died { text } } |
This text is released under the Free Software Foundation GFDL.