XML and namespaces
Wilfredo Sánchez Vega
wsanchez at apple.com
Thu Nov 17 19:32:01 EST 2005
I'm having some issues around namespace handling with XML:
>>> document = xml.dom.minidom.Document()
>>> element = document.createElementNS("DAV:", "href")
>>> document.appendChild(element)
<DOM Element: href at 0x1443e68>
>>> document.toxml()
'<?xml version="1.0" ?>\n<href/>'
Note that the namespace wasn't emitted. If I have PyXML,
xml.dom.ext.Print does emit the namespace:
>>> xml.dom.ext.Print(document)
<?xml version='1.0' encoding='UTF-8'?><href xmlns='DAV:'/>
Is that a limitation in toxml(), or is there an option to make it
include namespaces?
-wsv
More information about the Python-list
mailing list