# HG changeset patch # Parent 466c5119a2565ac3007d113202e259e6cc81ce41 diff -r 466c5119a256 Doc/library/xml.etree.elementtree.rst --- a/Doc/library/xml.etree.elementtree.rst Fri May 29 18:44:50 2015 -0500 +++ b/Doc/library/xml.etree.elementtree.rst Sat May 30 01:30:49 2015 +0000 @@ -651,21 +651,21 @@ .. attribute:: text + tail - The *text* attribute can be used to hold additional data associated with - the element. As the name implies this attribute is usually a string but - may be any application-specific object. If the element is created from - an XML file the attribute will contain any text found between the element - tags. + The *text* attribute holds any text between the element's begin tag + and the next tag. The *tail* attribute holds any text between the + element's end tag and the next tag. These attributes are set to + ``None`` if there is no text. For example, in the XML data + ``1234``, the *a* element has ``None`` for + both *text* and *tail* attributes, the *b* element has *text* ``"1"`` + and *tail* ``"4"``, the *c* element has *text* ``"2"`` and *tail* + ``None``, and the *d* element has *text* ``None`` and *tail* ``"3"``. + To collect the inner text of an element, use :meth:`itertext`, for + example ``"".join(element.itertext())``. - .. attribute:: tail - - The *tail* attribute can be used to hold additional data associated with - the element. This attribute is usually a string but may be any - application-specific object. 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. + Applications may store arbitrary objects in these attributes. .. attribute:: attrib