O'Reilly logo

Beginning XML, 4th Edition by Andrew Watt, David Hunter, Linda McKinnon, Joe Fawcett, Eric van der Vlist, Jon Duckett, Danny Ayers, Jeff Rafter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. RELAX NG

RELAX NG is a very powerful, yet easy to understand schema technology that can be used to validate XML instance documents. Like W3C XML Schemas, covered in the previous chapter, RELAX NG is grammar-based. It is possible for many XML instance documents to be valid according to a single RELAX NG schema document. Alternatively, it is possible for a single XML instance document to be valid with respect to multiple RELAX NG schema documents.

Here are some of the key features of RELAX NG:

  • It's simple and easy to learn.

  • It uses pattern-based grammar with a strong mathematical foundation.

  • It has two different syntaxes: XML syntax and compact syntax.

  • It supports XML Schema datatypes.

  • It supports user-defined datatypes.

  • It supports XML namespaces.

  • It's highly composable.

  • Elements and attributes are treated the same.

RELAX NG is a normalized grammar based on James Clark's Tree Regular Expression for XML (TREX), and Makoto Murata's Regular Language description for XML (RELAX). Because RELAX NG was created after DTDs and XML Schemas, the authors were able to address many of the problems in the earlier schema languages. They were able to remove the complexity associated with W3C XML Schemas while embracing some of its features. Additionally, the authors based RELAX NG on strong mathematical models. Having such models simplifies validator development and enables schema authors to make mathematical assertions about their schemas. XML Schema is the most widely supported validation technology, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required