Type doesn't allow value
A value that does not fit the datatype in the RelaxNG pattern.
The message, as the validator reports it
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
Validated against book.rng, below.
Reports the error
<book isbn="1">
<title>T</title>
<year>twenty</year>
</book>
Fixed
<book isbn="1">
<title>T</title>
<year>2020</year>
</book>
book.rng
<element name="book" xmlns="http://relaxng.org/ns/structure/1.0"
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<attribute name="isbn"><data type="string"/></attribute>
<element name="title"><text/></element>
<element name="year"><data type="gYear"/></element>
</element>