3 ms·
> It seems unlikely to me that JSON could reasonably be purposed to those use cases... Since any XML document can in theory be converted into a complete JSON r
by Udo 16y ago
> It seems unlikely to me that JSON could reasonably be purposed to those use cases...
Since any XML document can in theory be converted into a complete JSON representation I do believe that nothing is keeping people from doing exactly those use cases. You're right in asserting that this isn't happening in practice with JSON. I allege the reason for this is that XML isn't really used for these kinds of operations either. Sure, the XML working group put out a stunning amount of "standards" that prescribe these conventions, but in practice NONE of it actually works across vendors without heavy intervention and some pretty shocking compromises in application code. Most complex XML products are not actually that interoperable, they mostly just work because one or more communication endpoints are basically faking compliance of their interfaces.
- roel_v 16y ago"Since any XML document can in theory be converted into a complete JSON representation" How? (apart from a char array...)
- prodigal_erik 16y agoA DOM is just a tree of nodes, each of which has a fixed set of fields based on its type. That makes it automatically doable if you throw enough collections of key-value pairs at it: # <a href="http://example.com">hello world</a> { "node-type":"element", "namespace":"http://www.w3.org/1999/xhtml", "name":"a", "attributes":[ { "namespace":null, "name":"href", "value":"http://example.com" } ], "children":[ { "node-type":"text", "value":"hello world" } ] }
- roel_v 16y agoOh ok, yes. I think I may have misunderstood the original claim then, I thought the GP was saying that JSON had mechanisms to express all xml functionality. BTH though this still only makes sense with the XML spec laying next to it and is just notation. Maybe I'm not getting the point of the discussion, I'll just let it be ;)
- prodigal_erik 16y agoYeah, there's no agreed convention on how the infoset of an XML document (which I should have used rather than DOM) ought to be represented in JSON, and generally people don't do it (e.g., RDF/JSON isn't a direct mapping from RDF/XML, but a new format to express the same basic facts), it's just technically possible.