XSD Definition for Enumerated Value

You can define an enumeration within the context of a simpleType.

 <xs:simpleType name="color" final="restriction" >
    <xs:restriction base="xs:string">
        <xs:enumeration value="green" />
        <xs:enumeration value="red" />
        <xs:enumeration value="blue" />
    </xs:restriction>
</xs:simpleType>
<xs:element name="SomeElement">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="Color" type="color" />
        </xs:sequence>
    </xs:complexType>
</xs:element>

Leave a Comment

tech