cvc-attribute.3: The value of attribute is not valid with respect to its type
An attribute's value does not satisfy its type; the message before it says why.
cvc-attribute.3: The value 'two' of attribute 'qty' on element 'item' is not valid with respect to its type, 'int'.
Why it happens
- The value is in the wrong format for the attribute's datatype: Xerces reports that first as cvc-datatype-valid.1.2.1.
- It breaks a facet of the type: an enumeration, a pattern, a length.
How to fix it
Fix the value as the previous message says; this one adds the attribute, the element and the declared type.
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
xmlvalid validates with libxml2, which reports it as Is not a valid value of the atomic type. It checks the whole document in your browser and lists every schema error with its line and column, not only the first.
Element 'qty': 'two' is not a valid value of the atomic type 'xs:int'.
Example
Validated against item.xsd, below.
<item qty="two"/>
<item qty="2"/>
item.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="item">
<xs:complexType>
<xs:attribute name="qty" type="xs:int" use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>