<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating RSS feeds in ASP.NET MVC</title>
	<atom:link href="http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc/feed" rel="self" type="application/rss+xml" />
	<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-rss-feeds-in-asp-net-mvc</link>
	<description>A .NET developer in silicon valley</description>
	<lastBuildDate>Sun, 25 Dec 2011 15:10:30 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: David Whitney</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-45755</link>
		<dc:creator>David Whitney</dc:creator>
		<pubDate>Wed, 15 Jun 2011 14:13:28 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-45755</guid>
		<description>I just got a message regarding my above comment. Appears that the markup stripping in this blog has stripped out some of the code, which makes my comment appear insane!

Here&#039;s a gist with the snippet that might make it make sense: https://gist.github.com/1027181

The issue we were having was that  elements were getting HTMLEncoded by default, ruining their entire purpose.</description>
		<content:encoded><![CDATA[<p>I just got a message regarding my above comment. Appears that the markup stripping in this blog has stripped out some of the code, which makes my comment appear insane!</p>
<p>Here&#8217;s a gist with the snippet that might make it make sense: <a href="https://gist.github.com/1027181" rel="nofollow">https://gist.github.com/1027181</a></p>
<p>The issue we were having was that  elements were getting HTMLEncoded by default, ruining their entire purpose.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adding RSS Feed to my blog in 10 minutes &#171; Ray&#8217;s Weblog</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-42601</link>
		<dc:creator>Adding RSS Feed to my blog in 10 minutes &#171; Ray&#8217;s Weblog</dc:creator>
		<pubDate>Wed, 03 Nov 2010 18:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-42601</guid>
		<description>[...] RSS Feed to my blog in 10&#160;minutes  Damien Guard has a nice solution on Creating RSS feeds in ASP.NET MVC. He relied on the .NET Framework built classes rather than cooking up things ourselves.&#160; I was [...]</description>
		<content:encoded><![CDATA[<p>[...] RSS Feed to my blog in 10&nbsp;minutes  Damien Guard has a nice solution on Creating RSS feeds in ASP.NET MVC. He relied on the .NET Framework built classes rather than cooking up things ourselves.&#160; I was [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: May 20th Links: ASP.NET MVC, ASP.NET, .NET 4, VS 2010, Silverlight - ScottGu's Blog</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41860</link>
		<dc:creator>May 20th Links: ASP.NET MVC, ASP.NET, .NET 4, VS 2010, Silverlight - ScottGu's Blog</dc:creator>
		<pubDate>Fri, 21 May 2010 05:56:22 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41860</guid>
		<description>[...] Creating RSS Feeds in ASP.NET MVC: Damien Guard has a nice post that describes a cool new “FeedResult” class he created that makes it easy to publish and expose RSS feeds from within ASP.NET MVC sites. [...]</description>
		<content:encoded><![CDATA[<p>[...] Creating RSS Feeds in ASP.NET MVC: Damien Guard has a nice post that describes a cool new “FeedResult” class he created that makes it easy to publish and expose RSS feeds from within ASP.NET MVC sites. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TWC9: Windows Phone 7 Dev Tools Refresh, Messenger Wave 4 Preview &#124; CHARGED's Digital Lifestyle at Work or Play</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41785</link>
		<dc:creator>TWC9: Windows Phone 7 Dev Tools Refresh, Messenger Wave 4 Preview &#124; CHARGED's Digital Lifestyle at Work or Play</dc:creator>
		<pubDate>Mon, 10 May 2010 07:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41785</guid>
		<description>[...] Guard &#8211; Creating RSS feeds in ASP.NET MVC,via [...]</description>
		<content:encoded><![CDATA[<p>[...] Guard &#8211; Creating RSS feeds in ASP.NET MVC,via [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Whitney</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41330</link>
		<dc:creator>David Whitney</dc:creator>
		<pubDate>Thu, 29 Apr 2010 12:55:57 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41330</guid>
		<description>I&#039;ve been using a similar method for producing feeds for some time.
I&#039;ve found that you suffer if you start requiring CDATA.

While my solution isn&#039;t quite ideal, this is the technique I use to get around the lack of CDATA support in the .NET SyndicationFeed objects.
&lt;pre&gt;&lt;code&gt;public class RssResult : ActionResult {
        public SyndicationFeed Feed { get; set; }

        public RssResult(SyndicationFeed feed) {
            Feed = feed;
        }

        public override void ExecuteResult(ControllerContext context) {
            context.HttpContext.Response.ContentType = &quot;application/xml&quot;;
            var rssFormatter = new Rss20FeedFormatter(Feed);
            var settings = new XmlWriterSettings {
                                             NewLineHandling = NewLineHandling.None,
                                             Indent = true,
                                             Encoding = Encoding.UTF32,
                                             ConformanceLevel = ConformanceLevel.Document,
                                             OmitXmlDeclaration = true
                                         };

            var buffer = new StringBuilder();
            var cachedOutput = new StringWriter(buffer);

            using (var writer = XmlWriter.Create(cachedOutput, settings)) {
                if (writer != null) {
                    rssFormatter.WriteTo(writer);
                    writer.Close();
                }
            }
            
            var xmlDoc =  XDocument.Parse(buffer.ToString());
            foreach (var element in xmlDoc.Descendants(&quot;channel&quot;).First().Descendants(&quot;item&quot;).Descendants(&quot;description&quot;))
                VerifyCdataHtmlEncoding(buffer, element);

            foreach (var element in xmlDoc.Descendants(&quot;channel&quot;).First().Descendants(&quot;description&quot;))
                VerifyCdataHtmlEncoding(buffer, element);

            buffer.Replace(&quot; xmlns:a10=\&quot;http://www.w3.org/2005/Atom\&quot;&quot;, &quot; xmlns:atom=\&quot;http://www.w3.org/2005/Atom\&quot;&quot;);
            buffer.Replace(&quot;a10:&quot;, &quot;atom:&quot;);

            context.HttpContext.Response.Output.Write(buffer.ToString());
        }

        private static void VerifyCdataHtmlEncoding(StringBuilder buffer, XElement element) {
            if(element.Value.Contains(&quot;&quot;)) {
                string cdataValue = string.Format(&quot;&quot;, element.Name, element.Value, element.Name);
                buffer.Replace(element.ToString(), cdataValue);
            }
        }
    }&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been using a similar method for producing feeds for some time.<br />
I&#8217;ve found that you suffer if you start requiring CDATA.</p>
<p>While my solution isn&#8217;t quite ideal, this is the technique I use to get around the lack of CDATA support in the .NET SyndicationFeed objects.</p>
<pre><code>public class RssResult : ActionResult {
        public SyndicationFeed Feed { get; set; }

        public RssResult(SyndicationFeed feed) {
            Feed = feed;
        }

        public override void ExecuteResult(ControllerContext context) {
            context.HttpContext.Response.ContentType = "application/xml";
            var rssFormatter = new Rss20FeedFormatter(Feed);
            var settings = new XmlWriterSettings {
                                             NewLineHandling = NewLineHandling.None,
                                             Indent = true,
                                             Encoding = Encoding.UTF32,
                                             ConformanceLevel = ConformanceLevel.Document,
                                             OmitXmlDeclaration = true
                                         };

            var buffer = new StringBuilder();
            var cachedOutput = new StringWriter(buffer);

            using (var writer = XmlWriter.Create(cachedOutput, settings)) {
                if (writer != null) {
                    rssFormatter.WriteTo(writer);
                    writer.Close();
                }
            }

            var xmlDoc =  XDocument.Parse(buffer.ToString());
            foreach (var element in xmlDoc.Descendants("channel").First().Descendants("item").Descendants("description"))
                VerifyCdataHtmlEncoding(buffer, element);

            foreach (var element in xmlDoc.Descendants("channel").First().Descendants("description"))
                VerifyCdataHtmlEncoding(buffer, element);

            buffer.Replace(" xmlns:a10=\"http://www.w3.org/2005/Atom\"", " xmlns:atom=\"http://www.w3.org/2005/Atom\"");
            buffer.Replace("a10:", "atom:");

            context.HttpContext.Response.Output.Write(buffer.ToString());
        }

        private static void VerifyCdataHtmlEncoding(StringBuilder buffer, XElement element) {
            if(element.Value.Contains("")) {
                string cdataValue = string.Format("", element.Name, element.Value, element.Name);
                buffer.Replace(element.ToString(), cdataValue);
            }
        }
    }</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jarrod N</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41310</link>
		<dc:creator>Jarrod N</dc:creator>
		<pubDate>Thu, 29 Apr 2010 06:08:33 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41310</guid>
		<description>Hi Damien,
Thanks for the well written article, RSS is really the glue that holds a lot of services together, leveraging it is well worth while.

On a side note, I was very happy to see your code using the &quot;Envy Code R&quot; font, I&#039;ve switched to that recently and haven&#039;t looked back :)

-Jarrod</description>
		<content:encoded><![CDATA[<p>Hi Damien,<br />
Thanks for the well written article, RSS is really the glue that holds a lot of services together, leveraging it is well worth while.</p>
<p>On a side note, I was very happy to see your code using the &#8220;Envy Code R&#8221; font, I&#8217;ve switched to that recently and haven&#8217;t looked back :)</p>
<p>-Jarrod</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dew Drop &#8211; April 27, 2010 &#124; Alvin Ashcraft&#39;s Morning Dew</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41135</link>
		<dc:creator>Dew Drop &#8211; April 27, 2010 &#124; Alvin Ashcraft&#39;s Morning Dew</dc:creator>
		<pubDate>Tue, 27 Apr 2010 13:18:28 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41135</guid>
		<description>[...] Creating RSS feeds in ASP.NET MVC (Damien Guard) [...]</description>
		<content:encoded><![CDATA[<p>[...] Creating RSS feeds in ASP.NET MVC (Damien Guard) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan F</title>
		<link>http://damieng.com/blog/2010/04/26/creating-rss-feeds-in-asp-net-mvc#comment-41132</link>
		<dc:creator>Dan F</dc:creator>
		<pubDate>Tue, 27 Apr 2010 10:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://damieng.com/?p=1626#comment-41132</guid>
		<description>That code makes me happy. I can&#039;t define &lt;i&gt;good&lt;/i&gt; code, but I know it when I see it. Simple, extensible, testable, re-uses pre existing artwork that&#039;s baked into the framework, it ticks a whole lot of boxes. Nice work Mr Guard.</description>
		<content:encoded><![CDATA[<p>That code makes me happy. I can&#8217;t define <i>good</i> code, but I know it when I see it. Simple, extensible, testable, re-uses pre existing artwork that&#8217;s baked into the framework, it ticks a whole lot of boxes. Nice work Mr Guard.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic page generated in 0.152 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-02-08 03:22:32 -->
<!-- Compression = gzip -->
