[4suite] DomWriter problem
Alexandre Fayolle
alf at logilab.com
Thu Sep 21 08:43:12 MDT 2000
Yes, I know who wrote this piece of code ;o)
Let me tell him: it's broken!
It looks to me as if the bug fix with setAttributeNS of the other day
(remember : passing a non-empty namespace with a non prefixed attribute
name) showed a bug in DomWriter, but I have problem understanding what's
wrong.
Let's take this transformation:
<?xml version="1.0"?>
<xsl:transform
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<foo/>
</xsl:template>
</xsl:transform>
if you process any dom tree with this transformation, using DomWriter,
you'll get a NAMESPACE_ERR:
File "/usr/lib/python1.5/site-packages/xml/xslt/LiteralElement.py", line
225, in instantiate
processor.writers[-1].startElement(self._nodeName, self._uri,
self._outputNss)
File "/usr/lib/python1.5/site-packages/xml/xslt/DomWriter.py", line 48,
in startElement
new_element.setAttributeNS( extraNss[''],'xmlns','')
File "/usr/lib/python1.5/site-packages/xml/dom/Element.py", line 265, in
setAttributeNS
att = self.ownerDocument.createAttributeNS(namespaceURI,
qualifiedName)
File "/usr/lib/python1.5/site-packages/xml/dom/Document.py", line 391,
in createAttributeNS
raise DOMException(NAMESPACE_ERR)
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?
--
Alexandre Fayolle
http://www.logilab.com - "Mais o est donc Ornicar ?" -
LOGILAB, Paris (France).
More information about the 4suite
mailing list