The Enumeration constraint failed
A value is not one of the fixed values the schema allows.
The 'status' element is invalid - The value 'closed' is invalid according to its datatype 'Status' - The Enumeration constraint failed.
Why it happens
- A value missing from the list: a new status, a code from a newer code list.
- A different letter case or surrounding spaces.
How to fix it
Use one of the values the type lists; .NET doesn't name them, so look the type (Status here) up in the schema.
.NET throws an XmlSchemaValidationException at the first schema error unless XmlReaderSettings.ValidationEventHandler is set, which then receives every one with its line and position. A well-formedness error is an XmlException and ends reading whatever the settings.
The same problem in xmlvalid
xmlvalid validates with libxml2, which reports it as [facet 'enumeration'] The value is not an element of the set. It checks the whole document in your browser and lists every schema error with its line and column, not only the first.
Element 'status': [facet 'enumeration'] The value 'closed' is not an element of the set {'open', 'paid'}.
Example
Validated against order.xsd, below.
<order currency="EUR">
<id>A-1</id>
<qty>1</qty>
<status>closed</status>
</order>
<order currency="EUR">
<id>A-1</id>
<qty>1</qty>
<status>paid</status>
</order>
order.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="order">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:string"/>
<xs:element name="qty" type="xs:int"/>
<xs:element name="status" type="Status" minOccurs="0"/>
<xs:element name="code" type="Code" minOccurs="0"/>
<xs:element name="note" type="Short" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="currency" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="Status">
<xs:restriction base="xs:string">
<xs:enumeration value="open"/>
<xs:enumeration value="paid"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Code">
<xs:restriction base="xs:string">
<xs:pattern value="[A-Z]{3}-[0-9]{4}"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Short">
<xs:restriction base="xs:string">
<xs:maxLength value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>