First, go read Doug Crockford's response to Dave Megginson's ode to S expressions.
I was shaking my head furiously (up and down) until I got to the end of Crockford's piece:
I think that Megginson demonstrated that it is hard to think about structure in XML. I hope I have demonstrated that it is easier to think about structure in JSON.
On this one, I think it depends on how you define “hard.“
Defining structure in most programming languages is much harder than doing it XML, as it's so easy to let interpretation/behavior leak into the representation/structure. You can do it with discipline, but the flesh is weak here for most of us.
Defining structure in XML is very doable, however, it does cause you to do some pretty unnatural things.
I find I can define structure much more efficiently against JSON than I can XML.
JSON has actually eclipsed S-expressions for me as the most obvious way to structure data. JSON effectively gives into the lure of alists and commits to them in a pretty obvious way.
Also, in both JSON and S expressions, the concrete syntax is so trivial (and orthogonal to the model) that it doesn't really get in my way.
I can't say the same for XML. Rather, I get into problems around attribute/element non-composability, atomic data typing, weird limitations on string literals (e.g., legal Unicode characters that cannot appear in values), and occasionaly the verbosity (I'm pretty immune to this but when I show XML values to colleages they run screaming).
None of these problems make defining structure in XML “hard,“ but again, they illustrate how XML is rarely the shortest path from my brain to actual data.
Now, whether any of this matters, I'll defer to Dare :-)
Posted
Jan 27 2007, 01:33 PM
by
don-box