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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSD type allowing integers or empty ("")

Status
Not open for further replies.

Ladmorillo

Programmer
Aug 11, 2005
1
DK
Hi

In my XML i have elements with an attribute named "option" which must contain an integer. But sometimes it is not relevant so the empty value option="" should also be allowed.

Making the attribute itself optional will be confusing for the XML creators.

The type is now:

<xs:simpleType name="option_type">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
<xs:maxInclusive value="7" />
</xs:restriction>
</xs:simpleType>

But how should it be if I want to allow the empty value aswell?

Or is this bad programming, and shold I maybe instead choose to interpret a "0" value as empty?

Anyone?

Ladmorillo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top