Author jlaurens
Recipients docs@python, eli.bendersky, jlaurens, ned.deily, rhettinger, scoder
Date 2015-04-30.11:35:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1430393753.35.0.307735780067.issue24079@psf.upfronthosting.co.za>
In-reply-to
Content
Since the text and tail notions seem tightly coupled, I would vote for a more detailed explanation in the text doc and a forward link in the tail documentation.


"""
text

    The text attribute holds the text between the element's begin tag and the next tag or None. The tail attribute holds the text between the element's end tag and the next tag or None. For "<a><b>1<c>2<d/>3</c></b>4</a>" xml data, 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, the d element hast text None and tail '3'.

To collect the inner text of an element, see `tostring` with method 'text'.

Applications may store arbitrary objects in this attribute.

tail

    The tail attribute holds the text between the element's end tag and the next tag or None. See `text` for more details.

Applications may store arbitrary objects in this attribute.
"""

It is very important to mention that the 'text' attribute does not always hold a string contrary to what would suggest its name.

BTW, I was not aware of the tostring method with 'text' argument. The fact is that the documentation reads "Returns an (optionally) encoded string containing the XML data." which is misleading because the text is not xml data in general. This also needs to be rephrased or simply removed.
History
Date User Action Args
2015-04-30 11:35:53jlaurenssetrecipients: + jlaurens, rhettinger, scoder, ned.deily, eli.bendersky, docs@python
2015-04-30 11:35:53jlaurenssetmessageid: <1430393753.35.0.307735780067.issue24079@psf.upfronthosting.co.za>
2015-04-30 11:35:53jlaurenslinkissue24079 messages
2015-04-30 11:35:52jlaurenscreate