In Defense of XML

Posted by Martin Vilcans on 11 September 2007

It's popular to bash XML these days. After the inital hype several years ago, the pendulum has swung and now many software developers see XML as an abomination. Much of the criticism surely comes from bad experiences where XML was used for things it wasn't suited for, but much of the criticism is valid. XML was designed to be human readable, which is a goal that is only half fulfilled. XML documents are readable, but they tend to look like a mess. Editing them by hand requires too many keypresses. While not being human-friendly, XML is not very computer-friendly either. It's difficult to make a 100% compliant and fast parser and XML documents contain lots of redundancy, using more bandwidth and storage space than necessary.

But for all its faults, we must not forget the merits of XML. XML is widely known and accepted. It has plenty of tools. There are standard APIs for reading, writing and manipulating XML files. It is flexible enough to hold many different kinds of data. Compare this to the not very standardized de facto "standards" that were popular before it: Windows ini files, Java .properties, CSV and COBOL-style fixed length records. While these formats should be preferred to XML in some cases, none of them comes close to XML's flexibility and extensibility.

I recently read Bruce Eckel's blog post Creating Flex Components, which is a good introduction to Flex development. In Flex you describe your applications or components in an XML format called MXML. (It is also possible to avoid the XML and just code everything in ActionScript instead.) The comments to Eckel's post derailed into a discussion about the merits or lack of merits of XML. The single most obvious problem people see with XML is that it is ugly. Someone said it looks like cat's vomit. I agree. Still, it is a problem that can be solved.

Just as Eclipse and IDEA takes editing Java code from tedious to enjoyable, a good XML editor should make it easy to view and edit XML documents. Even though I hate editing XML in a plain text editor, I haven't gotten around to evaluating any of the many XML editors that exist out there (except for the terrible one I tried several years ago). What I am hoping to find is an editor that hides the ugliness of XML and simplifies editing it. Does anyone have any recommendations?

While XML has other faults, if we can look past its ugly looks, I think we'll be able to appreciate it better.

Previous: New One Screenshots and Video
Next: Out of Office AutoReply

Comments disabled on this post.