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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access