开发者

xml maxLength for decimal type

I tried the following to set the maximum length for a decimal:

<simpleType name='xxx'>
    <restriction base='decimal'>
        <maxLength value开发者_运维技巧='7'/>
    </restriction>
</simpleType>

but this is not valid syntax. Can I use maxLength for decimal?


Can i use maxLength for decimal?

A correct answer would require checking the W3C Recommendation, but a check of my quick reference: maxLength only applies to string types.


I think you need to use totalDigits instead:

http://www.ibm.com/developerworks/xml/library/x-xdarch.html


You can use minInclusive and maxInclusive instead.

An example from 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>

There are also minExclusive, maxExclusive and totalDigits restrictions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜