Exporting BlogML from Subtext 2.1 and importing BlogML into WordPress 2.7

I currently run by blog using Subtext and I’ve been wanting to test out some features in WordPress for a while.  So naturally I don’t want to lose all of my blog posts and I’m not keen to write a whole bunch of code to read from the one database and write to the other.

Fortunately Subtext has the ability to export to BlogML and WordPress apparently has the ability to import from anything (if you believe the rumors)  Unfortunately both the export and the import don’t really work.

Firstly, Subtext’s export doesn’t work. BUT since I had started my day thinking about moving from Subtext to BlogEngine.Net, I’d found a forum post where a friendly person showed how to make SubText export to BlogML successfully (Its the post by Harold on 2 Dec 2008).  He links to the binary of SubText.BlogML.dll – you just replace the one on your site (make sure you have a backup of your version, just in case there’s some issues with newer versions of Subtext)

Now for the import part – Thankfully Aaron Lerch had handled this back in WordPress 2.3 in his post about moving to WordPress from Blogger.   The important thing for me was his BlogML importer.

There are a few things that seem to have changed.  Aaron’s post uses “XPath.class.php” which you can get from Sourceforge.  It suggests that you put the file in the /wp-admin/import folder, but that just seems to cause issues.  So I’m going to lay out the steps that I took over here:

  1. Download “XPath.class.php
  2. Put the file in your /wp-admin/ folder
  3. Edit /wp-admin/admin.php and add a line at line 27 so that the file looks like:
    require_once(ABSPATH . ‘wp-admin/includes/admin.php’);
    require_once(‘XPath.class.php’);
  4. I’ve modified Aaron’s blogml importer and you can get blogml.php.
  5. Upload it to your /wp-admin/import folder

The original blogml had a few issues:

  1. It couldn’t handle   or > or even < in any of the blog posts
  2. Categories were not imported correctly at all
  3. It didn’t, and still doesn’t, handle draft posts at all.
  4. It didn’t work with WordPress 2.7

I managed to fix the problems with the escaped html, the categories and the WordPress 2.7 issues, but didn’t quite get to fixing the issue with the draft posts.  Let me know if you manage to fix that part – I only had one draft post so it didn’t really matter.  Hopefully this will help someone else though.

One thought on “Exporting BlogML from Subtext 2.1 and importing BlogML into WordPress 2.7

Leave a Reply

Your email address will not be published. Required fields are marked *