I was recently asked “Why XML, rather than a .CSV (Coma Separated Values) file”, and no one had an answer beyond “It’s what we do now”.
(After stalling for a few seconds) I answered “flexibility”.
When, in a CSV file, you add a new element, or changed the order even slightly, any application reading that file would have to be changed or it will fail. Using XML, when you introduce a new element for such and such a purpose, any existing applications (should) ignore that element and continue working on the data it knows about.
This will allow you to produce 1 file for multiple uses, as opposed to a different file for each use, and allow both gradual changes and re-use as needed. Since so much work starts as ad Hoc and temporary, but stay around for a long time (Zombie systems! just in time for halloween) , this is not a minor issue.
Tim Bray – co inventor of XML – talks about Why XML Doesn’t Suck and mentions other reasons including: Internationalization, Interoperability, and Longevity, which are additional kinds of flexibility (flexible People to People Communications, flexible Machine to Machine Communications, flexible Future usages), with some self documenting.
HOWTO Avoid Being Called a Bozo When Producing XML, is a great guide when writing your own XML documents, before you make the common mistakes, and cause all of us grief.