Reputation: 2915
I am trying to define a type to use in my XML document where it only accepts for that specific datatype, one of the following values:
Is this possible?
Upvotes: 0
Views: 52
Reputation: 2915
Ok, I just found the answer using the attribute "enumeration". Here is the explanation, and the following code is the example used in it:
<xs:element name="car">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="Audi"/>
<xs:enumeration value="Golf"/>
<xs:enumeration value="BMW"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
Upvotes: 1