Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML 5 Adding XML Namespaces

Can anyone tell me how you add additional XML namespaces to an HTML 5 document?

I'm trying to create an HTML 5 version of the following

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml">

Is it simply a case of dropping the xhtml namespace:

<html xmlns:og="http://ogp.me/ns#"
      xmlns:fb="https://www.facebook.com/2008/fbml">

Thanks.

like image 321
Neilski Avatar asked Jun 16 '11 13:06

Neilski


1 Answers

According to the WHATWG, in html 5 you are permitted to use the xmlns attribute on each html element as long as the namespace is http://www.w3.org/1999/xhtml (the namespace of the document)

Will there be support for namespaces in HTML?

HTML is being defined in terms of the DOM and during parsing of a text/html all HTML elements will be automatically put in the HTML namespace, http://www.w3.org/1999/xhtml. However, unlike the XHTML serialization, there is no real namespace syntax available in the HTML serialization (see previous question). In other words, you do not need to declare the namespace in your HTML markup, as you do in XHTML. However, you are permitted to put an xmlns attribute on each HTML element as long as the namespace is http://www.w3.org/1999/xhtml

like image 97
Jamie Dixon Avatar answered Oct 01 '22 02:10

Jamie Dixon