XSD numeric
Data Types
Decimal Data Type
The decimal data type is used to specify a numeric value.
Below is an example of a decimal number declaration in a schema.
The elements in the document should look like this:
Or like this:
Or like this:
Or like this:
Or like this:
Note: The maximum number of digits you can specify for a decimal number is 18.
Integer Data Type
The integer data type is used to specify a numeric value without a fractional component.
Below is an example of an integer declaration in a schema.
The elements in the document should look like this:
Or like this:
Or like this:
Or like this:
Numeric Data Types
Please note that all the following data types are derived from the decimal data type (except for decimal itself)!
Name | Description |
---|---|
byte | Signed 8-bit integer |
decimal | Decimal number |
int | Signed 32-bit integer |
integer | Integer value |
long | Signed 64-bit integer |
negativeInteger | Integer containing only negative values (.., -2, -1) |
nonNegativeInteger | Integer containing only non-negative values (0, 1, 2, ..) |
nonPositiveInteger | Integer containing only non-positive values (.., -2, -1, 0) |
positiveInteger | Integer containing only positive values (1, 2, ..) |
short | Signed 16-bit integer |
unsignedLong | Unsigned 64-bit integer |
unsignedInt | Unsigned 32-bit integer |
unsignedShort | Unsigned 16-bit integer |
unsignedByte | Unsigned 8-bit integer |
Restrictions on Numeric Data Types
Restrictions that can be used with numeric data types:
- enumeration
- fractionDigits
- maxExclusive
- maxInclusive
- minExclusive
- minInclusive
- pattern
- totalDigits
- whiteSpace