>The tricky part which I didn't see in
>the DOM spec was how would prefix and localname work. I would assume that
>the default namespace decl would have a null or zero length local name.
The DOM's intent was that the xmlns= default declaration would have
localname "xmlns", no prefix, and the namespace-declaration URI. Here's a
brief summary of why:
The namespaces spec didn't say how/whether this declaration should appear
in the infoset. Given the DOM's existing data model -- and for
backward-compatability with DOM Level 1 applications -- we wanted namespace
declarations to appear as ordinary attributes.
However, it seemed inappropriate for the processing of namespaces to itself
be non-namespace-aware, and the developers of the namespace spec agreed
when we raised this question. Hence, with their consensus, we assigned a
namespace for the reserved xmlns: prefix.
That left us with the xmlns= declaration. This too is a keyword reserved by
the namespaces spec, and it serves very much the same semantic role as the
declarations which use the xmlns: prefix. Going back to the question of how
one would perform namespace-aware manipulation of a namespaced document,
the best solution we could come up with was to say that this attribute
really is part of the same namespace-declaration language as the others and
thus should be special-cased into using the same namespace, permitting
dispatch-by-namespace code to recognize it as part of that same set. Again,
we crosschecked this proposal with some of the folks involved in the XML
Namespaces decision, and they had no objections.
One can indeed argue that this could instead have been treated as a prefix
with null localname. But as noted earlier, that would break Level 1 DOM
code that had implemented its own namespace awareness, and we didn't
consider that acceptable.
I agree, it isn't optimal. But it was the best compromise we could find at
the time, given the order in which these documents were developed/released.
And since this solution is now written into the DOM Level 2 spec (1.1.8,
"all namespace declaration attributes are by definition bound to the
namespace URI"), I'd be happier if the Apache DOMs tracked it.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]