minidom toxml() not emitting attribute namespace qualifier
Paul Boddie
paul at boddie.net
Tue Jun 24 05:44:36 EDT 2003
Alan Kennedy <alanmk at hotmail.com> wrote in message news:<3EF71DBB.321885B4 at hotmail.com>...
> kevin wrote:
>
> > Using Python 2.2.3, with this example code:
>
> [Code elided]
See my results below.
> > The output is missing the "myns" namespace qualifier on the "att"
> > attribute. Can someone tell me what I'm doing wrong?
>
> That's a bug in minidom.
Not any more, apparently - see below.
> I reported it back in November 2002, but I wasn't precise enough about version
> numbers, so it went unaddressed.
>
> https://sourceforge.net/tracker/?func=detail&atid=106473&aid=637355&group_id=6473
>
> I will update that bug report now that I can see for sure that the bug is
> still present in 2.2.3.
Well, it was definitely there in the 2.1 series, but as my recently
added comment on SourceForge suggests, I think it has been resolved in
recent minidom implementations. Certainly, I don't think that my
particular installation of Python (Cygwin, Windows 2000, Python 2.2.3)
has any additional modifications, and yet...
>>> import xml.dom.minidom
>>> XML = """\
... <?xml version="1.0"?>
... <elem xmlns:myns="mynamespaceuri" myns:att="value"/>
... """
>>> dom = xml.dom.minidom.parseString( XML )
>>> print dom.toxml()
<?xml version="1.0" ?>
<elem myns:att="value" xmlns:myns="mynamespaceuri"/>
Am I missing something or is this not what one would expect?
Paul
More information about the Python-list
mailing list