Latest web development tutorials

XML Schema numeric data types


Decimal data type

Decimal data type is used to specify a value.

Here is an example of a scheme in decimal declared.

<xs:element name="prize" type="xs:decimal"/>

Elements in the document should look like this:

<prize>999.50</prize>

Or like this:

<prize>+999.5450</prize>

Or like this:

<prize>-999.5230</prize>

Or like this:

<prize>0</prize>

Or like this:

<prize>14</prize>

Note: You may specify the maximum number of decimal digits is 18.


Integer data type

No integer data type is used to specify the value of the fractional component.

Here is an example of a scheme integer declaration.

<xs:element name="prize" type="xs:integer"/>

Elements in the document should look like this:

<prize>999</prize>

Or like this:

<prize>+999</prize>

Or like this:

<prize>-999</prize>

Or like this:

<prize>0</prize>


Numeric data types

Please note that all of the following data types are derived from the decimal data type (except for decimal itself)!

first name Seconds
byte There are eight positive and negative integers
decimal Decimal
int There are positive and negative 32-bit integer
integer Integer value
long There are positive and negative 64-bit integer
negativeInteger Containing only negative integer (.., -2, -1.)
nonNegativeInteger Containing only non-negative integer (0, 1, 2, ..)
nonPositiveInteger Containing only non-positive integer (.., -2, -1, 0)
positiveInteger Contains only positive integer (1, 2, ..)
short There are positive and negative 16-bit integer
unsignedLong Unsigned 64-bit integer
unsignedInt 32-bit unsigned integer
unsignedShort Unsigned 16-bit integer
unsignedByte 8-bit unsigned integer


For numeric data types defined (Restriction)

Can be used in conjunction with the numeric data type is defined:

  • enumeration
  • fractionDigits
  • maxExclusive
  • maxInclusive
  • minExclusive
  • minInclusive
  • pattern
  • totalDigits
  • whiteSpace