
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
广告