Re: Changing xmlns attribute on the fly.

>So that means you can change the default namespace on the fly, and of
>all children that depend on it,

No. First off, as noted, you shouldn't be using setAttribute() at all these
days; switch to setAttributeNS. Ideally we should have deprecated the
non-namespace-aware methods, but the W3C has no deprecation mechanism and
we wanted to preserve them for backward compatability with DOM Level 1
applications which would require something like "conditional deprecation".

Second, since every element and attribute node carries its own namespace
information, even correctly changing/removing/adding a namespace
declaration has no effect on the other nodes; what it does mean is that
when you serialize the document back out to XML the serializer may have to
introduce other declarations to preserve these semantics, as described in
DOM Level 3's discussions of namespace normalization.

______________________________________
"... Three things see no end: A loop with exit code done wrong,
A semaphore untested, And the change that comes along. ..."
  -- "Threes" Rev 1.1 - Duane Elms / Leslie Fish
(http://www.ovff.org/pegasus/songs/threes-rev-11.html)

Received on Monday, 6 August 2007 14:31:09 UTC