# cvc-enumeration-valid: Value is not facet-valid with respect to enumeration

Source: https://xmlvalid.com/errors/cvc-enumeration-valid

> A value is not one of the fixed values the schema allows.

The message, as Java reports it: `cvc-enumeration-valid: Value 'closed' is not facet-valid with respect to enumeration '[open, paid]'. It must be a value from the enumeration.`

## 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: `Paid` or `" paid"` is not `paid` for a string type.

## How to fix it

- Use one of the values in brackets, exactly. If a code list was updated, validate against the schema version that has it. Xerces follows this message with [cvc-type.3.1.3](/errors/cvc-type-3-1-3) naming the element.
- Java's schema validation (`javax.xml.validation.Validator`, and JAXB or Spring on top of it) throws at the first error unless you set an `ErrorHandler` whose `error()` records the `SAXParseException` and carries on; each one has `getLineNumber()` and `getColumnNumber()`. A well-formedness error ends parsing whatever the handler does.

## The same problem in xmlvalid

libxml2, which xmlvalid validates with, reports it as [[facet 'enumeration'] The value is not an element of the set](https://xmlvalid.com/errors/facet-enumeration): `Element 'status': [facet 'enumeration'] The value 'closed' is not an element of the set {'open', 'paid'}.`

## Example that fails

```xml
<order currency="EUR">
  <id>A-1</id>
  <qty>1</qty>
  <status>closed</status>
</order>
```

## Fixed

```xml
<order currency="EUR">
  <id>A-1</id>
  <qty>1</qty>
  <status>paid</status>
</order>
```
