Skip to main content

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 ' expected
  • expat (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.

Fails
<image:image title='Tom's photo'/>
Parses
<image:image title="Tom&apos;s photo"/>

Where this bites most

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.