figure 1 sample rss 1.0 document
<rdf:rdf xmlns:rdf=”http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns=”http://purl.org/rss/1.0/” xmlns:dc=”http://purl.org/dc/elements/1.1/” > <channel rdf:about=”http://skonnard.com/blog/rss.xml”> <title>the xml files</title> <link>http://skonnard.com/blog</link> <description>by aaron skonnard</description> <image rdf:resource=”http://skonnard.com/blog/images/image.gif” /> <items> <rdf:seq> <rdf:li resource=” http://skonnard.com/blog/entry1″ /> <rdf:li resource=” http://skonnard.com/blog/entry2″ /> </rdf:seq> </items> </channel> <image rdf:about=” http://skonnard.com/blog/images/image.gif”> <title>skonnard.com</title> <link>http://skonnard.com/blog</link> <url>http://skonnard.com/blog/images/image.gif</url> </image> <item rdf:about=”http://skonnard.com/blog/entry1″> <title>1st blog entry</title> <link>http://skonnard.com/blog/entry1</link> <description>this is my first blog entry.</description> <dc:date>2004-01-13t17:16:44.9803903-07:00</dc:date> </item> <item rdf:about=”http://skonnard.com/blog/entry1″> <title>2nd blog entry</title> <link>http://skonnard.com/blog/entry1</link> <description>this is my second blog entry.</description> <dc:date>2004-01-13t17:16:45.9803903-07:00</dc:date> </item></rdf:rdf>
figure 2 sample rss 2.0 document
<rss version=”2.0″> <channel> <title>the xml files</title> <link>http://skonnard.com/blog</link> <description>by aaron skonnard</description> <image> <url>http://skonnard.com/blog/images/image.gif</url> <title>skonnard.com</title> <link>http://skonnard.com/blog/</link> </image> <item> <title>1st blog entry</title> <link>http://skonnard.com/blog/entry1</link> <description>this is my first blog entry.</description> <pubdate>wed, 14 jan 2004 17:16:44 gmt</pubdate> </item> <item> <title>2nd blog entry</title> <link>http://skonnard.com/blog/entry1</link> <description>this is my second blog entry</description> <pubdate>wed, 14 jan 2004 17:16:45 gmt</pubdate> </item> </channel></rss>
figure 3 sample atom 0.3 feed
<feed version=”0.3″ xml:lang=”en-us” xmlns=”http://purl.org/atom/ns#”> <title>the xml files</title> <link>http://skonnard.com/blog/</link> <modified>2004-01-13t17:16:45.0004199-07:00</modified> <tagline>by aaron skonnard</tagline> <author> <name>aaron skonnard</name> </author> <entry> <title>1st blog entry</title> <link>http://skonnard.com/blog/entry1</link> <created>2004-01-13t17:16:44.9803903-07:00</created> <content type=”text/html” mode=”xml”> <body xmlns=”http://www.w3.org/1999/xhtml”> <p>this is my first blog entry</p> </body> </content> </entry> <entry> <title>2nd blog entry</title> <link>http://skonnard.com/blog/entry2</link> <created>2004-01-13t17:16:45.9803903-07:00</created> <content type=”text/html” mode=”xml”> <body xmlns=”http://www.w3.org/1999/xhtml”> <p>this is my second blog entry</p> </body> </content> </entry></feed>
figure 4 sample blogroll (opml)
<opml> <head> <title>aarons favorite blogs</title> </head> <body> <outline type=”rss” title=”pdc bloggers” description=”pdc bloggers website” xmlurl=”http://pdcbloggers.net/feed.rss” htmlurl=”http://pdcbloggers.net” /> <outline type=”rss” title=”msdn magazine: current issue” description=”the microsoft journal for developers” xmlurl=”http://msdn.microsoft.com/msdnmag/rss/recent.xml” htmlurl=”http://msdn.microsoft.com/msdnmag/” /> <outline type=”rss” title=”msdn just published” description=”keep current …” xmlurl=”http://msdn.microsoft.com/rss.xml” htmlurl=”http://msdn.microsoft.com/” /> </body></opml>
figure 5 generating an rss 2.0 feed in asp.net
<%@ page language=”c#” codebehind=”rss.aspx.cs” autoeventwireup=”false” inherits=”simpleblog.rss” %><rss version=”2.0″> <channel> <title>my blog</title> <link>http://localhost/simpleblog/default.aspx</link> <description>a weblog about nothing…</description> <language>en-us</language> <asp:repeater id=”items” runat=”server”> <itemtemplate> <item> <title><%#databinder.eval(container.dataitem, “title”)%></title> <description><%#databinder.eval( container.dataitem,”description”)%></description> <pubdate><%#databinder.eval(container.dataitem, “pubdate”) %></pubdate> <link><%# databinder.eval(container.dataitem, “link”) %></link> </item> </itemtemplate> </asp:repeater> </channel></rss>
figure 6 rss aggregator web user control
<%@ control language=”c#” autoeventwireup=”true” enableviewstate=”false” debug=”true”%><%@ import namespace=”system.xml” %><%@ outputcache duration=”1800″ varybyparam=”none” %><script runat=”server” language=”c#”>private void page_load(object sender, system.eventargs e){ stringbuilder sb = new stringbuilder(); xmldocument doc = new xmldocument(); doc.load(server.mappath(“blogroll.opml”)); int numtodisp = int.parse(doc.selectsinglenode( “/opml/@numbertodisplay”).innertext); xmlnodelist rss = doc.selectnodes(“//outline/@xmlurl”); foreach (xmlnode r in rss) { xmldocument blogdoc = new xmldocument(); blogdoc.load(r.value); xmlnodelist items = blogdoc.selectnodes(“//item”); for (int i=0; i<items.count && i<numtodisp; i++) { string author=””; xmlnode authornode = items[i].selectsinglenode( “*[local-name()=author or local-name()=creator]”); if (authornode != null) author = authornode.innertext; sb.append(string.format( “• <a href={0}>{1} ({2})</a><br/>”, items[i].selectsinglenode(“link”).innertext, items[i].selectsinglenode(“title”).innertext, author)); } } entrieshtml.text = sb.tostring();}</script><style> <!– styles omitted for brevity –> … </style><div class=”title”>unug blogs</div><asp:literal id=”entrieshtml” runat=”server”></asp:literal>