Monday, February 12, 2007
Posted on Monday, February 12, 2007 8:57:11 PM (Mountain Standard Time, UTC-07:00)  Comments [1] | 
Categories: .NET | ASP.NET | Xml
In building ArcExperts.net, I wanted to create a simple blog roll from the OPML file that I was using to run the aggregator. For those not familliar with it, OPML is an xml "format" which describes a list of blogs. i.e...

<?xml version="1.0" encoding="utf-8"?>

<opml version="1.0">

  <head />

  <body>   

      <outline title="Dave Bouwman"

              xmlUrl="http://blog.davebouwman.net/SyndicationService.asmx/GetRss"

        htmlUrl="http://blog.davebouwman.net/"

        description="Software Development :: .NET - GIS - ESRI" />   

  </body>

</opml>


Before digging into this I did a little Googling and found an example where someone was using an XmlDataSource to do something similar. For grins I tried it and had a blog roll up in about 5 minutes. Here's how (download the source to skip the steps):

1) Create a new web project in Visual Studio 2005
2) Copy an OPML file into the root (get ArcExperts one here)
3) Add an XmlDataSource to Default.aspx
4) Point it at the OPML file. In the XPath box enter opml/body/outline
(this just tells it to bind to the outline elements in the file - which contain the items we want in our list)

5) Drop a DataList on the page, and set it's data source to the XmlDataSource

6) Add some markup so we get a nice list

7) Done - view your output and add more CSS to make it pretty


Maybe you all use this every day and are very ho-hum about it, but this was my first time using this, and I think it totally rocks.

Download the source code here