Categories
Geeky/Programming

How to Grab RSS feed using XMLDataSource in the Personal Web Site Starter Kit

So, I like I said earlier, I have been playing with the Personal Web Site Starter Kit (PWSK) in Visual Studio 2005 Beta 2. I read these two articles:

· Introduction to the Personal Web Site Starter Kit

· Extending the Personal Web Site Starter Kit

I wanted to see if I could get my blog feed on the main site under the “What’s New Lately� section on the main page (default.aspx). Well first, I took the atom.xml file from my blog, and got the URL. In the process of doing this exercise, I noticed I couldn’t get the Atom feed to work, so I found a site (FeedJumbler) to convert the Atom feed to straight RSS feed, which works.

Then I dragged the XmlDataSource item from the toolbox to the page under the ObjectDataSource that is there by default. If you set the datasource to the URL and the XPath to “rss/channel/item�

In the HTML code for default.aspx, if you add this code

<h4>My Blog Latest Posts</h4>

<asp:DataList ID=”DataList2″ runat=”server”

DataSourceID=”XmlDataSource1″>

<ItemTemplate>

<p>

<h5><%#XPath(“title”)%></h5>

<p>

<%#XPath(“description”)%>

</p>

Posted by <%#XPath(“author”)%> @ <%#XPath(“pubDate”)%>

<a href=”<%#XPath(“link”)%>“><i>Link</i></a>

<hr/>

</ItemTemplate>

</asp:DataList>

Then you should see your blog posts on your PWSK front page!

By Steve Novoselac

Director of Digital Technology @TrekBikes, Father, Musician, Cyclist, Homebrewer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.