How to specify minimal value for fractionDigits restriction in XML Schema?

拟墨画扇 提交于 2019-12-05 04:33:28

You can add a pattern restriction:

<xsd:simpleType name="fractionalSalary">
    <xsd:restriction base="xsd:decimal">
        <xsd:fractionDigits value="2" />
        <xsd:minExclusive value="0" />
        <xsd:pattern value="\d+\.\d{2}" />
    </xsd:restriction>
</xsd:simpleType>

This means that the decimal supplied must match the regex.

At this point, you can probably get rid of the fractionDigits element too, as that constraint is covered by the regex.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!