For a while I've had people ask me how I did my photoblog and because I wrote it from scratch it's not really useful (and it's definitely "Me-ware": unusable to just about anyone but me). I always direct people towards Flickr but it doesn't have the photoblog experience quite like mine and other photoblogs.
This weekend I've been writing a tool called Flickr-Fu that grabs the RSS feed from Flickr and attempts to simulate the photoblog experience allowing a user to navigate forward and backward one photograph at a time. The RSS xml structure is extended by Yahoo with it's own namespace: http://search.yahoo.com/mrss - all such tags are given a "media" prefix to distinguish them from the structure of RSS 2.0. Using XPaths with .NET is pretty straight forward until you run into the namespace issue, at which point there is a class XmlNamespaceManager that you will need to tame in order to get the job done.
But before this point I was hitting my head against a wall: I could see the media:content tag that I needed to get the image URL but I could see no namespace associated with it! It doesn't follow as well-formed XML to have namespaces without some namespace URI but sure enough, Firefox was hiding the namespace URI. I pasted to IE and was able to get a proper reference to use with the XmlNamespaceManager. What a strange thing to display XML in a stylesheet but leave off the namespace references in the root element! Just to prove I'm not hallucinating, here's a screen cap:
Once the namespace issue was cleared up for me, the code was quite simple:
21 XmlNamespaceManager spaceManager = new XmlNamespaceManager(doc.NameTable);
22 spaceManager.AddNamespace("media", "http://search.yahoo.com/mrss");
23 linkToBig = xnItem.SelectSingleNode("media:content/@url", spaceManager).InnerText;
Flickr-Fu is a work in progress but you can have a look here.