Write xml file using lxml library in Python

Posted by systempuntoout on Stack Overflow See other posts from Stack Overflow or by systempuntoout
Published on 2010-05-14T09:48:58Z Indexed on 2010/05/14 10:04 UTC
Read the original article Hit count: 317

Filed under:
|
|

I'm using lxml to create an XML file from scratch; having a code like this:

from lxml import etree

root = etree.Element("root")
root.set("interesting", "somewhat")
child1 = etree.SubElement(root, "test")

How do i write root Element object to an xml file using write() method of ElementTree class?

© Stack Overflow or respective owner

Related posts about lxml

Related posts about python