Werner F. Bruhin wrote: > By the way is it possible to write the file in a "pretty" format?
here's a simple (and only lightly tested) in-place indenter: def indent(elem, level=0): i = "\n" + level*" " if len(elem): if not elem.text or not elem.text.strip(): elem.text = i + " " for elem in elem: indent(elem, level+1) if not elem.tail or not elem.tail.strip(): elem.tail = i else: if level and (not elem.tail or not elem.tail.strip()): elem.tail = i to prettyprint, just call this before you serialize the tree. (note that this doesn't work well on documents that contain mixed content). </F> _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig