Data types

The XML Schema standard includes a large number of data types (beyond those introduced in the previous chapter, needed for backward compatibility with DTDs). The following table shows all of the simple types, whether or not they are ordered types that have minimum and maximum possible values (leading and trailing '…' indicates no specified limits), and an example of the type in use:

Simple type Ordered type Min and max values Examples
string - -
<note>

this    is    a

    string    </note>
normalizedString - - name="J Smith"
token - - colour="red"
byte Y -128 -127 … -1 0 1 … 126 127 -13 or 99
unsignedByte Y 1 2 … 254 255 age="77"
base64Binary - - GpM7
hexBinary - - <image>FF008B7C22F6</image>
integer Y …. -2 -1 0 1 2 … hourFromUTC="-2"
positiveInteger ...

Get XML Companion, The, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.