1. Introduction

This document specifies guidelines for using the datatypes defined by [W3C XML Schema Datatypes] as a datatype library for [RELAX NG]. The URI

http://www.w3.org/2001/XMLSchema-datatypes

should be used to identify the datatype library. The library identified by this URI contains all the builtin datatypes of [W3C XML Schema Datatypes], both primitive and derived.

2. Parameters

Any facet can be specified as a parameter with the following exceptions

whiteSpace (the builtin derived datatype that specifies the desired value for the whiteSpace facet should be used instead)

enumeration (the value element should be used instead)

If the pattern parameter is specified more than once for a single data element, then a string matches the data element only if it matches all of the patterns. It is an error to specify a parameter other than pattern more than once for a single data element.

The value of any parameter other than pattern should be normalized by applying the normalizeWhiteSpace function defined in [RELAX NG].

3. NOTATION datatype

The relationship between the NOTATION datatype of [W3C XML Schema Datatypes] and the NOTATION datatype of [XML 1.0] is different from the relationship between the ENTITY datatype of [W3C XML Schema Datatypes] and the ENTITY datatype of [XML 1.0]. Whereas values of the ENTITY datatype of [W3C XML Schema Datatypes] refer to entities declared in the DTD of document being validated, values of the NOTATION datatype of [W3C XML Schema Datatypes] refer to notations declared in the XML Schema. This makes it problematic to use the NOTATION datatype outside the context of XML Schema Part 1. However, since [W3C XML Schema Datatypes] does not allow a schema to use the NOTATION datatype directly, but requires that a value be specified for the enumeration facet, and since the values of the NOTATION datatype are QNames, the NOTATION datatype is, considering just validation, effectively equivalent to the QName datatype. It is therefore recommended that RELAX NG validators implement the same validation semantics for the NOTATION datatype as for the QName datatype.

4. ID, IDREF and IDREFS datatypes

The semantics defined by [W3C XML Schema Datatypes] for the ID, IDREF and IDREFS datatypes are purely lexical and do not include the cross-reference semantics of the corresponding [XML 1.0] datatypes. The cross-reference semantics of these datatypes in XML Schema comes from XML Schema Part 1. Furthermore, the [XML 1.0] cross-reference semantics of these datatypes do not fit into the RELAX NG model of what a datatype is. Therefore, RELAX NG validation will only validate the lexical aspects of these datatypes as defined in [W3C XML Schema Datatypes].

However, [DTD Compatibility] defines the concept of an ID-type, which is an additional semantic for datatypes that allows datatypes to have [XML 1.0] cross-reference semantics. An implementation of [DTD Compatibility] that supports these guidelines should associate the ID, IDREF and IDREFS datatypes of [W3C XML Schema Datatypes] with the ID-types ID, IDREF, and IDREFS respectively.

References

Tim Bray, Jean Paoli, and C. M. Sperberg-McQueen, Eve Maler, editors. Extensible Markup Language (XML) 1.0 Second Edition. W3C (World Wide Web Consortium), 2000.

James Clark, Makoto MURATA, editors. RELAX NG Specification. OASIS, 2001.

James Clark, Makoto MURATA, editors. RELAX NG DTD Compatibility. OASIS, 2001.

Paul V. Biron, Ashok Malhotra, editors. XML Schema Part 2: Datatypes. W3C (World Wide Web Consortium), 2001.