@renzev to Programmer [email protected]English • 2 months agoAI's take on XMLimagemessage-square140arrow-up11.26Karrow-down123cross-posted to: programmerhumor
arrow-up11.24Karrow-down1imageAI's take on XML@renzev to Programmer [email protected]English • 2 months agomessage-square140cross-posted to: programmerhumor
minus-square@[email protected]linkfedilink3•edit-22 months agoSince XML can have attributes and children, it’s not as easy to convert to JSON. Your JSON example is more akin to: <address street_address="21 2nd Street" city="New York" ...></address>
minus-square@[email protected]linkfedilink3•edit-22 months agoHmm, so in tree terms, each node has two distinct types of children, only one of which can have their own children. That sounds more ambiguity-introducing than helpful to me, but that’s just a matter of taste. Can you do lists in XML as well?
minus-square@[email protected]linkfedilink2•2 months agoNo arrays are not allowed. Attributes can only be strings. But the children are kind of an array.
Since XML can have attributes and children, it’s not as easy to convert to JSON.
Your JSON example is more akin to:
<address street_address="21 2nd Street" city="New York" ...></address>
Hmm, so in tree terms, each node has two distinct types of children, only one of which can have their own children. That sounds more ambiguity-introducing than helpful to me, but that’s just a matter of taste. Can you do lists in XML as well?
No arrays are not allowed. Attributes can only be strings. But the children are kind of an array.