elements named "xmlns"

In DOM Level 3, the specification for Document.createElementNS says
the following:

  http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-DocCrElNS

  NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified
  name, if the qualifiedName has a prefix and the namespaceURI is
  null, or if the qualifiedName has a prefix that is "xml" and the
  namespaceURI is different from
  "http://www.w3.org/XML/1998/namespace" [XML Namespaces], or if the
  qualifiedName or its prefix is "xmlns" and the namespaceURI is
  different from "http://www.w3.org/2000/xmlns/", or if the
  namespaceURI is "http://www.w3.org/2000/xmlns/" and neither the
  qualifiedName nor its prefix is "xmlns".

I'm surprised by the restriction on an element whose qualifiedName is
"xmlns".  Is this a mistake in the spec?  Perhaps the text was copied
from createAttributeNS (where the restriction does make sense)?
I think it should read something like the following:

  NAMESPACE_ERR: Raised if the qualifiedName is a malformed qualified
  name, if the qualifiedName has a prefix and the namespaceURI is
  null, if the qualifiedName has a prefix that is "xml" and the
  namespaceURI is different from
  "http://www.w3.org/XML/1998/namespace" [XML Namespaces], if the
  qualifiedName has a prefix that is "xmlns" and the namespaceURI is
  different from "http://www.w3.org/2000/xmlns/", or if the
  namespaceURI is "http://www.w3.org/2000/xmlns/" and the
  qualifiedName has no prefix or has a prefix that is different from
  "xmlns".

--Doug Orleans
dougorleans@gmail.com

Received on Sunday, 6 August 2006 18:56:05 UTC