I finally got DasBLog up and running on Blobservations and decided that I wanted to import all of my old content from Blogger.com. I figured that this challenge had to have been overcome in the past, so I hit MSN Search and Google with keywords like: Import Export DasBlog Blogger. I located a few half-baked tools (as-in, not quite ready for prime-time). Some didn’t support titles, other wouldn’t grab the links. Most of them could easily blame their failings on the fact that they were attempting to use the underpowered Blogger API.
I hacked around a little, trying to implement a simple ATOM API client in C#, and to do a fully automated conversion tool, but eventually I decided to drop back and punt. I only needed to do this one time, so a little manual intervention would be acceptable.
I ended up following these steps:
1. Change Blogger.com settings, under “Formatting” tell it to show 999 days on the front page. DO NOT PUBLISH
2. Modify your blogger template to:
<?xml encoding=”utf-8″ ?>
<entries>
<Blogger>
<bi_url><![CDATA[<$BlogItemURL$>]]></bi_url>
<bi_title><![CDATA[<$BlogItemTitle$>]]></bi_title>
<bi_body><![CDATA[<$BlogItemBody$>]]></bi_body>
<bi_author><![CDATA[<$BlogItemAuthorNickname$>]]></bi_author>
<bi_date><![CDATA[<$BlogItemDateTime$>]]></bi_date>
</Blogger>
</entries>
3. DO NOT PUBLISH, instead hit the “Preview” button
4. In the resulting screen, you’ll see a bunch of unformatted text. Select “View Source” and then copy everything from the opening <? xml ?> tag down to the closing <entries> tag. Paste that text into notepad and save as archive.xml. On the edit screen, hit the “Discard Edits” button. Go back and restore the settings from step 1.
5. Warning, very rough C# code ahead. The following is snipped from the C# program I threw together to convert from the raw xml to Dasblog. It uses some classes from the DasBlog engine, so you’ll have to add a reference to the newtelligence.DasBlog.Runtime.dll file if you want to try this yourself. Before running, make sure that the directory c:content exists.
{
DataSet ds = new DataSet(“archive”);
ds.ReadXml(@”{insert directory to archive.xml file}archive.xml”);
string title=””;
string body=””;
string link=””;
string date=””;
string auth=””;
DateTime dt_post;
newtelligence.DasBlog.Runtime.IBlogDataService das_ds = newtelligence.DasBlog.Runtime.BlogDataServiceFactory.GetService(@”c:content”, null);
foreach(DataRow r in ds.Tables[0].Rows)
{
title=(string)r[“bi_title”];
body=(string)r[“bi_body”];
link=(string)r[“bi_url”];
date=(string)r[“bi_date”];
auth=(string)r[“bi_author”];
dt_post=DateTime.Parse(date);
Entry post = new Entry();
post.Author = auth;
post.Content = body;
post.Description = “”;
post.Title = title;
post.CreatedLocalTime = dt_post;
post.CreatedUtc = dt_post.ToUniversalTime();
post.ModifiedLocalTime = dt_post;
post.ModifiedUtc = dt_post.ToUniversalTime();
post.EntryId = Guid.NewGuid().ToString();
das_ds.SaveEntry(post);
}
}
6. After running, you should have a bunch of xml file in the directory c:content. Just upload or copy these to DasBlog’s “content” directory and the posts should show up under DasBlog. I think I may have had to create and delete a new post to make them show up.
If you have any questions, feel free to email.
Update 6/16/2005: Ryan Jones has implemented a dotText to DasBlog and Livejournal to DasBlog content conversion using similar code.
Update 7/13/2005: Ben Scheirman emailed me about some difficulties he was having, and we figured out that you have to have the Timestamp Format configured a certain way for the blogger template to work. This image shows the relevent setting:

Ben is also putting together a GUI to assist with the conversion. I’ll post a link when he finishes it up.