Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null Integer XSD

Status
Not open for further replies.

LW00

Programmer
Sep 28, 2008
4
0
0
HK
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?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top