Remix.run Logo
reenorap 11 hours ago

I’ve hated XML since 2004. The worst part about it is the tags vs attributes fights. They both do the same thing and the only difference is preference. Having two ways of doing the same thing invite and incite religious positions and cause unnecessary fighting. There should be one, opinionated way of doing things so you avoid confusion.

jolmg 11 hours ago | parent | next [-]

> The worst part about it is the tags vs attributes fights. They both do the same thing and the only difference is preference.

They're not the same thing. If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not. If your XML document was processed by an application to convert to another type of document (PDF, etc.), and it didn't recognize a particular tag, it would be sensible for attributes to disappear, but inner content ("tags") to remain.

It's only seems like a preference thing if you look at XML as a structured data format like JSON is.

edflsafoiewq 11 hours ago | parent | next [-]

In data structure terms, attributes do allow nodes to be decorated with additional information without forcing any change on existing parsers. In JSON, this would require swapping, eg. "str" -> {"value": "str", "attrib1": "..."}.

xigoi 7 hours ago | parent | prev [-]

> If you look at it as the extensible markup language for documents that it is, "tags" (i.e. inner content) would be visible and "attributes" would not.

  <input type="text" value="Is this text visible?" />
2 hours ago | parent | next [-]
[deleted]
2 hours ago | parent | prev [-]
[deleted]
rf15 11 hours ago | parent | prev [-]

yeah it's not a good design to have tags have two sets of children: a Set of key-value children and then a List of tree object children.