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.


The grammar and start elements

In the Russian doll style, the definition of the root element (in our case the library element) was used as a container for the whole schema. When we define named patterns, we need a container to embed both the named pattern definitions and the definition of the root element of the named patterns. This definition of the root element, as well as definitions of all the patterns that may be used within it, is what RELAX NG calls a grammar. It uses the grammar element. When we use a grammar element, RELAX NG requires that we explicitly declare which will be the root element or elements. This is done using a start element. An incomplete skeleton of the structure of the schema defining a pattern name-element would thus be:

 <grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
   <element name="library">
    .../...
   </element>
  </start>
  <define name="name-element">
   .../...
  </define>
 </grammar>

Or, using the compact syntax:

 grammar {
  name-element = .../...
  start =
   element library {
   .../...
  }
 }

In the compact syntax, the grammar pattern is implicit. You can use it, but it isn't required.


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.