XML error · attribute
Attributes construct error (unterminated quote)
An attribute value was opened with a quote that is never closed, so the parser runs past the end of the tag looking for the matching one.
attributes construct error (line 1)What it means
The parser began reading a quoted value and reached the end of the tag, the line, or the document without finding the matching quote. libxml2 reports this generically as an "attributes construct error", usually alongside a more specific message about the start tag it could not finish.
The most common real cause is a value that contains the same quote character it is delimited by — an unescaped apostrophe inside a single-quoted value.
What usually causes it
- A quote character inside the value: title='Tom's photo'.
- A dropped closing quote, often after an edit or an interpolation.
- Mismatched quote styles: href="https://example.com'.
- A newline inside what was meant to be a short value, hiding the missing quote.
How to fix it
- Escape the quote as ' or ", or switch to the other quote style.
- Escape attribute values with a serializer rather than interpolating strings.
- Look at the reported line for an odd number of quote characters.
The same error elsewhere
Different parsers, same defect. If you arrived with one of these messages, you are in the right place.
Xerces (Java)
Open quote is expected for attribute "photo" associated with an element type "image:image".libxml2 (companion message)
AttValue: " or ' expectedexpat (Python)
not well-formed (invalid token): line 1, column 24
Before and after
Both snippets are re-checked by the test suite against the real parser: the first is confirmed to produce the exact error above, the second to parse cleanly.
<image:image title='Tom's photo'/><image:image title="Tom's photo"/>Where this bites most
Other XML errors
- Opening and ending tag mismatch
- Premature end of data in tag
- Extra content at the end of the document
- Unescaped ampersand (EntityRef: expecting ';')
- Entity is not defined
- Start tag expected
- XML declaration allowed only at the start of the document
- Unquoted attribute value (AttValue expected)
- Attribute redefined
- Invalid element name
- Document is empty
- Unsupported encoding
- Sequence ']]>' not allowed in content
- Comment not terminated
- Detected an entity reference loop
- PCDATA invalid Char value (control character)
- Unescaped '<' in an attribute value
- Invalid numeric character reference
- Blank needed here
- Malformed declaration expecting version
- Unsupported XML version
- Processing instruction not terminated
- CData section not finished
- Error parsing attribute name
- Double hyphen within comment
- CharRef: invalid decimal value
Get started
Bring order to the XML your team can't afford to ignore.
Create a free account and get a private workspace to search, validate, diff, and monitor your XML feeds, sitemaps, schemas, and vendor integrations.