A.2. Classification of XML Schema LanguagesIn the previous section, we saw several classifications for XML schema languages (open or closed, with or without PSVI, etc.). Here, we will follow the classification done by the DSDL (Document Schema Definition Language) ISO project and define a more layered and structured classification. A.2.1. Rule-Based XML Schema LanguagesThe XML schema languages that have the finest granularity for controlling how an instance document may look are the rule-based schema languages such as Schematron. Since any constraint may be expressed as a set of rules of some kind, rule-based schema languages may be considered as lower-level than the other XML schema languages that can be built on top of them. Though I am not aware of any implementation that does so, a W3C XML Schema processor could generate a set of Schematron rules to express its constraints. They can be used alone or to finish any work that cannot be finished with other XML schema languages that do not have their level of granularity. Embedding their rules in the W3C XML Schema seems very promising (as discussed in Chapter 14, "Documenting Schemas"). A.2.2. Grammar-Based XML Schema LanguagesGrammar-based XML Schema languages act at another level and attempt to describe the structure of the instance documents. In a sense, they may be compared to a BNF (Backus-Naur Notation or Form, used to describe the syntax of programming languages) for XML. They describe the possible patterns of XML nodes as BNF describes possible patterns of characters. The most popular grammar-based XML schema languages are DTDs and RELAX NG. Focusing on the structure, those languages do not attach a lot of importance to the notions of datatype and PSVI. Those languages may also be seen as a concise way to define the rules that constrain the structure of a document, and may be used in conjunction with rule-based languages needed to express nonstructural rules. A.2.3. Object-Oriented XML Schema LanguagesIt's clear that W3C XML Schema is something more than just a grammar-based XML schema language. It is also an attempt to describe instance documents in a way that is as close as possible to an object oriented design. One consequence is the importance of type. If elements and attributes are assimilated to objects, the types are the closest thing to object-oriented classes and are crucial to express the similarity between objects. The other object-oriented features of the W3C XML Schema are the derivation and substitution mechanisms defined to match the inheritance between object-oriented classes. And finally, since it is anticipated that object-oriented applications will benefit from this mapping between hierarchical XML and the object-oriented paradigm, the PSVI is key to communication between the schema processor and the applications. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|