XML error reference · XV005
Unescaped ampersand
A raw & appears where XML expects the start of an entity reference.
What your parser calls it
The same problem, reported differently by each parser. If you arrived here from one of these strings, you are in the right place.
| Parser | Message |
|---|---|
| libxml2 / xmllint | xmlParseEntityRef: no name |
| Firefox DOMParser | XML Parsing Error: EntityRef: expecting ';' |
| Chrome / WebKit | The entity name must immediately follow the '&' in the entity reference. |
| .NET XmlException | An error occurred while parsing EntityName. |
What causes it
In XML, `&` always begins an entity or character reference; it is never literal text. The parser reads everything up to the next `;` as an entity name and fails when that is not a name it recognises. This is the most common XML error in the wild, and it usually arrives via a URL containing a query string such as `?a=1&b=2`, or a company name written as "Marks & Spencer".
See it happen
<link>https://example.com/?a=1&b=2</link><link>https://example.com/?a=1&b=2</link>How to fix it
Replace the literal ampersand with `&`. Inside a CDATA section no escaping is needed, which is often the tidiest option for a block of URLs. If the value is produced in code, use the language's XML escaping function rather than substituting by hand.
Fix your own document
Paste your own document below. Press Sample if you want the broken example above loaded instead. Nothing you paste leaves this tab.
XML Validator
Well-formedness and schema validation. Nothing is uploaded.
Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.