[4suite] DomWriter problem

Alexandre Fayolle alf at logilab.com
Thu Sep 21 09:01:28 MDT 2000


On Thu, 21 Sep 2000, Alexandre Fayolle wrote:

> The problem is on this line:
> new_element.setAttributeNS( extraNss[''],'xmlns','')
> 
> the new element is 'foo' and at this point, extraNss is {'': 'xsl'}, so 
> we have an non empty namespace-uri. I have the feeling that I completely
> misunderstood what this parameter stands for when I wrote DowWriter. Could
> someone enlighten me?

I gave a look at SaxWriter, and the similar piece of code says:
for prefix in extraNss.keys():
    if prefix:
        self.__currElement.attrs["xmlns:"+prefix] =extraNss[prefix]
    else:
        self.__currElement.attrs["xmlns"] = extraNss['']

If I understand correctly, we would be setting an 'xmlns' attribute, with
a value of 'xsl' (given the values mentionned above). This would mean that
the default namespace for the foo element would be 'xsl' ????

Should the line 45 in DomWriter be changed to something like 
new_element.setAttributeNS('','xmlns',extraNss[''])


-- 
Alexandre Fayolle
http://www.logilab.com - "Mais o est donc Ornicar ?" - 
LOGILAB, Paris (France).




More information about the 4suite mailing list