[XML-SIG] Use DOM for do it

Sbaush sbaush at gmail.com
Fri Feb 3 11:09:47 CET 2006


Hi all.
I've this function that write a XML string.
Is possible to do it without ElementTree but with DOM?
Thanks.

import sys
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)
tree.write(sys.stdout)
print



--
Sbaush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20060203/36438523/attachment.htm 


More information about the XML-SIG mailing list