lxml.etree iterparse() and parsing element completely
问题 I have an XML file with nodes that looks like this: <trkpt lat="-37.7944415" lon="144.9616159"> <ele>41.3681107</ele> <time>2015-04-11T03:52:33.000Z</time> <speed>3.9598</speed> </trkpt> I am using lxml.etree.iterparse() to iteratively parse the tree. I loop over each trkpt element's children and want to print the text value of the children nodes. E.g. for event, element in etree.iterparse(infile, events=("start", "end")): if element.tag == NAMESPACE + 'trkpt': for child in list(element):