In the last few months I started using DasBlog as my blogging engine, and I’ve really grown to like it. It’s so easy to use and make changes, and the best part is that all of my posts are stored in easy to transfer xml files.

I’ve been blogging for a few years now and I’ve used 2 different engines to host my blog. First I started at MSN Spaces, now known as Live Spaces. Then I switched to Blogger. I have over 300 posts on my blogger blog and I wanted to find a way to port those entries into my dasBlog. I did some reading and found a couple of helpful articles that helped me to put together a console application that I used to port 301 blogger entries to my dasBlog.

I started by Googling: “blogger to dasblog” and came across the following articles:

The first thing that I did was create a backup of my Blogger posts by replacing my current template with the following:

<bloggerEntries>
      <Blogger>
          <bi_entry>
              <bi_url><![CDATA[<$BlogItemURL$>]]></bi_url>
              <bi_title><![CDATA[<$BlogItemTitle$>]]></bi_title>
              <bi_body><![CDATA[<$BlogItemBody$>]]></bi_body>
              <bi_author><![CDATA[<$BlogItemAuthor$>]]></bi_author>
              <bi_date><![CDATA[<$BlogItemDateTime$>]]></bi_date>
              <BlogItemCommentsEnabled>
                  <BlogItemComments>
                      <bi_comments>
                          <bi_commentauthor><![CDATA[<$BlogCommentAuthor$>]]></bi_commentauthor>
                          <bi_commentdate><![CDATA[<$BlogCommentDateTime$>]]></bi_commentdate>
                          <bi_commentbody><![CDATA[<$BlogCommentBody$>]]></bi_commentbody>
                      </bi_comments>
                  </BlogItemComments>
              </BlogItemCommentsEnabled>
          </bi_entry>
      </Blogger>
  </bloggerEntries>

Next I changed my blog settings to show 999 posts on the main page.

Then I browsed to my blog http://mokhan.blogspot.com and saved the page as an “.xml” file.

The file looked something like this…

<bloggerEntries>
  <bi_entry>
      <bi_url><![CDATA[]]></bi_url>
      <bi_title><![CDATA[The Suburban Ghetto Cowboy]]></bi_title>
      <bi_body><![CDATA[Good Morning! Well yesterday was ...]]></bi_body>
      <bi_author><![CDATA[!~Mista mO~!]]></bi_author>
      <bi_date><![CDATA[6/08/2007 08:24:00 AM]]></bi_date>
      <bi_comments>
          <bi_commentAuthor><![CDATA[FallenAngel]]></bi_commentAuthor>
          <bi_commentDate><![CDATA[Saturday, June 09, 2007 8:07:00 PM]]></bi_commentDate>
          <bi_commentBody><![CDATA[I'll tell you where ...]]></bi_commentBody>
      </bi_comments>
  </bi_entry>

After I undid the changes I made to my blog, I forgot to mention that I made a backup of my blog template before changing it. So I changed my template back to the way it was then I changed the number of posts to display on the main page.

Then I created a C# console application using the “newtelligence.DasBlog.Runtime.dll” assembly as a reference to my application, and I parsed out the blogger entries and created dasBlog ones. In the end the guts of my console application looks like:

private static void Main( ) {
      IList< IBloggerEntry > bloggerEntries =
          BloggerReader.Read( new Uri( Path.Combine( Environment.CurrentDirectory, "mokhan.blogspot.com.xml" ) ) );

      foreach ( IBloggerEntry bloggerEntry in bloggerEntries ) {
          new DasBlogWriter( ).Write( bloggerEntry );
      }
      System.Console.WriteLine( bloggerEntries );
      System.Console.WriteLine( bloggerEntries.Count + " Entries have been created!" );
      System.Console.ReadLine( );
  }

I could have updated it to take in the file path the xml file as a parameter to the console app, but this was kind of a throw away project for me. Next I’m on to parse out my Live Spaces posts to merge into my dasBlog.

I’ve attached the source for my C# bloggerToDasBlog app. It’s free to use and modify as you wish, feel free to give me credit if ya wish to do so!

BloggerToDasBlog.zip (320.32 KB)

comments powered by Disqus