clojure/data.xml — Issue #3: roundtrip xml
Author: sramsay
Created: 2012-01-22 23:17:31+00:00
State: open

I've been trying to figure out a way to roundtrip an XML file: read it into some kind of clojure structure, do something to it, and write it back out as XML. The emit function has been removed (or suppressed) from both clojure.xml and lazy-xml. Looking over this library, it seems to me that this library should work. In particular, this kind of call should work:

(xml/emit (xml/parse "somefile.xml") :encoding "UTF-8")

But that doesn't work for me, even when I create the simplest kind of somefile I can come up with.

Am I just thinking about this wrong? I see lots of ways to read XML into a clojure struct, and lots of ways to create a clojure structure and convert it XML. But I can't seem to find a roundtrip solution.

I know this won't qualify as an "issue" if I'm entirely off base, but thought I'd put in anyway.