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.
How? (apart from a char array...)
# <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"
}
]
}
Now the standards can totally suck - they can be improperly implemented - and they can be difficult to make performant... But those are largely issues of implementation unrelated to the core XML and XML namespace specifications.
It seems unlikely to me that JSON could reasonably be purposed to those use cases...