Frank Sommers
Posts: 2642
Nickname: fsommers
Registered: Jan, 2002
|
|
Re: Brett McLaughlin: What is XML Really Good For?
|
Posted: Feb 21, 2007 8:04 PM
|
|
My perspective about XML changed perhaps in the opposite direction to others' who commented before. I used to really dislike XML, thinking it was just a terribly verbose way to define data. I couple of things happened that made me change my mind, and to think now that XML is actually pretty useful for both data storage and data interchange.
The first is the emergence of excellent APIs in almost every language I know of. Recently, for instance, I was looking into ActionScript (EcmaScript, really), and it supports E4X, which is a nice way to slice and dice XML data, perhaps convert that XML into objects and back. In Java, there are so many outstanding APIs for XML that working with XML documents is not the pain it used to be.
Another reason I changed my mind is that processing XML is actually quite fast now, thanks in part to the API implementations, but also to the fact that computers are just faster in general, networks are faster, and storage is plentiful.
But the main reason I tend to think of XML in milder ways is because the alternatives for certain kinds of uses are not very attractive.
One example is data persistence. Having now worked with a variety of application domains, I have to say that lots of domains deal with truly hierarchical data, and people tend to shoehorn that sort of data into relational schemas, perhaps because whether to use a relational database for persistence is not a question many ask. O/R mapping tools have alleviated the need to think about that shoehorning too much, since they can pretty painlessly project hierarchical data in a relational form, and vice versa.
For some kinds of databases, however, it might actually be better to think of XML as a hierarchical data projection, and bypass O/R mapping (either by generating XML directly from a relational database via XQuery, or by using XML-to-object serialization, as provided, for instance, by the excellent XStream library).
And even XML file storage for persistence may be an option in some cases. I recently spoke with some folks who work with XQuery a lot, and learned that working with several-gigabyte XML documents has become feasible with some XQuery implementations, and that it's even faster in some cases than generating equivalent relational queries, because the XML can be indexed, too.
Also, for configuration, what scares me about formats that rely on indentation is that one day someone opens up such files in Notepad and thereby removes all those nice indents, effectively destroying the data. XML is a bit more durable in that regard.
|
|