Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I did think that the criticism of XML for being hard to parse was a bit odd. Although I generally prefer JSON for simpler stuff XML is pretty easy to parse and sift through with XPath.


It has to do with the awful XML generated by automatic tooling (SOAP by WCF and JEE).

Hand-generated XML can be just as nice as using hand-generated JSON, and on the other hand automatic domain-model-to-JSON mapping can be as ugly as any XML monstrosity.


Most languages have the concept of arrays and hashes, which map unambiguously & idiomatically to JSON via generic serializers.

Creating idiomatic XML, on the other hand, is a little more tricky. Should something be a tag or an attribute? What should it be named?


Though for the same dataset, XML will be slower to parse. For performance's sake use JSON.


> Though for the same dataset, XML will be slower to parse. For performance's sake use JSON.

Loading a huge JSON file is almost certainly slower than using a SAX parser for a huge XML file. Maybe there are SAX like approaches for JSON, too.


Yes, it's called "streaming". Like in XML, you can also used a mixed approach. See e.g. https://sites.google.com/site/gson/streaming


I suspect that depends a lot on what platforms are used at the client and server.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: