# cvc-enumeration-valid: value outside the allowed set

The simple type restricts its value space to a finite set of enumeration entries. A value can be valid for the base datatype and still be disallowed by this list. The diagnostic usually prints the accepted alternatives or identifies the enumeration constraint.

## Literal meaning

The status field is restricted to READY or SENT. HOLD is ordinary text and parses correctly, but it is absent from the allowed set. Replacing it with READY makes the specimen valid. In a real order, choose the status that truthfully represents the workflow rather than copying a convenient passing value.

## Three common causes

1. The producer emits a display label instead of the agreed code. A translated label such as a UI status can differ from the schema’s stable interchange value.
2. A new code was introduced upstream while the receiver still validates an older schema release. The list loaded at runtime determines what is accepted.
3. Case or whitespace differs from the type’s value rules. String-based enumerations can preserve distinctions that token-based types normalize before comparison.

## Repair

Locate every xs:enumeration entry on the effective simple type and inspect its base. Compare the outgoing value with the receiver’s code list and schema version. Repair the mapping in the exporter so it emits an authorized value with the intended meaning. Validate every workflow state that the mapping can produce, including transitional states and unknown values, rather than testing only the happy path.

## Namespace checks

An enumeration diagnostic is usually a value problem, because the validator already reached a restriction. If the accepted list belongs to another vocabulary version, inspect targetNamespace and any xsi:type override. A correct namespace prefix cannot make HOLD part of a list containing only READY and SENT.

An enumeration is not necessarily a raw string comparison: datatype value equality and whitespace rules can matter. The example deliberately uses xs:token so surrounding whitespace is normalized, while case remains significant. Do not add an unrecognized enum entry locally unless both parties agree to accept that status.

## Enumeration facet / cvc-enumeration-valid — Broken

```xml
<status>HOLD</status>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="status">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="READY"/>
        <xs:enumeration value="SENT"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
</xs:schema>
```

[Open broken pair](https://xsdhub.com/?example=parser-enumeration&variant=bad#workbench)

## Enumeration facet / cvc-enumeration-valid — Corrected

```xml
<status>READY</status>
```

```xml
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="status">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="READY"/>
        <xs:enumeration value="SENT"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>
</xs:schema>
```

[Open corrected pair](https://xsdhub.com/?example=parser-enumeration&variant=good#workbench)

### Apache Xerces-J 2.12.2

```text
cvc-enumeration-valid: Value 'HOLD' is not facet-valid with respect to enumeration '[READY, SENT]'. It must be a value from the enumeration.
cvc-type.3.1.3: The value 'HOLD' of element 'status' is not valid.
```

Corrected: PASS.

### .NET 8.0.33 · System.Xml.Schema

```text
The 'status' element is invalid - The value 'HOLD' is invalid according to its datatype 'Token' - The Enumeration constraint failed.
```

Corrected: PASS.

### XSDHub libxml2/WASM 0.7.2

```text
Element 'status': [facet 'enumeration'] The value 'HOLD' is not an element of the set {'READY', 'SENT'}.
```

Corrected: PASS.

### XSDHub xmlschema 4.3.1 · XSD 1.0

```text
value must be one of ['READY', 'SENT']
```

Corrected: PASS.

Saxon EE was not available; no measured Saxon wording is claimed.

[All parser codes](https://xsdhub.com/learn#parser-error-codes)
[Download engine evidence](https://xsdhub.com/parser-error-examples/engine-evidence.json)
