![](https://secure.gravatar.com/avatar/8b97b5aad24c30e4a1357b38cc39aeaa.jpg?s=120&d=mm&r=g)
[replying on-list] Bogdan Cristea, 08.11.2013 12:20:
On 11/08/2013 12:11 PM, Stefan Behnel wrote:
If you really need the text content when a "start" event is being reported, then you could read one iteration ahead and handle the event before that. That will make sure that any text between the currently reported opening tag and the next tag has been parsed. The same applies to tail text during an "end" event.
Speaking of this approach, I wonder if lxml shouldn't just do that internally. It would make it less easy for users to write broken code, at the cost of a bit more content being held in memory internally on average. The only really problematic thing would be large blocks of text, which may then end up being loaded into memory completely, even if the user stops iterating right before them. Not an unrealistic scenario, though.
Opinions?
Maybe an "ensure_text" option would help?
IMHO a "chars" event would solve completely this issue
No way. Stefan