Re: Changing xmlns attribute on the fly.

2007/8/6, keshlam@us.ibm.com <keshlam@us.ibm.com>:
>
>
> >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;

I'm not asking this from a developer point of view, but from an DOM
implementor point of view, which must cover ALL cases.


> 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".

setAttribute it needed for non-namespace aware documents.

>
>  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)


Ray basically answered the question. The default namespace is NOT
bound to the xmlns attribute, in the DOM tree.It should be used to
determine the namespace only at parse-time, else it should be treated
as a regular custom attribute.

Received on Monday, 6 August 2007 15:46:45 UTC