In theory, XML will be quickly good because of validation and what not. In practice, you cannot test the client side against a DTD or schema (or in most cases at all). Try it, you will see.
XML also suffers from verbosity and client-side consumption. If you do not plan to use XSLT or something else and directly consume the resulting package, you need to slice the data using the DOM, as done.
Finally, XML cannot be sensible until it is complete (at least on the client side), so you cannot perform partial validation. Although, to be fair, JSON will also have problems there, depending on how it is structured.
Given the consumption environment (mostly JavaScript), JSON has an obvious leg. There is a massive discussion of this choice, as well as other things like YAML data, CSV, base64, HTML snippets, etc. In chapter 4, Ajax: a complete reference ( http://ajaxref.com ), which is only on data types. Examples confirm ease of handling, especially in less well-known cases. If I were to select one JSON, it would be frank for some applications of small HTML fragments of Ajax (since it is slap and go) - a way to do this.
Chris neppes
source share