I am looking for a way to have XSD where the value is an integer with range [minInclusive, maxInclusive] values but also allow for the integer to be null. ie. <value></value>.
So far I have been able to get an integer element that is allowed to be a null by having it unioned with a string:
<xs:simpleType name="nullInt" final="">
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
And also an integer with range:
<xs:simpleType name="nullIntRange">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
Where nullIntRange is just a regular integer and the ranges are specified in the element attributes. But is there a way to allow for a null integer with range?
So far I have been able to get an integer element that is allowed to be a null by having it unioned with a string:
<xs:simpleType name="nullInt" final="">
<xs:union memberTypes="xs:integer">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:length value="0"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
And also an integer with range:
<xs:simpleType name="nullIntRange">
<xs:restriction base="xs:integer"/>
</xs:simpleType>
Where nullIntRange is just a regular integer and the ranges are specified in the element attributes. But is there a way to allow for a null integer with range?