this post was submitted on 24 Jan 2026
57 points (92.5% liked)

Programming

24685 readers
152 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
 

There exists a peculiar amnesia in software engineering regarding XML. Mention it in most circles and you will receive knowing smiles, dismissive waves, the sort of patronizing acknowledgment reserved for technologies deemed passé. "Oh, XML," they say, as if the very syllables carry the weight of obsolescence. "We use JSON now. Much cleaner."

you are viewing a single comment's thread
view the rest of the comments
[–] atzanteol@sh.itjust.works 4 points 2 days ago (2 children)

This is your confusion, not an issue with XML.

Attributes tend to be "metadata". You ever write HTML? It's not confusing.

[–] Feyd@programming.dev 13 points 2 days ago* (last edited 2 days ago) (1 children)

In HTML, which things are attributes and which things are tags are part of the spec. With XML that is being used for something arbitrary, someone is making the choice every time. They might have a different opinion than you do, or even the same opinion, but make different judgments on occasion. In JSON, there are fewer choices, so fewer chances for people to be surprised by other people's choices.

[–] atzanteol@sh.itjust.works 2 points 2 days ago* (last edited 2 days ago)

I mean, yeah. But people don't just do things randomly. Most people put data in the body and metadata in attributes just like html.

[–] Ephera@lemmy.ml 3 points 2 days ago (1 children)

Having to make a decision isn't my primary issue here (even though it can also be problematic, when you need to serialize domain-specific data for which you're no expert). My issue is rather in that you have to write this decision down, so that it can be used for deserializing again. This just makes XML serialization code significantly more complex than JSON serialization code. Both in terms of the code becoming harder to understand, but also just lines of code needed.
I've somewhat come to expect less than a handful lines of code for serializing an object from memory into a file. If you do that with XML, it will just slap everything into child nodes, which may be fine, but might also not be.

[–] atzanteol@sh.itjust.works -1 points 1 day ago (1 children)

Having to make a decision isn’t my primary issue here (even though it can also be problematic, when you need to serialize domain-specific data for which you’re no expert). My issue is rather in that you have to write this decision down, so that it can be used for deserializing again. This just makes XML serialization code significantly more complex than JSON serialization code. Both in terms of the code becoming harder to understand, but also just lines of code needed.

This is, without a doubt, the stupidest argument against XML I've ever heard. Nobody has trouble with using attributes vs. tag bodies. Nobody. There are much more credible complaints to be made about parsing performance, memory overhead, extra size, complexity when using things like namespaces, etc.

I’ve somewhat come to expect less than a handful lines of code for serializing an object from memory into a file. If you do that with XML, it will just slap everything into child nodes, which may be fine, but might also not be.

No - it is fine to just use tag bodies. You don't need to ever use attributes if you don't want to. You've never actually used XML have you?

https://www.baeldung.com/jackson-xml-serialization-and-deserialization

[–] Ephera@lemmy.ml 2 points 1 day ago

Okay, dude, glad to have talked.