XML error reference · XV020

Malformed entity reference

An entity reference is missing its terminating semicolon or contains an invalid name.

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.

ParserMessage
Firefox DOMParserXML Parsing Error: EntityRef: expecting ';'
libxml2 / xmllintEntityRef: expecting ';'

What causes it

An entity reference is `&` followed by a name followed by `;`. If the semicolon is missing, or the name contains a space or a character not allowed in XML names, the parser cannot resolve it. Writing `&amp` without the semicolon is the most frequent instance.

See it happen

Triggers the error
<p>Tom &amp Jerry</p>
Corrected
<p>Tom &amp; Jerry</p>

How to fix it

Add the missing semicolon, or escape the ampersand as `&amp;` if it was meant to be literal text. Only five entities are predefined in XML: `&amp;`, `&lt;`, `&gt;`, `&quot;` and `&apos;`. Anything else must be declared in a DTD first.

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.

Input
WaitingPaste a document to check it. Validation runs as you type.

Everything runs in this tab. Nothing you paste is uploaded, logged or sent anywhere. Open your network panel and check.

Tools that catch this

Background reading

Errors this fixes

Every XML error, explained