XSD數位資料型別


數位資料型別用於表示XML文件中的數位。

1. <xs:decimal>資料型別

<xs:decimal>資料型別用於表示數值。 它支援最多18位元的十進位制數。

<xs:decimal>範例

XSD中的元素宣告 -

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

XML中的元素用法 -

<score>99.92</score>

2. <xs:integer>資料型別

<xs:integer>資料型別用於表示整數值。

<xs:integer>範例

XSD中的元素宣告 -

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

XML中的元素用法 -

<score>999</score>

3. 數位資料型別

以下是常用數位資料型別的列表。

序號 型別 描述
1 byte 帶符號的8位整數
2 decimal 十進位制值
3 int 帶符號的32位整數
4 integer 整數值
5 long 帶符號的64位整數
6 negativeInteger 負值的整數 (如:-2,-1)
7 nonNegativeInteger 非負值的整數(如:0,1,2)
8 nonPositiveInteger 僅具有非正值的整數(如:-2,-1,0)
9 positiveInteger 正值的整數(如:1,2)
10 short 帶符號的16位整數
11 unsignedLong 無符號64位整數
12 unsignedInt 無符號32位整數
13 unsignedShort 無符號16位整數
14 unsignedByte 無符號8位整數

4. 限制

以下型別的限制可以與日期資料型別一起使用 -

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