renzev@lemmy.world to Programmer Humor@lemmy.mlEnglish · 28 days agoAI's take on XMLlemmy.worldimagemessage-square130fedilinkarrow-up11.25Karrow-down124
arrow-up11.23Karrow-down1imageAI's take on XMLlemmy.worldrenzev@lemmy.world to Programmer Humor@lemmy.mlEnglish · 28 days agomessage-square130fedilink
minus-squareClassifiedPancake@discuss.tchncs.delinkfedilinkarrow-up2arrow-down1·edit-227 days 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-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up2·edit-227 days 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-squareClassifiedPancake@discuss.tchncs.delinkfedilinkarrow-up2·26 days 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.