My latest favorite Java APIs: XML{En,De}coder

One of my little quirks is that many of the things I write use their own private file formats. I tend to not use things like XML because for the straightforward things I do most often, rolling my own reader/writer is often easier than wading through the XML APIs. They're great if you're doing something complicated, but usually I'm not. So I recently decided to take java.beans.XMLEncoder and XMLDecoder out for a spin. What a great experience! They made life so much easier. One of the things I had heard from folks as a problem with these APIs is that they don't work well if your objects aren't well-formed beans and can't be completely constructed/examined using bean properties. I decided, after a little pain, that this problem was a feature: after I converted over to use XML??coder, not only could I delete a whole bunch of IO code, but my objects were much better structured.

Take them out for a spin some time.

July 27, 2003