Domanda

I can't use a & in the tag of rss feed item, because when I do I always get the error

error on line 1 at column 1337: EntityRef: expecting ';'

but If I don't use & in the tag then everything is ok.

E.g this doesn't work:

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
  <title>Borken RSS feed</title>
  <description>Broken RSS Feed is broken.</description>
  <link>http://example.org</link>
  <lastBuildDate>Tue, 21 Jan 2012 19:13:22 +0100</lastBuildDate>
  <pubDate>Tue, 21 Jan 2012 19:13:22 +0100</pubDate>

[...]
    <link>
    https://www.youtube.com/watch?v=pH6rSul-5X8&feature=related
    </link>
    <guid>
    https://www.youtube.com/watch?v=pH6rSul-5X8&feature=related
    </guid>
[...]
È stato utile?

Soluzione

You have to escape all special characters. & and should look like &amp;

Using php, that would look like: htmlspecialchars($text);

Chars that need to be escaped: <, >, ", &, and possibly others...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top