XML technologies / XML Schema / Creating simple data types
(Excerpt from “XML Schema” by Eric van der Vlist)
So far we used only predefined types. This section creates simple types using derivation mechanisms and restriction facets.
W3C XML Schema defines three independent, complementary mechanisms for tailoring types from existing ones. New types built on predefined or user-defined types are called derivations.
The three derivation methods are restriction, adding constraints without changing semantics; list, creating lists of values with list semantics; and union, accepting values from several types and losing most semantics.
Like xs:complexType definitions, seen in Russian-doll design, xs:simpleType definitions may be named or anonymous. Yet simple and complex types differ greatly: simple types restrict element or attribute values, hence document content, while complex types define content models, hence markup. Their derivation methods differ even though W3C XML Schema uses the same element name (xs:restriction) for both, a recurring source of confusion.
These mechanisms are flexible and powerful. But the many primitive types needed by W3C XML Schema show they cannot create new primitives. They operate only on the value space or lexical space without changing their relationship or creating new spaces. The working group for W3C XML Schema discussed an abstract type system allowing different lexical representations, but reached no agreement. The clearest consequence is that, despite objections from the W3C I18N Working Group responsible for internationalization, W3C XML Schema does not permit localized decimal or date types.
Copyright © 2003 O'Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “XML Schema” is subject to the same conditions as the bound edition. The work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstraße 81, 50670 Köln, kommentar(at)oreilly.de
back to top