Next / Previous / Contents / TCC Help System / NM Tech homepage

2. A small example

Suppose you wish to define a small XML document type to keep track of hiking trails inside a park.

You want to record the name of the park, and for each trail you want to specify whether it is an easy, medium, or hard climb, and the distance traveled. Here is an example of such a document showing a park with two trails:

<park name="Lincoln Natural Forest">
  <trail distance="3400" climb="medium">Canyon Trail</trail>
  <trail climb="easy" distance="1200">Pickle Madden Trail</trail>
</park>

Here's a small RNC schema for this document type:

element park
{ attribute name { text },
  element trail
  { attribute climb { "easy" | "medium" | "hard" },
    attribute distance { text },
    text
  }*
}

The element pattern specifies the content of an element such as <park>...</park>. The attribute pattern specifies what attributes can occur inside an element. The keyword text matches any text. The “*” suffix specifies that the previous element can occur any number of times, including zero.