Open quote is expected for attribute

An attribute value without quotes.

The message, as Java reports it
Open quote is expected for attribute "qty" associated with an element type "item".

Why it happens

  • An HTML habit: qty=2 instead of qty="2".
  • A typographic quote (“) pasted instead of a straight one.

How to fix it

Put every attribute value in straight double or single quotes. The double spaces in the message are in Java's own text.

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 AttValue: " or ' expected. It checks the whole document in your browser and lists every schema error with its line and column, not only the first.

AttValue: " or ' expected

Example

Reports the error
<item qty=2/>
Fixed
<item qty="2"/>