我想的允許在元件的數字位數限制爲6:XSD架構:如何指定值中的位數?
<AccountNumber>123456</AccountNumber>
<AccountNumber>999999</AccountNumber>
<AccountNumber>000000</AccountNumber>
字段格式規格是6位,零填充,數字。
i read that i might want to use的totalDigits
限制,依據:
totalDigits
指定允許數字的確切人數。必須大於零
所以我有簡單類型:
<xs:simpleType name="AccountNumber">
<xs:restriction base="xs:int">
<xs:totalDigits value="6"/>
</xs:restriction>
</xs:simpleType>
雖然它捕獲無效號碼,如:
<AccountNumber>1234567</AccountNumber>
<AccountNumber>0000000</AccountNumber>
<AccountNumber></AccountNumber>
不趕無效數字:
<AccountNumber>12345</AccountNumber>
<AccountNumber></AccountNumber>
<AccountNumber>00123</AccountNumber>
<AccountNumber>00012</AccountNumber>
<AccountNumber>00001</AccountNumber>
<AccountNumber>00000</AccountNumber>
<AccountNumber>0000</AccountNumber>
<AccountNumber>000</AccountNumber>
<AccountNumber>00</AccountNumber>
<AccountNumber>0</AccountNumber>
什麼是建議限制指定數字的確切位數是多少?
,*「你可以使用一種模式與'XS:int'那麼怎麼樣。」 * – 2010-11-19 19:49:20
@Ian:是的,我也有點驚訝。我學到了一些答案。總是樂於提供幫助。 – 2010-11-19 20:19:27