See this link on stack exchange[1].
[1] https://stackoverflow.com/questions/17604071/parse-xml-using...
> //Gets Street name xmlDoc.getElementsByTagName("street")[0].childNodes[0].nodeValue;
I’d much prefer something like jsonObj.address[0].street;. Personally I like to work with objects over parsing documents trees.
> XML, on the other hand, optimizes for document tree structures, by cleanly separating node data (attributes) from child data (elements).
Unfortunately, there appear to be some implementation issues here. You have to create a string version of your data to store them in attributes.
So, you lose a bit of context in the conversion.
Such as:
`<Document text="true" />`
Is the text attribute the word _true_ or a boolean _true_. Without referencing some other piece of code or definition there is no way to know.
Whereas in JSON, this wouldn't be necessary, as you can simply remove the quotes and infer that it is not a string, but a boolean.