XML最大長度我嘗試以下來設置最大長度爲一個十進制:十進制類型
<simpleType name='xxx'>
<restriction base='decimal'>
<maxLength value='7'/>
</restriction>
</simpleType>
但這不是有效的語法。我可以使用maxLength作爲小數嗎?
XML最大長度我嘗試以下來設置最大長度爲一個十進制:十進制類型
<simpleType name='xxx'>
<restriction base='decimal'>
<maxLength value='7'/>
</restriction>
</simpleType>
但這不是有效的語法。我可以使用maxLength作爲小數嗎?
您可以改爲使用minInclusive
和maxInclusive
。
一個例子從W3Schools:
<xs:element name="age">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0"/>
<xs:maxInclusive value="120"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
還有minExclusive
,maxExclusive
和totalDigits
限制。
我可以使用maxLength作爲小數嗎?
正確答案需要檢查W3C推薦標準,但我的快速參考:maxLength
的檢查僅適用於字符串類型。
THX快速幫助 – senzacionale 2011-05-31 08:04:03
minExclusive和maxExclusive是值的限制。對於小數字段,可以使用totalDigits。 – Sam 2017-03-17 05:51:09