XSD - 數值資料型別
數值資料型別用於在 XML 文件中表示數字。
<xs:decimal> 資料型別
<xs:decimal> 資料型別用於表示數值。它支援最多 18 位的十進位制數。
<xs:decimal> 示例
XSD 中的元素宣告 -
<xs:element name = "score" type = "xs:decimal"/>
XML 中的元素用法 -
<score>9.12</score>
<xs:integer> 資料型別
<xs:integer> 資料型別用於表示整數值。
<xs:integer> 示例
XSD 中的元素宣告 -
<xs:element name = "score" type = "xs:integer"/>
XML 中的元素用法 -
<score>9</score>
數值資料型別
以下是常用數值資料型別的列表。
| 序號 | 名稱及描述 |
|---|---|
| 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 位整數 |
限制
以下型別的限制可用於日期資料型別 -
- 列舉
- fractionDigits
- maxExclusive
- maxInclusive
- minExclusive
- minInclusive
- pattern
- totalDigits
- whiteSpace
廣告