XML Schema XSD TotalDigits与MaxInclusive

我使用以下定义运行 XML Schema:
<xs:simpleType name="ClassRankType">
    <xs:restriction base="xs:integer">
        <xs:totalDigits value="4"/>
        <xs:minInclusive value="1"/>
        <xs:maxInclusive value="9999"/>
    </xs:restriction>
</xs:simpleType>

但是,在我看来,totalDigits是多余的.我对XML Schema有些新意,并希望确保我没有错过任何东西.

totalDigits与maxInclusive的实际行为是什么?

totalDigits总是可以用minInclusive和MaxInclusive的组合来表示吗?

totalDigits如何影响负数?

can totalDigits always be represented with a combination of minInclusive and MaxInclusive?

在这种情况下,是的.当您处理整数时,该值必须是整数,因此您在minInclusive和maxInclusive之间有一组有限的值.如果您有十进制值,则totalDigits会告诉您该值可能有多少个数字.

How does totalDigits affect negative numbers?

它是数字中允许的总位数,不受小数点,减号等的影响.从auxy.com开始:

The number specified by the value attribute of the <xsd:totalDigits> facet will restrict the total number of digits that are allowed in the number,on both sides of the decimal point.

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念