xsd自定义十进制类型定义,不是零

xsd自定义十进制类型定义,不是零,xsd,decimal,restriction,Xsd,Decimal,Restriction,我想定义一个XSD类型,它是一个十进制数(正数或负数),但不能是零。我怎么做 这是定义的主体: <simpleType name="grossValueType"> <restriction base="decimal"> <!-- What put here? --> </restriction> </simpleType> 定义两种类型,负CIMALS和正CIMALS,然后将它们合并在一起以获得您想要的: <xs:simpl

我想定义一个XSD类型,它是一个十进制数(正数或负数),但不能是零。我怎么做

这是定义的主体:

<simpleType name="grossValueType">
<restriction base="decimal">
<!-- What put here? -->
</restriction>
</simpleType>

定义两种类型,负CIMALS和正CIMALS,然后将它们合并在一起以获得您想要的:

<xs:simpleType name="negativeDecimals">
    <xs:restriction base="xs:decimal">
        <xs:maxExclusive value="0"/>
    </xs:restriction>
</xs:simpleType>

<xs:simpleType name="positiveDecimals">
    <xs:restriction base="xs:decimal">
        <xs:minExclusive value="0"/>
    </xs:restriction>
</xs:simpleType>

<xs:element name="measure">
    <xs:simpleType>
            <xs:union memberTypes="negativeDecimals positiveDecimals"/>
    </xs:simpleType>
</xs:element>

因为两个基类型都不能接受0,所以该值将是非法的;所有其他十进制值都是合法的