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

Datatype Libraries

Table of Contents

8.1. W3C XML Schema Type Library
8.1.1. The Datatypes
8.1.2. Facets
8.2. DTD Compatibility Datatypes
8.3. Which Library Should Be Used?
8.3.1. Native Types Versus W3C XML Schema Datatypes
8.3.2. DTD Versus W3C XML Schema Datatypes

In Chapter 7, I presented the basics of the data pattern using the highly restricted, built-in datatype library. The extreme simplicity of the built-in type library—limited to the two datatypes string and token—shouldn't be seen as a limitation of RELAX NG. Instead, it is a fundamental design decision: validating the structure and validating the content of XML documents are different problems that are better solved by different tools working in close cooperation.

The RELAX NG strategy is thus to rely on external pluggable libraries for the validation of the content of the text nodes and attributes. There is no limit to the potential variety of external type libraries that can be implemented and used by a RELAX NG schema. The designers of RELAX NG think that there is probably room for both generic type libraries and application-specific type libraries that meet the needs of a specific domain such as mathematics, physics, or business.

It's also possible to implement type libraries specific to particular programming languages. For example, my Python implementation of RELAX NG supports a native Python type library, which maps the built-in types and allows developers to define restrictions using the Python syntax.

That said, it is expected that most users will choose generic XML type libraries ranging from a library emulating DTD datatypes to the W3C XML Schema datatype library. (The ISO DSDL activity includes work on a datatype library, but it isn't published yet.) In this chapter, I'll introduce the most commonly used and widely supported libraries—the W3C XML Schema and DTD compatibility type libraries.

This text is released under the Free Software Foundation GFDL.