EPUB Error: Unescaped Ampersand in XHTML Content

RSC-005: Error while parsing file: The reference to entity "medium" must end with the ";" delimiter. Or: Character "&" is not allowed in element or attribute values

What causes this error?

A literal & character in EPUB chapter files causes a fatal XML parse error — the file cannot be processed at all, not just flagged as a warning. Every & must be written as & in EPUB content because EPUB is XHTML, not HTML, and XHTML follows strict XML rules. The most common sources are URLs with query strings, titles containing ampersands pasted from Word, and OPF metadata fields like publisher names.

How to fix it

  1. EPUBCheck's error message includes the file and line number — open that file and go to the reported line.
  2. Replace every literal & in text content and attribute values with &.
  3. Do not replace & inside existing valid entity references:   or < should be left as-is — the ampersand there is already part of a valid reference.
  4. Check content.opf as well — publisher names, series titles, and other metadata fields containing & need the same escaping.
  5. Search all chapter files, not just the one in the error message — the same source text often propagates to multiple chapters from the same manuscript.
  6. Re-validate with EPUBCheck after fixing to confirm no remaining XML parse errors.

Common questions

I need to display an ampersand on screen — will & show up as literal text to readers?

& is the XHTML-correct way to encode an ampersand. Browsers and e-readers decode & back to & before displaying it, so readers see the & character, not the entity reference text.

Are there other characters that need escaping the same way?

Yes: < must be &lt; and > should be &gt; when used as literal characters in text content. Inside attribute values, quotation marks may need &quot; (double quotes) or &apos; (single quotes) depending on which delimiter wraps the attribute. Ampersand errors are the most common because they appear in URLs and titles; the others are less frequent but follow the same XML escaping rules.

Check your EPUB before uploading

The free EPUB Validator catches structure, metadata, and navigation errors — no signup, no Java, runs in the browser.

Validate Your EPUB Free →

Building your EPUB correctly from the start prevents most of these errors before they happen. See the EPUB formatting guide for the full workflow: manuscript cleanup, TOC, front matter, EPUB 3.0 generation, and validation.

Platform rejection guides: Why Amazon KDP rejects ebooks, Why Apple Books rejects ebooks