Tools, FAQ, Tutorials:
Protect XML Special Characters in RSS Feeds
How to protect XML Special Characters in RSS Feeds?
✍: FYIcenter.com
An RSS document is an XML document.
And there 3 primary XML special characters you need
to protect them, if you are using them in your RSS element contents:
If you are using XML special characters in the "channel/item/description" element, it may get interpreted as HTML tags by some RSS viewers. So you need to apply the HTML escape sequence on top of the XML escape sequence to protect them.
For example, look at how angle brackets are protected in the following RSS feed example, rss-angle-brackets.xml:
<?xml version="1.0" encoding="utf-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>FYI Center <for> Software Developers</title> <link>http://dev.fyicenter.com/</link> <description>FYI (For Your Information) Center for Software Developers with large collection of FAQs, tutorials and tips.</description> <pubDate>Tue, 19 Sep 2017 04:05:38 +0200</pubDate> <image> <url>http://dev.fyicenter.com/_logo.png</url> <title>FYI Center for Software Developers</title> <link>http://dev.fyicenter.com/</link> </image> <atom:link href="http://dev.fyicenter.com/rss_xml.php" rel="self" type="application/rss+xml" /> <copyright>Copyright (c) FYIcenter.com</copyright> <item> <title>Visual Studio <2017> .NET Program Folders</title> <link>http://dev.fyicenter.com/1000510_Visual_Studio_2017_NET_Program_Folders.html</link> <description><img align='left' width='64' height='64' src='http://dev.fyicenter.com/Visual-Studio/_icon_Dot-NET.png' /> In which folders Visual Studio 2017 .NET programs are located on my Windows computer? Is 1 &lt; 2 or 2 < 1? - Rank: 110; Updated: 2017-09-19 02:44:09 -> <a href='http://dev.fyicenter.com/1000510_Visual_Studio_2017_NET_Program_ Folders.html'>Source</a></description> <pubDate>Tue, 19 Sep 2017 02:44:09 +0200</pubDate> <category>visualstudio</category> <guid>http://dev.fyicenter.com/1000510_Visual_Studio_2017_NET_Program_Folders.html</guid> <author>info@fyicenter.com (FYIcenter.com)</author> </item> </channel> </rss>
The picture below shows you how the above RSS feed is displayed in Internet Explorer:
If you want to view it in other RSS viewers, you can download it here.
⇒ RSS 2.0 XML Schema at codeplex.com
2017-11-05, 2738🔥, 0💬
Popular Posts:
Can Two Forms Be Nested? Can two forms be nested? The answer is no and yes: No. You can not nest two...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How to read Atom validation errors at w3.org? If your Atom feed has errors, the Atom validator at w3...
Where to find tutorials on OpenID? Here is a large collection of tutorials to answer many frequently...
Where to get a JSON.stringify() Example Code in JavaScript? Here is a good JSON.stringify() example ...