Olivier Collioud wrote: > what are cElementTree limitations compared to ElementTree ?
cElementTree implements the interfaces described here: http://www.effbot.org/zone/element.htm Comment support may be added in a future release. In the meantime, you can work around this limitation by creating a cElementTree node, and setting the "tag" attribute to ElementTree.Comment: >>> import cElementTree >>> from elementtree.ElementTree import Comment >>> x = cElementTree.Element(Comment) >>> x.text = "hello" >>> cElementTree.tostring(x) '<!-- hello -->' I recommend wrapping this functionality in a helper function that looks for cElementTree.Comment, and only uses the workaround if necessary: def makecomment(text): try: elem = cElementTree.Comment(text) except AttributeError: elem = cElementTree.Element(ElementTree.Comment) elem.text = text return elem </F> _______________________________________________ XML-SIG maillist - XML-SIG@python.org http://mail.python.org/mailman/listinfo/xml-sig