3 ms·
In that case, you can use the appropriate XML format for the structured document content, then store than in a JSON string. Most of the time the "structured doc
by LeafStorm 14y ago
In that case, you can use the appropriate XML format for the structured document content, then store than in a JSON string. Most of the time the "structured document content" you're sending over AJAX is HTML or SVG, and the browser can still handle parsing and validating it.
- olavk 14y agoYeah, and it works fine. But it is hard to argue that JSON+XML is a simpler data interchange format than just XML. It might be better though, because the JSON and the XML is handled by different layers in the application anyway.
- jacobolus 14y agoSure it’s simpler: they’re used in two separate layers – each with its own purpose – which are consumed by separate components (and actually more, because when you send this down you’re of course wrapping it in HTTP and TCP &c.). For a better understanding of why this kind of design is simpler, and therefore better, I recommend Rich Hickey’s talk: http://www.infoq.com/presentations/Simple-Made-Easy http://www.infoq.com/presentations/Simple-Made-Easy Edit inre “more complex compound data exchange format”: No, the point is that this should be thought of as two simple protocols wrapped one inside the other, not one “complex” format. Watch Rich Hickey’s talk. It would be a complex format if the two layers reached across into each-other, if the consumption of one depended on the details of the other, etc. But if they’re kept properly separate, that’s not complex – by Hickey’s definition anyhow, and I think it’s an excellent definition.
- olavk 14y agoAgreed, the overall architecture may become simpler by choosing a more complex compound data exchange format.