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

How to Limit Enum Occurances?

Status
Not open for further replies.

dlamet

Programmer
Apr 10, 2009
7
US
I'm trying to use a list of enums, but limit the values to only one occurrence of each value. Let's say I have a enum that represents books in a library.

<xsd:simpleType name="BOOK_TYPE">
<xsd:annotation>
<xsd:documentation>Book Type</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="1">
<xsd:annotation>
<xsd:documentation>Dr. Seuss</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="2">
<xsd:annotation>
<xsd:documentation>Peter Rabbit</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
<xsd:enumeration value="3">
<xsd:annotation>
<xsd:documentation>Cinderella</xsd:documentation>
</xsd:annotation>
</xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>

Assume there's only one copy of each book. I have a child that come and takes some books. A list represents his/her bag of books.

<xs:simpleType name='bag'>
<xs:list itemType='BOOK_TYPE'/>
</xs:simpleType>

This will allow a list of books, but each book may only be in his bag once. How do I constrain that?

Thanks, Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top