Serve up syntactic XHTML5 using the text/html MIME type?

Posted by cboettig on Pro Webmasters See other posts from Pro Webmasters or by cboettig
Published on 2012-10-12T17:55:34Z Indexed on 2012/10/12 21:49 UTC
Read the original article Hit count: 187

Filed under:
|
|

I have a site currently written with HTML5 tags. I'd like to be able to parse the site as XML, with support for namespaces, etc, to facilitate programmatic extraction of data.

Currently I have <!DOCTYPE html> and

<meta charset="utf-8">

Which I gather is equivalent in HTML5 to explicitly setting the content-types as

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

for my current setup. In order to serve XML it sounds like the right thing to do is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Should I also change my Content-Type to

<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />

Or is that not necessary? What is the advantage of having content-type be "application/xhtml+xml"? What is the disadvantage? (Sounds like it may break internet explorer rendering of the site? but maybe that information is out of date now?)

Many thanks!

© Pro Webmasters or respective owner

Related posts about html5

Related posts about Xml