XML and namespaces

Roberto De Almeida ralmeida at gmail.com
Wed Nov 30 10:48:29 EST 2005


I've found the same bug. This is what I've been doing:

    from xml.dom.minidom import Document

    try:
        from xml.dom.ext import PrettyPrint
    except ImportError:
        PrettyPrint = None

    doc = Document()
    ...

    if PrettyPrint is not None:
        PrettyPrint(doc, stream=output, indent='    ')
    else:
        top_parent.setAttribute("xmlns", xmlns)
        output.write(doc.toprettyxml(indent='    '))




More information about the Python-list mailing list