Live data from Hacker News

When XML Beats JSON: UI Layouts

engineering.instawork.com

51–60 of 274 posts

Re: When XML Beats JSON: UI Layouts

#51
Good thing we've had XML defining layouts for many years, despite many of the technologies that used the pattern being dead. XML as a layout definition vs XML as data were topics devs discussed heavily 15 years ago, too. So many Java frameworks used Xml to describe the user interfaces (like JavaServer Faces, early Tapestry, etc.). At one time, I worked with a lot was Adobe Flex which used MXML to define user interfaces [1], don't forget about Microsoft's XAML.

It's actually amazing to me how many of Flex's great ideas live on in other frameworks not dependent on the Flash Player, and looking at some modern day React often reminds me if it.

[1] http://flex.apache.org/doc-getstarted.html

Re: When XML Beats JSON: UI Layouts

#52

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…

I’ve been around long enough to use them all. I’m pretty happy with JSON as a debuggable serialization format for machine-to-machine or light machine-to-human use cases. YAML works well for human-to-machine (JSON could fill this use case as well if it would support comments and multi line strings). I don’t use TOML much, and good riddance to XML.

Re: When XML Beats JSON: UI Layouts

#53
post #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?

I don't know JSON schema really well; Can you say you want a `price` value to be a non-negative decimal value with at most two digits after the comma, and you want the `currency` value be exactly one of the following : "EUR", "USD", "GBP", the default if not specified being "EUR"?

Re: When XML Beats JSON: UI Layouts

#54
post #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…

It’s not that they can’t. They’ve just been told they can’t.

I’ve been told that clerks at bell labs were using troff because they were told they weren’t programming and I think GUIs have the same opposite effect.

Re: When XML Beats JSON: UI Layouts

#55
post #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…

There’s the always forgotten type of computer users: those who use computers for productivity. People who need to achieve some business goal and they have the energy to learn.

Take for instance insane Excel spreadsheets glued with VBA powering entire businesses, built by accountants and other professionals.

Re: When XML Beats JSON: UI Layouts

#56
post #50

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

Well, for instance, let's take the HTML code of your comment (which happens to be a valid XML document): 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/grap…

The HTML doesn't represent the classes properly. The LaTeX would take a simpler approach:

    \begin{spanned}
       I have yet to read \textit{anything}...
    \end{spanned}
Since there's no Javascript, probably no need for the class variables. And, of course, you can just write your own macros as you need them.

Re: When XML Beats JSON: UI Layouts

#57

JSON is a data structure. XML is a text markup. Don't mix them up.

XML is also a transform specification with XSLT (https://en.wikipedia.org/wiki/XSLT).

XML is also a query language with XQuery (https://en.wikipedia.org/wiki/XQuery).

XML is also a nested structure path specifier with XPath (https://en.wikipedia.org/wiki/XPath).

XML is also a file format with SVG (https://en.wikipedia.org/wiki/Scalable_Vector_Graphics), OpenOffice XML (https://en.wikipedia.org/wiki/OpenOffice.org_XML), OpenDocument (https://en.wikipedia.org/wiki/OpenDocument), ePUB (https://en.wikipedia.org/wiki/EPUB), DocBook (https://en.wikipedia.org/wiki/DocBook), and many others (https://en.wikipedia.org/wiki/List_of_XML_markup_languages).

XML is also an data/object serialization format with libraries like Jackson (https://github.com/FasterXML/jackson), YAXLib (https://github.com/sinairv/YAXLib), Boost (https://www.boost.org/doc/libs/1_38_0/libs/serialization/exa...), Pyxser (https://github.com/dmw/pyxser), and many others.

XML may not be as elegant as JSON, but it has a wide variety of uses and wide adoption across many programming languages (libraries), and disciplines.

Re: When XML Beats JSON: UI Layouts

#58

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…

As someone who has only used html (as in, no other xml-based UI), I'm really curious why it's necessary to even define the tags at all. Why not allow authors to define their own names? Like Then internal functionality can be attached to each element via attributes, like how aria roles work.

This already exists. They are called custom elements.

https://html.spec.whatwg.org/multipage/custom-elements.html#...

https://github.com/w3c/webcomponents/

https://developer.mozilla.org/en-US/docs/Web/Web_Components/...

Re: When XML Beats JSON: UI Layouts

#59

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…

As someone who has only used html (as in, no other xml-based UI), I'm really curious why it's necessary to even define the tags at all. Why not allow authors to define their own names? Like Then internal functionality can be attached to each element via attributes, like how aria roles work.

The tags are defined so that there is reasonable default behavior. For example is used to label a form field. Clicking the label focuses the form field.
Post reply on HN