Data types
The following table describes all the datatypes allowed in XML data structure specifications.
Data type |
Typical XML representation |
Lexical pattern |
Comments |
---|---|---|---|
.* |
The following constraints can be expressed: minimum length, maximum length, pattern, choice of valid values |
||
-1, 0, 126789675, +100000 |
[-+]?[0-9]+ |
The following constraints can be expressed: minimum value, maximum value. Values must be between 2147483647 and -2147483648 inclusive. |
|
-1.23, 12678967.543233, +100000.00, 210 |
[-+]?[0-9]+(\.[0-9]+)? |
The following constraints can be expressed: minimum value, maximum value. Values must have at most 28 digits, with. |
|
1, 0, true, false |
1|0|true|false |
||
.* |
This is similar to string, but allowed values must be part of a documented "code table". The actual signification of the code table constraint is application-dependent |
||
To indicate 1:20 pm on May the 31st, 1999 in Brussels which is 2 hours ahead of UTC, one would write: 1999-05-31T13:20:00+02:00 |
[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}(:[0-9]{2}(:[0-9]{2})?)?([+-][0-9]{2}(:[0-9]{2})?)? |
Represents a time instant. If the time zone offset is not indicated, UTC is assumed. See also the example below for daylight saving time handling. |
|
13:20:00+02:00 |
[0-9]{2}(:[0-9]{2}(:[0-9]{2}?)?([+-][0-9]{2}(:[0-9]{2})?)? |
Represents a time instant in the day. If the time zone offset is not indicated, UTC is assumed. See also the example below for daylight saving time handling. |
|
To indicate May the 31st, 1999, one would write: 1999-05-31 |
[0-9]{4}-[0-9]{2}-[0-9]{2} |
Represents a calendar date. |
|
Encoded binary data (the default encoding is base64) |
Used to transfer data that is not unicode text. |
The daylight saving times (25th hour) issue is solved by the use of UTC time or by indicating the time-zone delta.
Example: summer time to winter time in Belgium in 2000.
ISO |
Local time |
UTC |
---|---|---|
2000-10-29 00:00+02 |
0h |
2000-10-28 22:00 |
2000-10-29 01:00+02 |
1h |
2000-10-28 23:00 |
2000-10-29 02:00+02 |
2h |
2000-10-29 00:00 |
2000-10-29 02:00+01 |
at 3h it is 2h |
2000-10-29 01:00 |
2000-10-29 03:00+01 |
3h |
2000-10-29 02:00 |
Example: winter time to summer time in Belgium in 2000.
ISO |
Local time |
UTC |
---|---|---|
2000-03-26 00:00+01 |
0h |
2000-03-25 23:00 |
2000-03-26 01:00+01 |
1h |
2000-03-26 00:00 |
2000-03-26 03:00+02 |
at 2h it is 3h |
2000-03-26 01:00 |
2000-03-26 04:00+02 |
4h |
2000-03-26 02:00 |