If you decided to store your data in a flat file (I mean not database etc.), then XML is the best choice. There are couple of advantages I can see:
- The magic of standard. XML is backed up by industry standards, and the methodologies to handle and process XML data, such as SAX and DOM, are also backed up by industry standands. You can expect lots of investment, including people and capital, being put into XML, and this determines that, XML related technologies will be evolving more quickly. You can expect your data could be easily accepted by lots of applications.
- Open up the door to future. It is reasonable for you to expect that XML related technology will be there for a long time. No technology will be there forever, especially in the IT industry, but new technologies, technologies that are still evolving but already have been largely accepted, like XML, would exist longer. (We are actually looking at the cost efficiency here. Less or same investment, but be there longer.)
- More easy to share data in a distributed environment. You can easily utilize things like SOAP, if your data is XML formated.
- Easy to validate. There are standard ways to validate your XML data, such like DTD, XML Schema etc. (Less development cost)
- Easy to transform your data into different format. We have things like XSLT etc. (Again less development cost.)
(To directly answer one of your questions above, if you want to modify the data, then you have to choose DOM over SAX. XSLT is also a good choice.)
I don't want be one-sided. Let's also look at the disadvantages:
- XML is an evolving technology, when this is an advantage, it is also an disadvantage. When you can expect XML and its related technologies be there for a long time, in a macro view. In a micro view, you will see new versions of things come and go quickly, today's new XML-related technologies might be obsoleted by other even newer ones very quickly. However the foundation will be pretty stable.
- If the amount of data you will be dealing with, is huge. You can expect some sort of performance issue, because of all the time spent on encoding/decoding. However it is the expectation that, more efficient ways of handling XML data is coming.