The previous two chapters looked at two of the more commonly used formats for defining XML vocabularies. This chapter continues this survey of schema languages by looking at RELAX NG. This is a relatively new XML schema definition language from the Organization for the Advancement of Structured Information Standards (OASIS). OASIS is a standards body — similar to the W3C — that was originally created as an improved version of DTDs, and can leverage some of the functionality of XML Schema. To further these goals, RELAX NG was designed to provide a highly readable format that could be used to define complex vocabularies.
This chapter will look at the two forms of the RELAX NG specification: the standard form and the compact form. It will show the way you use these two forms to define XML vocabularies, and compare it with DTDs and XML Schemas. Along the way, you will see how RELAX NG integrates with XML tools and programming languages for validating XML documents and creating objects that map to RELAX NG schemas.
At first glance, there seems to be little need for yet another schema language. DTDs have been around since SGML, so most people are aware of them, and most applications can work with them. XML Schema is also commonly available, integrated with many XML tools, and ratified by the W3C. Still, there are great reasons why you should consider using RELAX NG.
The primary reason to use RELAX NG is simplicity. Anyone who has read the W3C ...