# Type doesn't allow value

Source: https://xmlvalid.com/errors/type-does-not-allow-value

> A value that does not fit the datatype in the RelaxNG pattern.

Example message: `Type gYear doesn't allow value 'twenty'`

## Why it happens

- A value in the wrong format for its XML Schema datatype: a year written out, a date in a local format, a decimal comma.

## How to fix it

- Write the value in the datatype's format. The two messages that follow (*Error validating datatype*, *failed to validate content*) are the same error.

## Example that fails

```xml
<book isbn="1">
  <title>T</title>
  <year>twenty</year>
</book>
```

## Fixed

```xml
<book isbn="1">
  <title>T</title>
  <year>2020</year>
</book>
```
