Hi everyone,
Here's a minor issue in the DOM Level 2 and Leve 3 specifications
that has nothing to do with browser compatibility (for a refreshing
change of pace!):
DOM Level 2 calls for the following exceptions for createDocument:
INVALID_CHARACTER_ERR: Raised if the specified qualified name
contains an illegal character.
NAMESPACE_ERR: Raised if the qualifiedName is malformed, 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" [Namespaces].
DOM Level 3 calls for the following:
INVALID_CHARACTER_ERR: Raised if the specified qualified name is not
an XML name according to [XML 1.0].
NAMESPACE_ERR: Raised if the qualifiedName is malformed, if the
qualifiedName has a prefix and the namespaceURI is null, or if the
qualifiedName is null and the namespaceURI is different from 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 DOM implementation does not support the "XML"
feature but a non-null namespace URI was provided, since namespaces
were defined by XML.
These appear to call for different exceptions in certain cases. For
example, a qualifiedName that is the empty string should throw
NAMESPACE_ERR per DOM Level 2 (it does not contain any characters and
so cannot "contain an illegal character", but the qualifiedName is
indeed malformed). But it would throw INVALID_CHARACTER_ERR under DOM
Level 3.
Is there any value to resolving this inconsistency somehow? Right now
the DOM Level 2 test suite is testing for the DOM Level 3 behavior on
this, which seems wrong, as the test suite is testing for a behavior
expressly contrary to the corresponding spec. On the other hand,
testing for the L2 behavior would mean that passing the L2 test suite
would preclude L3 compliance.
Curt Arnold mentioned that he thought there might have been a
decision to do an erratum to Level 2 on this, which through some
oversight never got published, and suggested mailing this list.
Regards,
Maciej