Stylus Studio XML Editor

Table of contents

Appendices

2.3 Lexical space

Lexical space

In addition to its value space, each datatype also has a lexical space.

A lexical space is the set of valid literals for a datatype.

For example, "100" and "1.0E2" are two different literals from the lexical space of [float] which both denote the same value. The type system defined in this specification provides a mechanism for schema designers to control the set of values and the corresponding set of acceptable literals of those values for a datatype.

NOTE: 

The literals in the lexical spaces defined in this specification have the following characteristics:

Interoperability:

The number of literals for each value has been kept small; for many datatypes there is a one-to-one mapping between literals and values. This makes it easy to exchange the values between different systems. In many cases, conversion from locale-dependent representations will be required on both the originator and the recipient side, both for computer processing and for interaction with humans.

Basic readability:

Textual, rather than binary, literals are used. This makes hand editing, debugging, and similar activities possible.

Ease of parsing and serializing:

Where possible, literals correspond to those found in common programming languages and libraries.

Canonical Lexical Representation[top]

Canonical Lexical Representation

While the datatypes defined in this specification have, for the most part, a single lexical representation i.e. each value in the datatype's value space is denoted by a single literal in its lexical space, this is not always the case. The example in the previous section showed two literals for the datatype [float] which denote the same value. Similarly, there may be several literals for one of the date or time datatypes that denote the same value using different timezone indicators.

A canonical lexical representation is a set of literals from among the valid set of literals for a datatype such that there is a one-to-one mapping between literals in the canonical lexical representation and values in the value space.