Skip to main content

The PreTeXt Guide

Section 6.4 Reading RELAX-NG Compact Syntax

The compact syntax might remind you of Java or C++ syntax. We do not provide a tutorial here, but do provide some hints on the various delimiters and special symbols, which may make it fairly easy to see your way through to the meaning. The fundamental object of the schema is a pattern, and named patterns can be reused in order to reuse common patterns and modularize the description. One approach to validation is to remove portions of your source that match required patterns until only optional material remains. Notice that if you were to chase your way through substituting the named patterns with their employment, you would have a single (large) pattern which every possible PreTeXt document would match, and by definition an XML document that does not match is not PreTeXt. (OK, that is a slight exaggeration, see Section 6.2.)
Table 6.4.0.1. RELAX-NG Compact Syntax Summary
element foo { } Define <foo> and children
attribute bar { } Define @bar and values
text Sequence of characters (any length)
mixed { } Mixed-content, characters interleaved in pattern
Exactly one (required)
+ One or more (required)
* Zero or more (optional)
? Zero or one (optional)
, Sequence, in prescribed order
| Choice
& Sequence, any order
( ) Grouping
= Define named pattern
|= Accumulate named pattern as a choice
You have attempted of activities on this page.