[issue24072] xml.etree.ElementTree.Element does not catch text
Ned Deily
report at bugs.python.org
Wed Apr 29 04:39:48 CEST 2015
Ned Deily added the comment:
While a bit confusing, I don't think this is a bug. Note the definition of the "tail" attribute of an element:
"If the element is created from an XML file the attribute will contain any text found after the element’s end tag and before the next tag."
Unlike in root1 and root2 where 'TEXT' is before the end of element a and the start of element b (in root2), 'TEXT' in root3 follows the end tag of element b and so is associated with it as its tail attribute.
>>> root3
<Element 'a' at 0x1022ab188>
>>> root3[0]
<Element 'b' at 0x1022ab1d8>
>>> root3[0].tail
'TEXT'
https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.tail
----------
nosy: +ned.deily
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24072>
_______________________________________
More information about the Python-bugs-list
mailing list