About four years ago I wrote an article on the limitations of XML, I’m here to back that up with some numbers. All of the same issues apply to XML today as they did then. It is still a bloated format, still requires external libraries and still takes plenty of code to parse.
Our search at Maya’s Mom runs on Lucene/Tomcat and was returning XML to PHP over HTTP. I’m not quite sure my initial decision on this, probably so used to hearing Java with XML over HTTP it sounded fine at the time. Since we are working on improving our search and always one for embracing change, we switched Lucene to return JSON.
Now instead of using an external library and several routines to parse the data, it is done with the PHP JSON module and one command: json_decode(). The JSON module is a C module built in to PHP, which is one reason it is much quicker. The decode converts the data straight to PHP objects and arrays. One stroke done.
deleting code is even better than writing code
Converting to JSON removed over 200 lines of code, which deleting code is even better than writing code. Your mileage will obviously vary, during the conversion there was some code clean up and refactoring
Speed Improvements: a round trip query and parsing in XML was 400+ milliseconds; now reduced to less than 20 milliseconds, a 20x improvement!
To me, there is no comparison.