1

I have following XML element which may hold "red" or "blue" value.

<color>red</color>
<color>blue</color>

I need to validate the xml whether it is having only red or blue. How to check multiple fixed values in xsd ?

Current XSD:

<xs:element name="color" type="xs:string" fixed="red"/>
logan
  • 7,946
  • 36
  • 114
  • 185

1 Answers1

4

try this:

<xs:element name="color" maxOccurs="unbounded">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="red"/>
                        <xs:enumeration value="blue"/>
                    </xs:restriction>
                </xs:simpleType>                   
            </xs:element>
Anastasis
  • 192
  • 1
  • 2
  • 12