<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Seree Woradechjamroen &#187; create rss</title>
	<atom:link href="http://www.iamseree.com/tag/create-rss/feed" rel="self" type="application/rss+xml" />
	<link>http://www.iamseree.com</link>
	<description>Keep learning everyday, willing to win and take action</description>
	<lastBuildDate>Tue, 15 May 2012 16:06:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Create RSS Feed from your data with .NET</title>
		<link>http://www.iamseree.com/application-development/create-rss-feed-from-your-data-with-net</link>
		<comments>http://www.iamseree.com/application-development/create-rss-feed-from-your-data-with-net#comments</comments>
		<pubDate>Thu, 02 Aug 2007 12:51:34 +0000</pubDate>
		<dc:creator>Seree</dc:creator>
				<category><![CDATA[Application Development]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[create rss]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.iamseree.com/?p=17</guid>
		<description><![CDATA[<p>Hello,</p> <p>Today I&#8217;ll give you a quick guide on how to create RSS Feed channel from your existing data. Before we go to the implementation, let&#8217;s see a brief overview of <a href="http://en.wikipedia.org/wiki/RSS" target="_blank" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/RSS?referer=');">What is RSS, Feed or Atom?</a></p> <p>RSS, Feed or Atom is a format name of the method for latest generation webmaster to [...]]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>Today I&#8217;ll give you a quick guide on how to create RSS Feed channel from your existing data. Before we go to the implementation, let&#8217;s see a brief overview of <a href="http://en.wikipedia.org/wiki/RSS" target="_blank" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/RSS?referer=');">What is RSS, Feed or Atom?</a></p>
<p>RSS, Feed or Atom is a format name of the method for latest generation webmaster to feed their own <strong><em>updated contents</em></strong> into external web sites or any external applications. I focus to the word <strong><em>updated contents</em></strong> because this is a point of the method. (Now I&#8217;ll call it RSS and no more Feed or Atom) The content that provide RSS Feed channel almost often updated.</p>
<p>RSS content can be read by any RSS reader software such as Internet Explorer 7.0, Mozilla FireFox, Microsoft Outlook or any third party. Sometime it called &#8220;Feed reader&#8221; or &#8220;Aggregator&#8221; instead of &#8220;RSS reader&#8221;. Most of RSS reader can monitoring the RSS Feed channel and seeing if there are any changes occurred in the content when compared to previous time. This is very useful when some user don&#8217;t want to spend too much time to load any UI as it takes so much time than actual contents. If you still don&#8217;t get an idea and you have some RSS reader installed, you can try it online <a href="http://www.knowhowdd.com/GetGroupFeed.aspx?groupId=4" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com/GetGroupFeed.aspx?groupId=4&amp;referer=');">here</a>. (Sorry, but the content of the feed is in Thai language. Just prove to get you idea)</p>
<p>For webmaster or developer like us, If you want to build your web site to stay tuned with <a href="http://en.wikipedia.org/wiki/Web_2.0" target="_blank" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Web_2.0?referer=');">Web 2.0</a> trend. You should build RSS Feed channel to your web application to let external applications consume your data and get more traffics.</p>
<p>In technically terms. RSS, Feed or Atom are all just an XML file that had their own format which RSS reader can be read. You can see the sample of XML structure <a href="http://msdn2.microsoft.com/en-us/xml/bb190613.aspx" target="_blank" onclick="pageTracker._trackPageview('/outgoing/msdn2.microsoft.com/en-us/xml/bb190613.aspx?referer=');">here</a>. (Just RSS 2.0)</p>
<p>So, how can we coding to build up RSS Feed channel from the existing data? It&#8217;s very easy, easier than you thinks!<span id="more-17"></span></p>
<p><!--adsense--></p>
<p>Let&#8217;s examine the RSS 2.0 specification first.</p>
<blockquote><p><span style="color: #22ffff; font-size: x-small;">&lt;?xml version=&#8221;1.0&#8243;?&gt;<br />
&lt;rss version=&#8221;2.0&#8243;&gt;<br />
&lt;channel&gt;<br />
&lt;title&gt;Latest Know-How&lt;/title&gt;<br />
&lt;link&gt;</span><a href="http://www.knowhowdd.com/" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com/?referer=');"><span style="color: #22ffff; font-size: x-small;">http://www.knowhowdd.com/</span></a><span style="font-size: x-small;"><span style="color: #22ffff;">&lt;/link&gt;<br />
&lt;description&gt;Latest knowhow from www.knowhowdd.com&lt;/description&gt;<br />
&lt;language&gt;en-us&lt;/language&gt;<br />
&lt;pubDate&gt;Tue, 10 Jun 2003 04:00:00 GMT&lt;/pubDate&gt;<br />
&lt;managingEditor&gt;rss@knowhowdd.com&lt;/managingEditor&gt;<br />
&lt;webMaster&gt;webmaster@knowhowdd.com&lt;/webMaster&gt;<br />
</span><br />
<span style="color: #22ffff;">&lt;item&gt;<br />
&lt;title&gt;Custom ASP.NET Membership Provider&lt;/title&gt;      &lt;link&gt;</span></span><a href="http://www.knowhowdd.com/ShowKnowhow.aspx?khId=11" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com/ShowKnowhow.aspx?khId=11&amp;referer=');"><span style="color: #22ffff; font-size: x-small;">http://www.knowhowdd.com/ShowKnowhow.aspx?khId=11</span></a><span style="color: #22ffff; font-size: x-small;">&lt;/link&gt;<br />
&lt;description&gt;How to create your own custom ASP.NET authentication membership provider&lt;/description&gt;<br />
&lt;pubDate&gt;Tue, 03 Jun 2003 09:39:21 GMT&lt;/pubDate&gt;<br />
&lt;/item&gt;</span></p>
<p><span style="color: #22ffff; font-size: x-small;"> &lt;item&gt;<br />
&lt;title&gt;Custom ASP.NET Role Provider&lt;/title&gt;<br />
&lt;link&gt;</span><a href="http://www.knowhowdd.com/ShowKnowhow.aspx?khId=25" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com/ShowKnowhow.aspx?khId=25&amp;referer=');"><span style="color: #22ffff; font-size: x-small;">http://www.knowhowdd.com/ShowKnowhow.aspx?khId=25</span></a><span style="font-size: x-small;"><span style="color: #22ffff;">&lt;/link&gt;<br />
&lt;description&gt;How to create your own custom ASP.NET authentication role provider&lt;/description&gt;<br />
&lt;pubDate&gt;Fri, 30 May 2003 11:06:42 GMT&lt;/pubDate&gt;<br />
&lt;/item&gt;<br />
</span><br />
<span style="color: #22ffff;">&lt;/channel&gt;<br />
&lt;/rss&gt;</span></span></p></blockquote>
<p>What I&#8217;ve hi-lighted in blue are header and footer sections which describe itself meaning. Next, what I&#8217;ve hi-lighted as red is body which contains your content items.</p>
<p>So, our development task is just to generate this XML stream from the existing data. It&#8217;s really easy to complete this task as .NET already provide a great XML class library. Let&#8217;s begin coding with VB.NET.</p>
<p>First of all, import some necessary namespaces.</p>
<blockquote><p>Imports System.Text<br />
Imports System.Xml</p></blockquote>
<p>Then go to the code block where you want to generate the RSS Feed and coding to build header section just like the following&#8230;</p>
<blockquote><p><span style="color: #008000;">&#8216;Clear response</span><br />
Response.Clear()</p>
<p><span style="color: #008000;">&#8216;Write the beginning of RSS content</span><br />
Response.ContentType = &#8220;text/xml&#8221;<br />
Dim xtwFeed As New XmlTextWriter(Response.OutputStream, Encoding.UTF8)<br />
xtwFeed.WriteStartDocument()<br />
xtwFeed.WriteStartElement(&#8220;rss&#8221;)<br />
xtwFeed.WriteAttributeString(&#8220;version&#8221;, &#8220;2.0&#8243;)<br />
xtwFeed.WriteStartElement(&#8220;channel&#8221;)<br />
xtwFeed.WriteElementString(&#8220;title&#8221;, &#8220;KnowHowDD.com &#8211; Latest Know-How on group : &#8221; &amp; g.Title)<br />
xtwFeed.WriteElementString(&#8220;link&#8221;, &#8220;<a href="http://www.knowhowdd.com" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com?referer=');"><span style="color: #22ffff;">http://www.knowhowdd.com&#8221;)</span></a><br />
xtwFeed.WriteElementString(&#8220;description&#8221;, &#8220;The latest know-how from KnowHowDD.com&#8221;)<br />
xtwFeed.WriteElementString(&#8220;copyright&#8221;, &#8220;Copyright 2006 &#8211; 2007 KnowHowDD.com. All rights reserved.&#8221;)</p></blockquote>
<p>The header section was completed now, then we&#8217;ll begin to build the body section of the RSS feed. Normally I&#8217;ll loop through the collection of data which I want to provide as RSS Feed channel.</p>
<blockquote><p><span style="color: #008000;">&#8216;Loop through all records to generate RSS body<br />
</span>For Each kh As KnowHowEntity In knowHows<br />
<span style="color: #008000;">&#8216;Write body (Extract from database)<br />
</span> xtwFeed.WriteStartElement(&#8220;item&#8221;)<br />
xtwFeed.WriteElementString(&#8220;title&#8221;, kh.Title)<br />
xtwFeed.WriteElementString(&#8220;description&#8221;, kh.Description)<br />
xtwFeed.WriteElementString(&#8220;link&#8221;, &#8220;<a href="http://www.knowhowdd.com/ShowKnowHow.aspx?knowHowId=" onclick="pageTracker._trackPageview('/outgoing/www.knowhowdd.com/ShowKnowHow.aspx?knowHowId=&amp;referer=');"><span style="color: #22ffff;">http://www.knowhowdd.com/ShowKnowHow.aspx?knowHowId=&#8221;</span></a> &amp; kh.KnowHowId)<br />
xtwFeed.WriteElementString(&#8220;pubDate&#8221;, kh.PubDate.ToString(&#8220;dd/MM/yyyy hh:mm:ss&#8221;))<br />
xtwFeed.WriteEndElement()<br />
Next</p></blockquote>
<p>Now, the body section was completely built. Let&#8217;s complete the footer section.</p>
<blockquote><p><span style="color: #008000;">&#8216;Write the ending of RSS content</span><br />
xtwFeed.WriteEndElement()<br />
xtwFeed.WriteEndElement()<br />
xtwFeed.WriteEndDocument()<br />
xtwFeed.Flush()<br />
xtwFeed.Close()<br />
Response.End()</p></blockquote>
<p>Easy or not, now it&#8217;s completed and we all got RSS Feed channel in our <a href="http://en.wikipedia.org/wiki/Web_2.0" target="_blank" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Web_2.0?referer=');">Web 2.0</a> style application!</p>
<p><!--adsense--></p>
<div align="left" style="float: ; padding: 5px 5px 0px 0px;"><a name="fb_share" type="button" share_url="http://www.iamseree.com/application-development/create-rss-feed-from-your-data-with-net"></a></div>]]></content:encoded>
			<wfw:commentRss>http://www.iamseree.com/application-development/create-rss-feed-from-your-data-with-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

