Designing Your own XML Schema: Constraining with Restrictions - Restrictions based on lists (or enumerations) in XML Schema (Page 5 of 6 )
Let us consider that we would like to have a department assigned (or specified) to every employee in our XML document. The department sometimes could be misspelled. So we need to provide a “list of values” (or enumeration) which are the only valid values to accept!
You need to observe the following fragment within the above complete schema, which actually does the restriction:
<xs:enumeration value="Production" />
<xs:enumeration value="Sales" />
<xs:enumeration value="Accounting" />
You can include as many enumerations as possible within an XML schema. In the above fragment, I specified only “string” based enumerations. You can also work with “integer,” “date” and other types of enumerations as well.