Howto create this XML string?
sbaush at gmail.com
Fri Jan 20 16:32:49 CET 2006
in the elementtree implementation the tostring function doesn't work with a
tree, work only with an element. What is the way to put the tree in a
2006/1/20, Fredrik Lundh <fredrik at pythonware.com>:
> Sbaush wrote:
> > Is possible to have the XML in a string (for example xmlstring) and for
> > printing do a print xmlstring ?
> most about anything that can be written to a file can be written to a
> using the StringIO module:
> file = StringIO.StringIO()
> data = file.getvalue()
> for elementtree, you can also use the tostring function:
> data = ET.tostring(elem)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list