[XML-SIG] Re: DOM -> String ?

Fredrik Lundh fredrik@pythonware.com
Mon, 26 May 2003 15:17:38 +0200


Markus Jais wrote:

> but I still need a method to turn it into a string
> because I need a string for my programm. And I have to
> determine the length of the XML Document.

write it to a memory file before writing it to the socket:

http://www.python.org/doc/current/lib/module-StringIO.html

    import StringIO
    fp = StringIO.StringIO()
    Print(document, fp)
    s = fp.getvalue()

</F>