Is Html5 Valid Xml

HTML5 is not based on SGML, so what is it based on then?

The HTML5 standard specifies two serializations of HTML5: "html" and "xml". "xml" is a valid XML serialization (which in turn is a subset of SGML). "html" is not based on any specific serialization standard anymore, it has its own complete serialization. Herein lies the difference: HTML4 has a "sgml" serialization and "xml" serialization (called XHTML 1.0)

Of course HTML5 is for a large part based on HTML4 (based on SGML) and XHTML (based on HTML4 and XML).

Also see the history section of the HTML5 specification

Is there an xhtml.xsd equivalent available for HTML5?

HTML5 does not have a doctype definition or an XML schema definition. This is because, although it shares the same syntax as its predecessor HTML 4, HTML5 itself is neither based on SGML nor XML. It's a markup language in its own right.

If you are looking to implement a browser with HTML5 capabilities using Mozilla technologies, the latest version of the Gecko layout engine supports HTML5. Get the Gecko/XULRunner SDK here.

HTML 5 and XHTML 1.1

Do not confuse XHTML and HTML.

XHTML is HTML ruled to be a valid XML document. Actually the XHTML 1.1 standard does not apply to HTML 5 but to HTML 4.01.

What does it mean? You can pick a valid XHTML 1.1 document and it'll be a valid HTML 5 document but the counter-part is not always true. For example:

<button disabled></button>

It's valid HTML code (it doesn't matter which version) but it's not a valid XML statement (then it's not a valid XHTML document) because of the empty attribute. World is full of these examples (just Google), HTML is very relaxed about syntax (and HTML 5 didn't change this direction) and there are some other differences too (here, for an example). Moreover the HTML 5 standard introduced new tags that aren't part of XHTML 1.1 standard so a fully featured HTML 5 document (despite the syntax) won't be a valid XHTML 1.1 document.

References

Here a short list of good reference about this topic, selected from SO answers:

  • HTML/XHTML and MIME type: a short answer about content type and markup syntax.
  • All-in-one about HTML and XHTML: a long list of QA that covers different aspects of HTML/XHTML compatibility.
  • What to use: a question about what is better to use between HTML and XHTML (of course the answer is it depends but the answer itself is good).
  • XHTML/HTML for mobiles: some nice tips about HTML5/XHTML with Apple's devices.

Does HTML conform to the XML specification?

No, it won't.

HTML 2 through 4.x were SGML applications, not XML applications. (HTML+ might also have been an SGML application, it isn't clear from a brief skim of the specification)

HTML 5 has its own parse rules.

(XHTML and the XML serialisation of HTML 5 will be XML though)



Related Topics



Leave a reply



Submit