HACKER Q&A
📣 mikercampbell

Why do we still build the web in XML?


I know that JSX and HTML aren't XML, but they practically are. Yes, there are template engines, and markdown, but they both transpile to HTML, and because of that they're forced or at least limited by it's basic "isms" of structure. Or have I not been using the right ones??

Sorry, I'm tired of closing

tags.


  👤 mindcrime Accepted Answer ✓

👤 jaredcwhite
The question is, why are you writing
tags? Between the wide variety of semantic elements now in HTML, and the ability to create your own via custom elements, the number of times you actually need to use divs—especially "div tag soup" that we unfortunately see all too often out in the wild—has dropped to nearly nil.

Viva la semantic and expressive HTML code!


👤 gjvc
Sorry, I'm tired of closing
tags.

Avoid this feeling of mental toil by using a text editor which does this for you.


👤 salamo
If you're worried that HTML is too verbose and therefore inefficient, that's not really an issue since it's going to be compressed in transit anyways. So then the question is, assuming that the compressed representation has the maximum information density, "what format should the decompressed web page be in". I think HTML is a pretty logical format to view the structure of the page.

There are definitely plugins for auto-closing your HTML tags that will make your life easier, though.


👤 gardenfelder
So, what would you suggest as an alternative?

XML fell out of SGML - trust me, you don't want to go there. So did HTML.

Also too: the IDEs I use always form closed tags. No effort needed.


👤 quickthrower2
HTML over the wire, but feel free to use YAML.

JSX may have solidified the XML markup style in the developer's toolbox though. Especially with server side rendering too.


👤 thesuperbigfrog
A better question is why Javascript is still being used:

https://www.destroyallsoftware.com/talks/wat

https://youtu.be/D5xh0ZIEUOE

Can't we just get WASM browser APIs and then do the web in whatever programming language we want?