Saturday, July 05, 2008

Best reason to use XML for casual writing: diffing

I've been experimenting with using an XML system to do my fiction writing. I started a story where I'm doing the draft in XML. I didn't do this lightly, and I would until recently have advised anyone who asked that XML was too much trouble for short or one-off projects. I use one all the time at work, and I still would have said that. Two things changed my mind: the XMLmind editor, and the Dopus system.

Dopus is a system that makes installing a DocBook-based XML system dead simple, and XMLmind is a free XML editor with a usable GUI and built-in support for DocBook XML.

Those tools made it possible for me to set up a home system without a lot of effort, and then edit the files in a GUI similar to an ordinary word processor. Plus, DOPUS includes support for RTF output, so that meant I could convert the XML to something a publisher might expect.

At the moment, I'm not using many XML elements; I don't need them. I'm using the DocBook article document type, because I'm writing a short story and that seemed to fit best. I've done some very minor customizations to the output...things like making elements disappear, so that I can have hidden text notes in my source. I love that.

But the deal clincher was this weekend, when I had some trouble getting net access. I hadn't updated my home files with the ones from work, and I'd worked on the story file during a lunch break. So ordinarily, I wouldn't want to edit the story file, if I'd been using a word processor file.

I still didn't want to edit my file, because of the way I merge changes between home and work. But I made a copy of my original file, and then when I sat down today after having synced my home and work file trees, I simply used a diff tool to compare the old and new files. It was easy to move the new text to the older file, while retaining the changes I'd made in the old file.

I often daydream about developing special XML elements for use in stories...things that would store the chronology of the story, or mark character names for retrieval. I kind of hope I never get around to any of that, because I think I'd use markup as an excuse to avoid writing new stuff. But having all of your data in easily-manipulable text format, and yet being able to output it as RTF, PDF, or HTML, is a big win.

No comments:

Post a Comment