html5 in xml serialization mode

Joost van Meeteren

XHTML5 - links

Mathiasbynens.be - The XML serialization of HTML5, aka 'XHTML5'.

Blog.whatwg.org - XHTML5 in a nutshell.


Xhtml5.nl - DOCTYPE-declaratie HTML & XHTML.

Ascii.cl - HTML Codes Table.

XHTML5 - Introduction

Zero tolerance

XHTML5 does not allow "bad" HTML, HTML5 does. In that context XHTML5 follows the 100% strict rules of XHTML1.1.

Disadvantage. The use of XHTML5 has one big disadvantage. Every failure made in the markup language leads to a parsing error.

Advantage. Parsing errors show you you have made a mistake. People who like to use clean code make a good choice with XHTML5. As an alternative to HTML5.


Parsing error. <!doctype html>: lower case not allowed | <!DOCTYPE html>: upper case obligatory.

Not validated. <head>...</head> and <body>...</body> tags omitted.

Parsing error. <meta charset="utf-8"> not allowed | <meta charset="utf-8" /> obligatory.

Parsing error. <hr> not allowed | <hr /> obligatory.

Parsing error. </p> tag omitted | </p> tag obligatory.

Parsing error. ASCII HTML name &nbsp; not allowed | ASCII HTML number &#160; obligatory.

Validated. ASCII HTML name &amp; allowed | ASCII HTML number &#38; allowed.


Validated. <!doctype html>: lower case allowed | <!DOCTYPE html>: upper case allowed.

Validated. <head>...</head> and <body>...</body> tags omitted.

Validated. <meta charset="utf-8">: allowed | <meta charset="utf-8" />: allowed.

Validated. <hr>: allowed | <hr />: allowed.

Validated. </p> tag omitted | omitted </p> tag optional.

Validated. ASCII HTML name &nbsp; allowed | ASCII HTML number &#160; allowed.

Validated. ASCII HTML name &amp; allowed | ASCII HTML number &#38; allowed.

HTML5 - Example

HTML5 example:

<?php header("content-type: text/html;charset=utf-8"); ?>
<!DOCTYPE html>

<html lang="nl">


<meta charset="utf-8">




[ content ]



XHTML5 - Example

XHTML5 example:

<?php header("content-type: application/xhtml+xml;charset=utf-8"); ?>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="nl">


<meta charset="utf-8" />

<title>XHTML5 = HTML5 in XML serialization mode</title>



[ content ]



XHTML5 - XML parsing errors

Example of XML parsing error in XHTML5

Joost van Meeteren Websites
2002-2023 © Joost van Meeteren, Bennekom NL
Laatste update website: maandag 24 juli 2023 om 08:00