Agreed. Even if the syntax is wildly different, the structure is similar.
This is where XML gets annoying. Sure, it does make sense in certain situations, but it quickly gets hard to map all the attributes and child nodes into a nice object.
Its easier to drill down to what you need without having to mess with arrays or attribute hashes or retrieving contents. (Retrieving contents is the worst part. Sure CDATA would theoretically help, but what do I do when the API I'm using ignores it? Parsing linebreaks, spaces, and empty tags becomes a hassle!)
I love JSON because it provides for one and only one correct way to serialize a particular data structure. With XML I always have to decide whether to use an attribute vs. content vs. child node for a particular piece of data. There's an enormous "impedance mismatch" between XML and pretty much any programming language, whereas JSON just feels natural.
8 comments
[ 0.23 ms ] story [ 27.0 ms ] threadThis is where XML gets annoying. Sure, it does make sense in certain situations, but it quickly gets hard to map all the attributes and child nodes into a nice object.
Its easier to drill down to what you need without having to mess with arrays or attribute hashes or retrieving contents. (Retrieving contents is the worst part. Sure CDATA would theoretically help, but what do I do when the API I'm using ignores it? Parsing linebreaks, spaces, and empty tags becomes a hassle!)
Damn you CDR-coding! selling out our jokes for petty cache.