Simplification

Since its conception, RELAX NG has always tried to balance simplicity of use, simplicity of implementation, and simplicity of its data model. What’s simple to implement is often simple to use, however, there are many features that are very effective for the users but add complexity for the implementers and clutter the data model. This is the case, for instance, for all the features designed to create building blocks (named patterns, includes, and embedded grammars). They are very helpful to users but your use of named patterns or a Russian-doll style has zero impact on the validation itself. This is also the case for shortcuts such as the mixed pattern, which is really just a more concise way of writing an interleave pattern with an embedded text pattern.

The quest for simplicity has had a huge influence on the design of RELAX NG. Here is James Clark on the subject:

Simplicity of specification often goes hand in hand with simplicity of use. But I find that these are often in conflict with simplicity of implementation. An example would be ambiguity restrictions as in W3C XML Schema: these make implementation simpler (well, at least for people who don’t want to learn a new algorithm) but make specification and use more complex. In general, RELAX NG aims for implementation to be practical and safe (i.e., implementations shouldn’t use huge amounts of time/memory for particular schemas/instances), but apart from that favors simplicity of specification/use over simplicity ...

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.