十進(jìn)制數(shù)據(jù)類型用于數(shù)值。
XSD 數(shù)值數(shù)據(jù)類型(Numeric Data Types)
十進(jìn)制數(shù)據(jù)類型
十進(jìn)制數(shù)據(jù)類型用于規(guī)定一個數(shù)值。
下面是一個關(guān)于某個 scheme 中十進(jìn)制數(shù)聲明的例子。
<xs:element name="prize" type="xs:decimal"/>
文檔中的元素看上去應(yīng)該類似這樣:
<prize>999.50</prize>
或者類似這樣:
<prize>+999.5450</prize>
或者類似這樣:
<prize>-999.5230</prize>
或者類似這樣:
<prize>0</prize>
或者類似這樣:
<prize>14</prize>
注釋:您可規(guī)定的十進(jìn)制數(shù)字的最大位數(shù)是 18 位。
整數(shù)數(shù)據(jù)類型
整數(shù)數(shù)據(jù)類型用于規(guī)定無小數(shù)成分的數(shù)值。
下面是一個關(guān)于某個 scheme 中整數(shù)聲明的例子。
<xs:element name="prize" type="xs:integer"/>
文檔中的元素看上去應(yīng)該類似這樣:
<prize>999</prize>
或者類似這樣:
<prize>+999</prize>
或者類似這樣:
<prize>-999</prize>
或者類似這樣:
<prize>0</prize>
數(shù)值數(shù)據(jù)類型
請注意,下面所有的數(shù)據(jù)類型均源自于十進(jìn)制數(shù)據(jù)類型(除 decimal 本身以外)!
名字 | 秒數(shù) |
---|---|
byte | 有正負(fù)的 8 位整數(shù) |
decimal | 十進(jìn)制數(shù) |
int | 有正負(fù)的 32 位整數(shù) |
integer | 整數(shù)值 |
long | 有正負(fù)的 64 位整數(shù) |
negativeInteger | 僅包含負(fù)值的整數(shù) ( .., -2, -1.) |
nonNegativeInteger | 僅包含非負(fù)值的整數(shù) (0, 1, 2, ..) |
nonPositiveInteger | 僅包含非正值的整數(shù) (.., -2, -1, 0) |
positiveInteger | 僅包含正值的整數(shù) (1, 2, ..) |
short | 有正負(fù)的 16 位整數(shù) |
unsignedLong | 無正負(fù)的 64 位整數(shù) |
unsignedInt | 無正負(fù)的 32 位整數(shù) |
unsignedShort | 無正負(fù)的 16 位整數(shù) |
unsignedByte | 無正負(fù)的 8 位整數(shù) |
對數(shù)值數(shù)據(jù)類型的限定(Restriction)
可與數(shù)值數(shù)據(jù)類型一同使用的限定:
- enumeration
- fractionDigits
- maxExclusive
- maxInclusive
- minExclusive
- minInclusive
- pattern
- totalDigits
- whiteSpace