XML and namespaces

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wilfredo Sánchez Vega

    #1

    XML and namespaces

    I'm having some issues around namespace handling with XML:
    [color=blue][color=green][color=darkred]
    >>> document = xml.dom.minidom .Document()
    >>> element = document.create ElementNS("DAV: ", "href")
    >>> document.append Child(element)[/color][/color][/color]
    <DOM Element: href at 0x1443e68>[color=blue][color=green][color=darkred]
    >>> document.toxml( )[/color][/color][/color]
    '<?xml version="1.0" ?>\n<href/>'

    Note that the namespace wasn't emitted. If I have PyXML,
    xml.dom.ext.Pri nt does emit the namespace:
    [color=blue][color=green][color=darkred]
    >>> xml.dom.ext.Pri nt(document)[/color][/color][/color]
    <?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

Working...