Hacker News new | ask | show | jobs
by jxramos 44 days ago
I'm curious, what exactly in the DOM is not XML-compatible?
2 comments

From long-lost memory, I think it's implicitly closed tags (e.g. img).
That is one, but not the only thing. Non-xml html is just generally more forgiving.

If you make a mistake and use incorrect syntax in html, the browser will do its best to recover. In xhtml, it would just completely fail. Which approach is better is debatable.

XML can handle implicitly closed tags, they call them "empty" in the spec here:

https://www.w3.org/TR/xml/#sec-starttags

Empty tags in XML are not implicitly closed. They require the explicit /.
XML can handle <img /> but not <img> followed by tagsoup (like HTML handles).
One thing I can think of is tag names being upper case in HTML and lower case in XHTML in the DOM.