How to serialize an xml document in Python

Antun Karlovac antun at antunkarlovac.com
Wed Mar 19 14:53:29 EST 2003


This sounds like a REALLY easy question, but for the life of me I
can't seem to find a solution. I've created an XML document as
follows:-

        impl = xml.dom.minidom.getDOMImplementation()
        doc = impl.createDocument( None, "element", None )
       

And then I added plenty of nodes to it.

So far I've been printing it out to the console:

        xml.dom.ext.PrettyPrint( doc )

But now I want to assign the serialized string of the XML to a
variable.

How do I do that?

-Antun




More information about the Python-list mailing list