XML schema or RELAX NG?
At the recently concluded XML 2001 conference and exposition in Orlando, FL, several interesting phenomena emerged. One of them is the subject of today's tip: the suggestion that an XML application known as RELAX NG (Next Generation) might emerge as a viable alternative to XML Schema.
In previous tips, I've described XML Schema as a native XML alternative to using SGML DTDs to create XML document descriptions using only XML syntax and structure. But numerous schema language experts--including the likes of James Mason, James Clarke, and Rick Jelliffe--are soon to get to work on a basic processing model for schema languages in general that should help make a bit more order out of some of the inconsistencies that are emerging between object-oriented languages like XML Schema, rule-based languages like Schematron, and grammar based languages like RELAX NG. Some of the issues with XML Schema, and emerging preferences for alternative languages appear to hinge on the complexity of XML Schema's syntax and its expressive power. According to Clarke, XML Schema is overly complex yet not expressive enough.
Other criticisms about XML Schema have stemmed from the current specification's failure to map to an underlying mathematical model (which makes parsing XML Schemas and writing programs to process XML Schemas more difficult).
RELAX NG, on the other hand, is a project that emerges from OASIS (the Organization for the Advancement of Structured Information Standards), a notable source of XML advocacy and information. According to Michael Smith's story on the subject at XMLhack, RELAX NG is "designed to be an easy-to-learn and easy-to-implement alternative to the W3C's XML schema language." As such, it's certainly worthy of note that OASIS has just released the following documents about RELAX NG:
- An official committee specification.
- A great tutorial.
- A DTD compatibility document, that defines datatypes and annotations included as features of XML 1.0 DTDs that are not supported directly in RELAX NG. This is certainly more than the developers of the XML Schema documents have done, and creates a useful bridge between the two technologies.
Smith's story is worth reading further because it not only explains key features of RELAX NG that users and document designers are likely to find appealing, but also because it mentions a plethora of tools that support this metadata language. Beyond ease of learning and use, these features may be summed as imposing minimal or no changes on other aspects of XML information or behavior, including an ability to incorporate XML Schema based datatype declarations.
If you're interested in creating XML document definitions using XML syntax and structures, but have found XML Schema a bit difficult to absorb or swallow, check out RELAX NG.
Have questions, comments, or feedback about this or other XML-related topics? Please e-mail me care of email@example.com; I'm always glad to hear from readers.
Ed Tittel is a principal at LANWrights, Inc., a wholly owned subsidiary of LeapIt.com. LANWrights offers training, writing, and consulting services on Internet, networking, and Web topics (including XML and XHTML), plus various IT certifications (Microsoft, Sun/Java, and Prosoft/CIW).