by Eric van der Vlist is published by O'Reilly & Associates (ISBN: 0596004214)


Problems That Never Arise

Some restrictions that add a lot of complexity in other schema languages aren't issues for RELAX NG. You've seen at least two places in this chapter in which restrictions are avoided. The first case appears as the ability to define attributes wherever you want in your patterns. This reduction in rules doesn't make a big difference when you define the content model of elements as straightforward as those in our first schema, but it makes a huge difference when you start to combine patterns as we've done with our bizarre model. Without this removal of restrictions, it would have been impossible to define one attribute in the pattern book-extended and a second one in the pattern book-basic.

The other nonrestriction is that RELAX NG pays no attention to the pattern used to match a node of the instance document when there are several possibilities. Again, in our bizarre pattern, if you have a document with a book having only one author, there is no way to tell if this author matches the optional author element of the pattern book-start or the zero or more author elements of the pattern book-author. This is considered an ambiguity that's intolerable to other schema languages. In this case, RELAX NG holds that even though there is an ambiguity, because there is at least one interpretation of the schema for which the document is valid, the document should be considered valid. You'll learn more about these ambiguities and their consequences in Chapter 16.


This text is released under the Free Software Foundation GFDL.