renzev@lemmy.world to Programmer Humor@lemmy.mlEnglish · 2 months agoAI's take on XMLlemmy.worldexternal-linkmessage-square57fedilinkarrow-up136arrow-down10cross-posted to: programmerhumor@lemmy.world
arrow-up136arrow-down1external-linkAI's take on XMLlemmy.worldrenzev@lemmy.world to Programmer Humor@lemmy.mlEnglish · 2 months agomessage-square57fedilinkcross-posted to: programmerhumor@lemmy.world
minus-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up1·2 months agoI think we did a thread about XML before, but I have more questions. What exactly do you mean by “anything can be a tag”? It seems to me that this: <address> <street_address>21 2nd Street</street_address> <city>New York</city> <state>NY</state> <postal_code>10021-3100</postal_code> </address> Is pretty much the same as this: "address": { "street_address": "21 2nd Street", "city": "New York", "state": "NY", "postal_code": "10021-3100" }, If it branches really quickly the XML style is easier to mentally scope than brackets, though, I’ll give it that.
minus-squareClassifiedPancake@discuss.tchncs.delinkfedilinkarrow-up1·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-squareCanadaPlus@lemmy.sdf.orglinkfedilinkarrow-up1·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?
I think we did a thread about XML before, but I have more questions. What exactly do you mean by “anything can be a tag”?
It seems to me that this:
<address> <street_address>21 2nd Street</street_address> <city>New York</city> <state>NY</state> <postal_code>10021-3100</postal_code> </address>
Is pretty much the same as this:
"address": { "street_address": "21 2nd Street", "city": "New York", "state": "NY", "postal_code": "10021-3100" },
If it branches really quickly the XML style is easier to mentally scope than brackets, though, I’ll give it that.
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?