Skip to main content

XML error · attribute

Unquoted attribute value (AttValue expected)

An attribute value is not quoted. XML requires quotes around every value, including numbers — unlike HTML, which accepts bare values happily.

AttValue: " or ' expected (line 1)

What it means

Every XML attribute value must be wrapped in single or double quotes. HTML allows bare values like width=100; XML does not, and the parser stops as soon as it finds an unquoted one.

A bare attribute with no value at all — HTML's <video controls> style — is a related but distinct error, reported as "Specification mandates value for attribute controls".

What usually causes it

  • An unquoted value: <url priority=0.8/>.
  • A template variable that rendered empty and collapsed the ="" entirely.
  • A quote stripped by a shell, a CSV round-trip, or an over-eager sanitiser.
  • HTML-style boolean attributes carried into XML.

How to fix it

  • Quote all attribute values, including numbers.
  • Render empty variables as ="" rather than omitting the assignment.
  • For HTML-style booleans, repeat the name: controls="controls".

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 "priority" associated with an element type "url".
  • expat (Python)

    not well-formed (invalid token): line 1, column 14
  • .NET System.Xml

    Expected an attribute value, but found '0'.

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
<url priority=0.8><loc>https://example.com/</loc></url>
Parses
<url priority="0.8"><loc>https://example.com/</loc></url>

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.