Preface

The “X” in XML stands for “Extensible.” XML is so extensible that I can invent new elements and attributes as I write XML documents. There is a natural limit to this extensibility; I need to keep track of the elements and attributes that I’ve created. Then I need to convey to the applications what my document structures will look like. Explaining the new elements and attributes to my application is necessary to help ensure that the application gets information it has a chance of understanding and also to automate some of the most time-consuming (and boring) programming tasks. This is where XML schema languages come into play.

XML schema languages are a nice idea as long as they don’t become so complicated that XML vocabularies built using them are difficult to extend. Unfortunately, that’s what was starting to happen before RELAX NG (REgular LAnguage for XML, New Generation) appeared. W3C XML Schema, the dominant XML schema language, is so complex and incorporates ideas from so many conflicting fields that it is difficult to learn, difficult to extend—yet its expressive power is still too limited to describe all the possibilities offered by XML! Even though we can expect that many applications will use this mammoth language, many people need a lighter-weight and simpler alternative.

RELAX NG provides that alternative. It is an XML schema language that is:

  • Focused on validating the structure of XML documents

  • Lightweight enough to be easy to learn, read, and write

  • Powerful enough to describe virtually any vocabulary that is based on well-formed XML 1.0 and namespaces in XML

RELAX NG is easier, more reliable, and safer to use than W3C XML Schema because of two things: RELAX NG has a sound mathematical grounding and focuses on doing a single thing perfectly well—validating the structure of XML documents.

RELAX NG won’t do fancy tricks or make you coffee, but if you need a schema language that’s easy to use and won’t leave you in a labyrinth of obscure limitations, this is the language you should be using. Furthermore, an excellent open source tool (James Clark’s Trang) can convert your RELAX NG schemas into other languages, including W3C XML Schema, if you still need to work with W3C XML Schema-based systems. You can work sensibly in RELAX NG but still share your schemas with people who use W3C XML 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.