In trying to convert this blog I had to knock up an application to read dasBlog dayentry files and write out a large RSS style wordpress import file.

Now I don’t do XML that often but when I do its been with simple XML so a quick “//Entries” XPath query and away you go.  However the dasBlog XML is done properly with lots of namespaces.

So when I’ve been doing my simple XPath query it returns nothing.  So for those having similar problems the solution is this.  You need a namespace manager.

Here is a quick code snippet that explains how you would use it.


XmlNamespaceManager mgr=new XmlNamespaceManager(xmlDoc.NameTable);

foreach(XmlNode innerNode in xmlDoc.SelectNodes(“//def:Entry”,mgr) )
    //Do things with innerNode;
    //Do more things

Simple as that.

tags: , , , ,