How to fix error: invalid character in entity name in RSS feeds

how-to-fix-error:-invalid-character-in-entity-name-in-rss-feeds

I use a GitHub action to update my GitHub profile README with my latest blog posts. For over a week the job had been failing, and I ignored it (rookie mistake). It turns out I had broken my RSS feed when I edited some blog post descriptions and used a character that wasn’t valid in XML (referred to as an invalid token).

The error in the GitHub action workflow run wasn’t very helpful, though: “Error: Invalid character in entity name”. 🫠

Error feed.xml runner failed, please verify the configuration. Error: invalid character in entity name. Line 1579. Column 152. Char not specified. 0 blog posts fetched.

Luckily, the RSS Feed Validation Service provided by W3C gave a better error report.

Sorry. This feed does not validate. Line 1597, column 151: XML parsing error, not well-formed (invalid token). The line that broke it was: information to screen-readers & (ampersand) assistive tech in the description tag.

This helped me track down the invalid character to an ampersand (&), which I added to a blog post description a week ago to reduce the character count. The resulting invalid description tag in the XML document looked like this:


</span>When to use aria-labels in your HTML<span class="nt">
This is one of the most important ways to use aria-labels so your code provides contextual information to screen-readers & assistive tech.

I did some further reading on XML and learned that ampersands, and left and right angled brackets (< and >) must be escaped in XML in order for the document to be valid, unless wrapped in a CDATA section. Read more about XML character data and markup on the official W3C docs.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
customer-segmentation:-the-ultimate-guide-for-saas-companies

Customer Segmentation: The Ultimate Guide for SaaS Companies

Next Post
email-marketing-audit-—-the-complete-guide

Email Marketing Audit — The Complete Guide

Related Posts