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, 2487🔥, 0💬
Popular Posts:
Where to find tutorials on Python programming language? I want to learn Python. Here is a large coll...
Where to get a real Atom XML example? You can follow this tutorial to get a real Atom XML example: 1...
How to use the "send-one-way-request" Policy statement to call an extra web service for an Azure API...
How to attach console to a Running Container using the "docker container exec" command? I want to ge...
What are "*..." and "**..." Wildcard Parameters in Function Definitions? If you want to define a fun...