[docs] [issue24079] xml.etree.ElementTree.Element.text does not conform to the documentation

Jérôme Laurens report at bugs.python.org
Thu Apr 30 19:56:16 CEST 2015


Jérôme Laurens added the comment:

The totsstring(..., method='text') is not suitable for the inner text because it adds the tail of the top element.

A proper implementation would be

def innertext(elt):
    return (elt.text or '') +''.join(innertext(e)+e.tail for e in elt)

that can be included in the doc instead of the mention of the to string trick

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24079>
_______________________________________


More information about the docs mailing list