Some years ago I coded and used a custom blog engine, which used XML as a data store. The format of this XML file was completely unique to this engine, so it has always been too difficult to get this data into Blogger.
However, in June, Blogger offered up an export/import feature, which allowed users to backup and move posts around between blogger blogs. With this in mind I set about trying to import these old posts into Blogger.
Step 1: Identity the Blogger Import Format
I needed to work out what format the blogger import feature used. I tried to import my custom XML, which not surprisingly, didn’t work. So with the help of some guidance from the web, and an export of my current Blogger posts, I figured out the format I required.
Step 2: Transform my custom XML into Blogger XML
I needed to transform my custom XML format into the Blogger import format (essentially an ATOM feed). The easiest way to do this seemed to be to use XSL. I hacked together a simple XSL document to transform the custom XML into valid Blogger XML.
Step 3: Create a mechanism for performing the transformation
I created a simple HTML file that would load the custom XML file, transform this into the Blogger ATOM feed and then save it to disk.
Step 4: Import the custom posts into Blogger
I imported the Blogger ATOM feed into the Draft Blogger website, using their import tool. I noticed that several of the posts seemed to have weird characters, and realised that I has an encoding problem.
Step 5: Force the encoding of the output file
I forced the file to be stored in a UTF-8 encoding, to preserve some of the characters that ASCII doesn’t support.
Step 6: Edit and publish imported posts
I went through and editing the posts I wanted to edit and then published everything into this blog.
Get the code
If you have a similar problem, where you have XML in one blog format and want to import into Blogger, I have put together a simple example for transforming the XML as a download, which you can download and use.