數字數據類型用於表示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