[lxml-dev] Accessing text of an element when using itemparse
25 May
2010
25 May
'10
12:46 p.m.
Hello, When using itemparse, during 'start' event, is the text of an element accessible ? Or text can only be accessed during 'end' event ? from sys import stdout from lxml.etree import iterparse if __name__ == '__main__': context = iterparse("in.xml",events=('start','end')) for event, element in context: if event=='start' and (type(element.text) is unicode or type(element.text) is str): stdout.write(element.text.encode('utf-8')) I get different results with this code and the same one replacing "if event=='start'" by "if event=='end'" : is it normal ? Best regards, Alex Bernier
5231
Age (days ago)
5231
Last active (days ago)
1 comments
2 participants
participants (2)
-
Alex Bernier
-
Stefan Behnel