Re: 3.6. The root element

On 7/30/07, Ben Boyle <benjamins.boyle@gmail.com> wrote:
>
> http://dev.w3.org/html5/spec/Overview.html#the-root
>
> This seems fine to me.
>
> Unsure about the second note: doesn't xmlns="" put an element into the
> "null" namespace in XML? Not sure this note is even needed, maybe it
> should say: In XML serialisations all elements must be declared in the
> "http://www.w3.org/2000/xmlns/" namespace.

FWIW, I think of it like this:

When HTML5 markup served as text/html is parsed into the DOM, all
elements end up in the "http://www.w3.org/1999/xhtml" namespace. All
attributes end up in no namespace (the "null namespace").

For example, in each of these situations, the element is in the
"http://www.w3.org/1999/xhtml" namespace and each attribute (including
xmlns) is in the "null" namespace.
<html class="foo">
<html xmlns="http://www.w3.org/1999/xhtml" class="foo">
<html xmlns="foo" class="foo">

For XHTML5 markup (XML markup served as application/xhtml+xml or
application/xml, with a root element of "html", with an xmlns
attribute that has the value of "http://www.w3.org/1999/xhtml"), the
HTML element is in the "http://www.w3.org/1999/xhtml" namespace, child
elements of the HTML element are in the "http://www.w3.org/1999/xhtml"
namespace by default, attributes prefixed with "xml:" are in the
"http://www.w3.org/XML/1998/namespace" namespace, the xmlns attribute
is in the "http://www.w3.org/2000/xmlns/" namespace and non-prefixed
attributes are in the default namespace of "".

For example, in the following situation, the xmlns attribute is in the
"http://www.w3.org/2000/xmlns/" namespace, the html element is in the
"http://www.w3.org/1999/xhtml" namespace, the id attribute is in the
"http://www.w3.org/XML/1998/namespace" namespace and the title
attribute is in the default namespace of "".

<html xmlns="http://www.w3.org/1999/xhtml" xml:id="test" title="test">

-- 
Michael

Received on Wednesday, 1 August 2007 04:35:17 UTC