Changes in HTML 5 - <?xml?> Declaration
What's new in HTML 5
The <?xml?>
declaration was introduced in the 2000 W3C standard version of HTML. However, many documents on the web are still coded without it and therefore may fall back to the older 1997 HTML version 4 standard, so going forward you should make sure that any HTML pages start with an <?xml?>
declaration.
Differences between HTML 5 and earlier versions of HTML
- The
<?xml?>
declaration does not appear in HTML documents conforming to the 1997 HTML 4 standard. For the HTML versions based on the 2000-2010 Recommendations from the W3C HTML Working Group, the<?xml?>
declaration was optional. For HTML version 5 documents, it's use is recommended so that the document is handled properly when being parsed as either xHTML or pure XML. - Since there is no DTD in HTML 5, there are no external XML declarations that might change how the HTML document is processed. In previous versions of HTML, for example, a DTD could possibly change the default value of an HTML attribute. In HTML 5, things like default attribute values are always determined by the HTML specification.