Those who've been knocking around the XML or Web development communities for any length of time have come across
the work of James Clark, if not evidence of the man himself. His is a pretty fascinating story, which you can read more about on his bio page.
For the purposes of our discussion, let's just say he's been around the SGML and XML communities since the early 90s and has contributed a substantial and extremely useful body of work. His highlight reel includes an open source SGML parser he wrote in C, acting as technical lead during the development of the XML 1.0 Recommendations, enhancing SGML to make XML a formal subset of SGML, development of expat, "the world's fastest XML parser," co-authoring the XSL submission, editing the XSLT and XPath Recommendations, and last and most relevant, developing TREX, a schema language for XML that pre-dated (and many believe outclasses) XML Schema.
In fact, TREX plus another alternate XML schema language named RELAX, gave rise to RELAX NG (where NG stands for Next Generation), which is an OASIS development project and is now also enshrined as ISO/IEC standard 19757-2. This probably explains why most of Clark's recent work centers around RELAX NG and includes an open source validator for that markup language (Jing), a tool for converting XML DTDs into RELAX NG (DTDinst), a Java program that translates RELAX NG schemas into other formats (Trang) and a new XML mode for GNU Emacs that performs incremental XML parsing and does RELAX NG validation.
Why bother with RELAX NG when there's XML Schema, a W3C recommendation also available? Three short answers explain why this markup language is worth digging into:
- The language is designed to be simple and easy to learn, which many would observe is not the case for XML Schema.
- The language includes both an XML syntax and a compact non-XML syntax. It also supports XML namespaces and does not change the information set of any XML document it touches.
- It works with XML Schema Datatypes (just as does XML Schema itself) and can draw on the expressive power of that markup language.
All of this goes to explain why RELAX NG is so widely used and why it still enjoys a reputation as an attractive, if not compelling, alternative to XML Schema to this very day. ISO Standard status doesn't hurt much, either, especially in Europe where this kind of official seal of approval often means more than it does in the states.
You can dig deeply into RELAX NG, through many avenues (including the aforementioned bio page for Clark himself), but the following sites offer outstanding entry points:
- RELAX NG home page: though it hasn't been updated since September 2003, you'll still find lots of useful stuff here, including pointers to OASIS and ISO that do include completely current information.
- As is so often the case with XML topics, Robin Cover's CoverPages provide excellent info and pointers to RELAX NG topics as well. Visit the RELAX NG page for more information.
- Various items of interest are available at the ISO Web site, including the ISO/IEC19757-2:2003 home page and their download page for Freely Available Standards (you'll find two hits there related to RELAX NG).
- Eric van der Vlist has also written a good book for O'Reilly Media entitled RELAX NG (July 2003, ISBN: 0596004214) that covers both the XML and compact syntax approaches quite well, and digs into best practices and integration with external type libraries and XML Schema regular expressions. It also provides lots of examples and illustrations that readers will find useful and illuminating.
Those who need to build schemas for XML documents or document collections and who've been frustrated by XML Schema may find RELAX NG preferable. Check it out, and you may come to share this viewpoint.
About the author
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security topics. Among his many XML projects is the 2002 Sybex book XML Schemas, which he co-authored with Chelsea Valentine and Lucinda Dykes (ISBN: 0792140459). E-mail Ed at firstname.lastname@example.org with comments, questions or suggested topics or tools for review.