3 ms·
HTML5 can be auto-translated into an XML surface syntax. You aren't losing anything compared to the old XHTML, though only the XML syntax can include content fr
by zozbot234 4y ago
HTML5 can be auto-translated into an XML surface syntax. You aren't losing anything compared to the old XHTML, though only the XML syntax can include content from other XML namespaces.
Google even cooperates with other search engines in promoting unified formats to "extract knowledge from in a scalable and reusable way", namely the schema.org standards.
- echelon 4y agoXHTML treated schemas as a first class order of business, though. It would require people to use extra effort to author a table of "address information" (or whatever). Maybe that would not have happened, but the format also suggested the building of reusable components, browser integrations for semantic understanding, and much more. The world it alluded to was much brighter for machine understanding and reusability.
- Devasta 4y agoData served in a tree structure and then rendered with client side templating with the ability to create custom elements... those crazy W3C eggheads in their ivory tower, why did they think anyone would want that? /s
- schemescape 4y agoIs the “can be translated into XML” part of the HTML5 spec? That would be interesting to me, and I wasn’t aware of it until your comment. Edit: sounds like it’s not a thing: > The DOM, the HTML syntax, and the XML syntax cannot all represent the same content. https://html.spec.whatwg.org/multipage/introduction.html#html-vs-xhtml https://html.spec.whatwg.org/multipage/introduction.html#htm...
- domenicd 4y agoThe non-translatable features are extremely niche, though. To continue the quote: > For example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM and in the XML syntax. Similarly, documents that use the noscript feature can be represented using the HTML syntax, but cannot be represented with the DOM or in the XML syntax. Comments that contain the string "-->" can only be represented in the DOM, not in the HTML and XML syntaxes. I.e. the big thing you'd fail to capture when doing an automated HTML -> parsed DOM -> XML trip is noscript tags. No big loss. Others I can remember are similarly tiny, e.g. some issues around textarea elements containing only newlines as their initial contents. Some discussion at https://html.spec.whatwg.org/multipage/parsing.html#parsing https://html.spec.whatwg.org/multipage/parsing.html#parsing Ctrl+F "roundtrip", although note that most of that is actually about what happens if you construct weird DOMs with JS and try to do a DOM -> serialized HTML -> reparsed DOM roundtrip. I think it's pretty safe to say in general that the procedure of "parse HTML to DOM, serialize to XML" will preserve everything interesting about a document. Especially if that document is already valid HTML.
- schemescape 4y agoAh, I thought those were just a couple of examples from a much larger set.
- gsnedders 4y agoPedantically, yes, there is a fair bit larger set, but they really only get more and more esoteric (and often things that are allowed within the HTML syntax but where the content would be non-conforming). For example: You can have an element called "foo:bar" in HTML, but you can't in XML-with-Namespaces-in-XML; likewise, you can have an element called "a\u0300" in HTML, but you can't in XML (and the set of possible element names is even more different if you're looking at an implementation of XML 1.0 4th Edition, which most are, rather than the much later 5th edition). You can't have a comment that contains "--" or ends with "-" in XML. (This is potentially the thing that comes up most often in real world content: people like doing <!------ DON'T TOUCH THIS ------>, which in HTML produces a comment whose value is "---- DON'T TOUCH THIS ----", which you cannot represent in XML.)