XML technologies / XML Schema / Using predefined simple data types / Lexical and value spaces
(Excerpt from “XML Schema” by Eric van der Vlist)
W3C XML Schema separates data read from instance documents, the lexical space, from values interpreted according to their data type, the value space.
Before defining these spaces, examine the processing model and transformations a written XML value undergoes before validation. Element and attribute contents pass through these steps:
Serialization space
The byte sequence actually stored in a document, as an attribute value or text node, belongs to a first space we can call serialization space.
Parsed space
XML 1.0 says serialization space has no direct meaning for applications. XML-compliant parsers transform values first: characters are converted to Unicode, line endings normalized for text nodes and attributes, and whitespace normalized for attributes only. Applications, including schema processors, receive this result, belonging to parsed space.
Lexical space
Before validation, W3C XML Schema applies a second round of whitespace processing to the value received from the XML parser. Depending on the type, it may ignore, normalize or collapse whitespace. The result belongs to the lexical space defined in the W3C XML Schema recommendation.
Figure: W3C XML Schema type hierarchy
Value space
W3C XML Schema treats a lexical-space item as representation of an abstract value whose meaning or semantics is defined by its type: text, a number, date or qualified name. All abstract values together define value space.
Every type has its own lexical and value spaces and mapping rules. In many data types, one value has several lexical representations. For example, <xs:float> value “3.1416” can also be “03.1416”, “3.14160” or “.31416E1”. This matters because equality tests and sorting operate in value space. “3.1416” and “03.1416” are equal for type xs:float but different for type xs:string. Likewise, some types have total ordering, allowing any pair to be compared; others have no ordering, and the rest have partial ordering, not always allowing comparison.
Future APIs may pass these values to applications, but presently transformations between parsed, lexical and value spaces serve only validation and do not affect values returned by a validating parser.
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