W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2001

Re: Some notes about DOMException

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Mon, 29 Jan 2001 12:41:50 -0500
To: www-dom@w3.org
Message-ID: <OFB0DC9027.4B229B6A-ON852569E3.005EA54B@pok.ibm.com>

Note that the namespace-for-namespace-declarations is something the DOM WG
invented; it doesn't actually appear in the current edition of the
Namespaces Recommendation. They defined the declaration syntax as a
reserved prefix, not as a reserved namespace. The folks who worked on that
spec have basically agreed that basing it on the namespace would be a good
idea and that this should probably be fixed in the next release, if
possible... but for now it's a bit of a grey zone.

> Shouldn't [DOMException.NAMESPACE_ERR] also be raised if
> the qualifiedName has a prefix that is "xmlns" and the
> namespaceURI is different from "http://www.w3.org/2000/xmlns/"

That's an interesting question. This would constitute an implicit attempt
to redeclare xmlns:, which is forbidden. The DOM normally considers
prefixes to be only a hint to the serializer, and wouldn't care if the
namespace prefix and URI don't match an existing declaration. But since
Namespace declarations are currently recognized by looking at the prefix
(as above, grrr), this does create an ugly situation. I think the right
answer is going to depend on whether they change namespace declarations to
be properly namespace-aware...

> And what happens if the qualifiedName has a prefix different from
>"xmlns", or has no prefix and a local name different from "xmlns", and the
> namespaceURI is "http://www.w3.org/2000/xmlns/"

The DOM considers that entirely acceptable. As do namespaces, actually;
they don't forbid declaring other prefixes with this namespace. However,
last time I checked the namespace spec they actually said that only
declarations which use the predefined xmlns: prefix (or the qname "xmlns"
for the default namespace) would be accepted as meaningful; others should
be ignored... In other words, namespace declarations were not defined in a
namespace-aware manner. I hope that will be fixed, but until it is we have
to be prepared to live with their defined semantics.

>Same question about the "xml" prefix and the
>"http://www.w3.org/XML/1998/namespace" namespace URI.

Same answer. We do forbid redeclaring xml:, but we don't forbid creating
another prefix that points to the same URI, because the namespace spec
doesn't forbid it. In Theory, a namespace-aware application _should_
process that namespace without looking at which prefix it was bound to; if
that wasn't your intent, you shouldn't have used that URI.

> What about namespace declarations bounding prefixes beginning with "xml"
>in any case combination ?

The DOM doesn't know what other prefixes in the xml... space might be
created in the future. It's safer for us to _not_ restrict this; otherwise
we'd have to re-release the DOM whenever someone introduced a new one.
Applications can warn the user, in some appropriate way -- most likely
during serialization, since it really shouldn't matter until then.

Joe Kesselman  / IBM Research
Received on Monday, 29 January 2001 12:42:26 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:08 UTC