Full Schema

Now we have all the components needed to convert the full RELAX NG schema from Chapter 3 into its compact syntax form; it’s shown in Example 4-1.

Example 4-1. Compact syntax of full RELAX NG schema
element library {
   element book {
     attribute id { text },
     attribute available { text },
     element isbn { text },
     element title {
       attribute xml:lang { text },
       text
     },
     element author {
       attribute id { text },
       element name { text },
       element born { text }?,
       element died { text }?
     }+,
     element character {
       attribute id { text },
       element name { text },
       element born { text }?,
       element qualification { text }
     }*
   }+
}

In the following chapters, I give both the XML and the compact syntax for each example. You’ll have plenty of opportunities to get familiar with both.

Tip

Don’t get confused by the similarities in name between the simple form of a RELAX NG schema, described in Chapter 15, and the compact syntax. These two notions work at different levels: the simple form is the result of simplifications performed internally by RELAX NG processors on the data model of the schema; the compact syntax is a different way to represent or serialize a full RELAX NG document. The data models that result from the parsing of a full RELAX NG schema are thus the same whether the schema is written using the XML or the compact syntax and are simplified into the same simple schema.

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.