XSD 数字 数据类型
Decimal 数据类型用于数值。
Decimal 数据类型
Decimal 数据类型用于指定数值。
以下是 Schema 中 decimal 声明的示例
<xs:element name="price" type="xs:decimal"/>
您文档中的一个元素可能如下所示
<price>999.50</price>
或者可能看起来像这样
<price>+999.5450</price>
或者可能看起来像这样
<price>-999.5230</price>
或者可能看起来像这样
<price>0</price>
或者可能看起来像这样
<price>14</price>
Integer 数据类型
Integer 数据类型用于指定没有小数部分的数值。
以下是 Schema 中 integer 声明的示例
<xs:element name="price" type="xs:integer"/>
您文档中的一个元素可能如下所示
<price>999</price>
或者可能看起来像这样
<price>+999</price>
或者可能看起来像这样
<price>-999</price>
或者可能看起来像这样
<price>0</price>
数值数据类型
请注意,以下所有数据类型都派生自 Decimal 数据类型(decimal 本身除外)!
名称 | 描述 |
---|---|
byte | 带符号的 8 位整数 |
decimal | Decimal 值 |
int | 带符号的 32 位整数 |
整数 | 整数值 |
long | 带符号的 64 位整数 |
negativeInteger | 仅包含负值的整数(..,-2,-1) |
nonNegativeInteger | 仅包含非负值的整数(0,1,2,..) |
nonPositiveInteger | 仅包含非正值的整数(..,-2,-1,0) |
positiveInteger | 仅包含正值的整数(1,2,..) |
short | 带符号的 16 位整数 |
unsignedLong | 无符号 64 位整数 |
unsignedInt | 无符号 32 位整数 |
unsignedShort | 无符号 16 位整数 |
unsignedByte | 无符号 8 位整数 |
数字数据类型的限制
可与数字数据类型一起使用的限制
- enumeration(枚举)
- fractionDigits(小数位数)
- maxExclusive(最大值不包含)
- maxInclusive(最大值包含)
- minExclusive(最小值不包含)
- minInclusive(最小值包含)
- pattern
- totalDigits(总位数)
- whiteSpace