# Open quote is expected for attribute

Source: https://xmlvalid.com/errors/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

libxml2, which xmlvalid validates with, reports it as [AttValue: " or ' expected](https://xmlvalid.com/errors/attvalue-quote-expected): `AttValue: " or ' expected`

## Example that fails

```xml
<item qty=2/>
```

## Fixed

```xml
<item qty="2"/>
```
