Chapter 8. Datatype Libraries

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.98.111