Why can't RSS handle the ampersand?

前端 未结 7 830
滥情空心
滥情空心 2021-01-04 10:53

When I come across a broken RSS feed, the usual reason its all blown to pieces is because line 23 says \"Sanford & Sons.\"

The most confusing thing is the fact

相关标签:
7条回答
  • 2021-01-04 11:50

    Because rss is an XML-based format and in xml the ampersand (&) signifies the start of an xml entity. The parser is expecting something else there.

    You could argue that it should be smart enough to know that the ampersand in "Sanford & Sons" is just an ampersand. But what about when you really want to show ampersand with text? Is "&pc; some custom (also invalid) entity, or should it interpret that as an ampersand also? What about "&"?

    0 讨论(0)
提交回复
热议问题