Public bug reported:
I spent some time researching this issue, including browsing long
threads in other bugs, so if there's a solution maybe this bug report
will make it easier to find.
As far as I can tell, xml.dom.ext.PrettyPrint is the de facto standard
way of generating namespace-aware xml from minidom. The various
alternative writers (Document.toxml, .toprettyxml, .writexml) don't
output namespace notations, and my attempt at using 4suite's PrettyPrint
failed as well. Without xml.dom.ext, Ubuntu is missing this standard
functionality.
As per laga's suggestion in bug #215723 I'm trying to "properly" develop
an application, so I'm looking to avoid the sys.path.append
workaround... it sounds like oldxml might be going away anyway. Plus, I
don't really like jumping through such distribution-specific hoops.
I personally don't care about the rest of xml.dom.ext, but it would be
nice if Ubuntu could restore its PrettyPrinter, as XML namespaces can be
pretty powerful.
For some sample code:
import xml.dom.minidom
doc=xml.dom.minidom.Document()
svg=doc.createElementNS('http://www.w3.org/2000/svg','svg')
doc.appendChild(svg)
will PrettyPrint as:
<?xml version='1.0' encoding='UTF-8'?>
<svg xmlns='http://www.w3.org/2000/svg'/>
but doc.toprettyxml gives:
<?xml version="1.0" ?>
<svg/>
** Affects: python-xml (Ubuntu)
Importance: Undecided
Status: New
--
Python now lacks namespace-aware xml writer
https://bugs.launchpad.net/bugs/259527
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs