Live data from Hacker News

When XML Beats JSON: UI Layouts

engineering.instawork.com

31–40 of 274 posts

Re: When XML Beats JSON: UI Layouts

#31
The XML example seemed odd to me as written. In the JSON case, yes there was a prefixed key "$reports", but it told me what the relationship was. Looking at the XML, what does it mean for an Employee to be nested inside another Employee?

Re: When XML Beats JSON: UI Layouts

#32
Interesting to see the history here: XML was created and solved a lot of problems. So on the bandwagon everybody jumps. Then it became bloated and fragmented, so the world switches mostly to JSON.

But on the XML side, the baby was thrown out with the bath water, while JSON started developing its own abuses. TOML and YAML come in and muddy the waters a bit more.

This is only 1 article, but maybe the world is ready to discuss the possibility that the pendulum swung too far?

Re: When XML Beats JSON: UI Layouts

#33

I have yet to read anything that convinces me that XML is good for anything . Just because XML in certain cases is less bad than some other cherry-picked technology, doesn't mean that there aren't other better options. See also Erik Naggum's legendary rant: https://www.schnada.de/grapt/eriknaggum-xmlrant.html

How about simple DSL layouts?

Do you mean a simple DSL for layouts?

Re: When XML Beats JSON: UI Layouts

#34
post #16

If XML is better at representing trees, and JSON is a tree, does that mean that XML is better at representing JSON than JSON?

Yes. Consider a comparison of examples using JSON schema: { "$schema": "http://json-schema.org/draft-04/schema#", "description": "Modified JSON Schema draft v4 that includes the optional '$ref' and 'format'", "definitions": { "schemaArray": { "type": "array", "minItems": 1, "items": { "$ref": "#" } } } ... Modified JSON Schema draft v4 that includes the optional '$ref' and 'format' array 1 ... $schema and $ref are di…

>$schema and $ref are differentiated by convention in JSON, and require repeated consideration in every parsing scenario to treat them as exceptions relative to actual values within the JSON document.

This is a good thing. The main issue with XML is how ridiculously overcomplicated and overengineered its design was. This isn't just a matter of usability, it has security implications because it increases the attack surface of anything that uses it (e.g. the XML billion laughs attack).

Re: When XML Beats JSON: UI Layouts

#36

The main reason that I use XML (occasionally) is because of XML Schema. It's a very precise data description that can be semantically verified. Otherwise, I try to use JSON, where possible, because I am not a masochist.

Does https://json-schema.org/ not work for you?

Re: When XML Beats JSON: UI Layouts

#37

XML is so awesome for UI layouts. I had a thesis that I worked on that was basically a subset of HTML (check the SMIL specification for something similar, albeit a bit more complicated, SMIL used to be a W3C recommendation). It was so easy to understand that every person who was able to use a computer would pick it up quickly. This was not the case for HTML, my guess is because there are a ton of HTML tags and that c…

> It was so easy to understand that every person who was able to use a computer would pick it up quickly.

I find this hard to believe. I know many people who use computers but are not IT professionals or even hobbyists. Without an easy to use GUI they can't accomplish much. I couldn't imagine them picking up anything to do with XML.

If you scope it down to UI developers you're taking less than 1% of people. Far from everyone. Even if you scope it down to IT people it's less than 1% of people.

Post reply on HN