浏览 5
十进制数据类型用于数值.
十进制数据类型
十进制数据类型用于指定数值。
以下是架构中十进制声明的实例:
<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>
整数数据类型
整数数据类型用于指定不带小数部分的数值。
以下是架构中整数声明的实例:
<xs:element name="price" type="xs:integer"/>
文档中的元素可能如下所示:
<price>999</price>
或者看起来像这样:
<price>+999</price>
或者看起来像这样:
<price>-999</price>
或者看起来像这样:
<price>0</price>
数值数据类型
请注意,下面的所有数据类型都派生自Decimal数据类型(decimal本身除外)!
| 名称 | 描述 |
|---|---|
| byte | 一个有符号的 8 位整数 |
| decimal | 十进制值 |
| int | 带符号的 32 位整数 |
| integer | 整数值 |
| 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