I’m trying to migrate from a custom designed blog software system to a WordPress.com site. I can access my MySQL database of posts and comments without too much difficulty, thanks in part to this post: How do I connect to a MySQL database from Clojure?.
I think my next step is to generate the pseudo-xml file known as a “WordPress eXtended RSS file”, and that’s where I’m having difficulty. I can navigate my way through the recordsets returned from my database connection (as of now, I’m doing two SQL searches, one for posts, and another for comments, giving me two recordsets), but I don’t know what sort of data structure I should put those results into in order to eventually export them into the xml file.
I’ve been using a lot of file spit/slurps while working my way through this, but I have a feeling that’s neither the most efficient way to do it, nor the most “lispy” way.
I think what I need is help defining a clojure-based data structure that I can append both new posts and new comments to, iteratively, for eventual export into the xml file format I need it to finally get to.
Look at
clojure.xml/emit
andclojure.xml/emit-element
; they expect data that look as described in(doc clojure.xml/parse)
and walk this data to output XML.