XSD – Numeric Data Types

  • Post author:
  • Post category:XSD
  • Post comments:0 Comments

Numeric data types are used to represent numbers in XML documents.

<xs:decimal> data type

The <xs:decimal> data type is used to represent numeric values. It supports decimal numbers up to 18 digits.

<xs:decimal> Example

Element declaration in XSD −

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

Element usage in XML −

<score>9.12</score>

<xs:integer> data type

The <xs:integer> data type is used to represent integer values.

<xs:integer> Example

Element declaration in XSD −

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

Element usage in XML −

<score>9</score>

Numeric Data Types

Following is the list of commonly used numeric data types.

S.No.Name & Description
1.byteA signed 8 bit integer
2.decimalA decimal value
3.intA signed 32 bit integer
4.integerAn integer value
5.longA signed 64 bit integer
6.negativeIntegerAn integer having only negative values (..,-2,-1)
7.nonNegativeIntegerAn integer having only non-negative values (0,1,2,..)
8.nonPositiveIntegerAn integer having only non-positive values (..,-2,-1,0)
9.positiveIntegerAn integer having only positive values (1,2,..)
10.shortA signed 16 bit integer
11.unsignedLongAn unsigned 64 bit integer
12.unsignedIntAn unsigned 32 bit integer
13.unsignedShortAn unsigned 16 bit integer
14.unsignedByteAn unsigned 8 bit integer

Restrictions

Following types of restrictions can be used with Date data types −

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

Leave a Reply