Howto create this XML string?

Sbaush sbaush at gmail.com
Fri Jan 20 14:26:38 CET 2006


I have a xml tree like this

tree = ET.ElementTree(root)

How can i put tree in a string?

tree is generated like this:

import elementtree.ElementTree as ET

root = ET.Element("manager")
req=ET.SubElement(root,"request")
app=ET.SubElement(req,"append")
app.set("mode","INPUT")
met=ET.SubElement(app,"method")
met.set("type","GOOD")
src=ET.SubElement(app,"source")
src.set("address","127.0.0.1")
act=ET.SubElement(app,"action")
act.set("option","OK")

tree = ET.ElementTree(root)

--
Sbaush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060120/63288639/attachment.html>


More information about the Python-list mailing list