<tag>
This text node contains <magic>unicorns</magic> and <magic>fairy dust</magic>.
</tag>There is (as far as I know) no sensible way to add the magic above in JSON or YAML.
<tag>
This text node contains <magic>unicorns</magic> and <magic>fairy dust</magic>.
</tag>There is (as far as I know) no sensible way to add the magic above in JSON or YAML.
The same can be applied to other formats like JSON and YAML: if it contains only text, use a string, otherwise use an array of strings or objects of some defined structure. Here’s one possible representation:
{
"tag": [
"This text node contains ",
{"magic": "unicorns"},
" and ",
{"magic": "fairy dust"},
"."
]
}
So I don’t consider what you describe to be a benefit of XML at all, except inasmuch as its syntax can be subjectively a little prettier.Curly brackets introduce an "object", whose fields are considered unordered. So you are not supposed to have multiple "tag". What happens if this is the case ... unspecified!
JSON is probably worse than XML here.
(tag "This text node contains" (magic "unicorns") " and " (magic "fairy dust"))Is that “allowing” for markup, or is it exactly what an Extensible Markup Language was intended and designed to do? I wouldn’t expect a JavaScript Object Notation to be able to do that ergonomically.
XML’s design as a markup language, and not an object or config language, is clear even in that example. The first character of the contents of `tag` is newline.
The author of this piece gets it fundamentally wrong in saying that “Enterprise” stink was the reason people abandoned XML. For enterprises that need those features, XML is still a fine format to use. But for most purposes, those features aren’t necessary, and the massive overhead that comes along with them makes it a bad tradeoff.
You have text with interspersed elements with the same name, how can this be represented in python other than a DOM?