What are the valid HTML tags in RSS Feeds?

这一生的挚爱 提交于 2019-12-04 03:44:40
ashraf mohammed
 <title>How to parse full html content in xml feeds</title>
 <description><![CDATA[<html><body>Any code html is valid here like &npsb; 
 and what ever you want to transfer</body></html>]]></description>
 <guid>http://example.com/your-news-id</guid>

I don't think there's a standard here - it's all about what the RSS reader itself is willing to implement. So my guess would be that, for example, Google Reader would wash out tags and the like and dangerous HTML and CSS attributes, and then allow whatever other sort of non-blacklisted tag you would dare to include.

So, yeah. There's no specification, and therefore likely no standard - just the same general XSS prevention techniques we see across the whole interwebs. Your only option is to try out various tags that you think may be contentious (though really I'd expect almost anything but CSS styling would be permitted) in different RSS readers to see what happens, or simply to have your content ready to fall back to a more basic format if the desired HTML/CSS is not permitted.

What in particular are you trying to do? You may be able to get better answers if you can specify - or is this just a question of curiosity?

I think the 'right' thing to do is either include an xhtml namespace (xmlns:html="http://www.w3.org/1999/xhtml") or put the HTML data in a CDATA section.

I don't think there's any "official" answer. It might depend on what level of compatibility you're aiming for.

I'd keep it to the basic text formatting tags (STRONG, EM, etc) and IMG and A and that's about it.

In fact, no HTML attributes are allowed in RSS feeds. Only XML tags listed in the specification posted above are allowed. Also, since it is XML, only some Unicode encodings are allowed (e.g. UTF-8). That many RSS providers do not respect the standard is another matter.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!