XML Entity Missing Semicolon – Fix EntityRef Errors

Local only

XML entity references must end with a semicolon, so a sequence such as &amp followed by ordinary text is not a complete reference.

28 chars · 1 line

Waiting for input

Loading XML parser…

XML entity syntax

How to fix a missing semicolon in an XML entity

The sample contains &amp without the required trailing semicolon. XML treats an ampersand as the beginning of an entity or character reference, so the reference must be syntactically complete before normal text continues. This tool is free to use. No account or payment is required.

Last updated

What you can do here

  • XML well-formedness validation
  • Broken XML example preloaded
  • Corrected XML comparison
  • .xml file import
  • Browser parser feedback
  • Browser-local processing

Steps

  1. Locate the ampersand nearest the parser error.
  2. Decide whether it begins an entity reference or should be literal text.
  3. Complete the reference with ; or escape a literal ampersand as &, then validate again.

The semicolon is part of XML entity syntax

Unlike informal HTML handling in some browsers, well-formed XML does not allow an entity name to run directly into following text without its terminating semicolon.

Do not confuse a partial entity with an undefined entity

&amp is incomplete syntax, while   is complete syntax for a name that XML does not predefine. The repair depends on which failure you actually have.

XML entity semicolon example

Terminate the amp entity before the following word begins.

Invalid XML

<root>Fish &amp Chips</root>

Corrected XML

<root>Fish &amp; Chips</root>

Common questions

Frequently asked questions

Does every XML entity reference need a semicolon?

Yes. Named and numeric references terminate with a semicolon.

How do I write a literal ampersand in XML text?

Use &amp; in ordinary XML text or attribute values.

Is &amp valid without a semicolon in XML?

No. The well-formed XML form is &amp;.

Debugging a specific XML issue? Browse XML troubleshooting.