数字数据类型用于表示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