top
Loading...
XML Schema 數值數據類型

XSD 數值數據類型



十進製數據類型

十進製數據類型用於規定一個數值。

下面是一個關於某個 scheme 中十進製數聲明的例子。

<xs:element name="prize" type="xs:decimal"/>

文檔中的元素看上去應該類似這樣:

<prize>999.50</prize>

或者類似這樣:

<prize>+999.5450</prize>

或者類似這樣:

<prize>-999.5230</prize>

或者類似這樣:

<prize>0</prize>

或者類似這樣:

<prize>14</prize>

注意: 您可規定的十進製數字的最大位數是 18 位。


整數數據類型

整數數據類型用於規定無小數成分的數值。

下面是一個關於某個 scheme 中整數聲明的例子。

<xs:element name="prize" type="xs:integer"/>

文檔中的元素看上去應該類似這樣:

<prize>999</prize>

或者類似這樣:

<prize>+999</prize>

或者類似這樣:

<prize>-999</prize>

或者類似這樣:

<prize>0</prize>


數值數據類型

請注意,下面所有的數據類型均源自於十進製數據類型(除 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 位整數


對數值數據類型的限定(Restriction)

可與數值數據類型一同使用的限定:

  • enumeration
  • fractionDigits
  • maxExclusive
  • maxInclusive
  • minExclusive
  • minInclusive
  • pattern
  • totalDigits
  • whiteSpace
北斗有巢氏 有巢氏北斗