title: iterparse not getting children text
body: <p><strong>EDIT:</strong> I found a way to make it work. It turns out I had an <code>elem.clear()</code> call that I didn't show in the code below. I apologize for that. I modified it so you can see how it was. It turns out that if I move that call inside the if statement the problem went away. But I still don't understand how the clear was called before the if statement was finished.</p>
  
  <p>I have an XML file that sort of looks like this: </p>
  
  <pre><code>&lt;alarm&gt; &lt;alarm_id&gt;   127688705 &lt;/alarm_id&gt; &lt;site&gt; 1     &lt;/site&gt; &lt;event_time&gt; 14/08/31 00:01:00    &lt;/event_time&gt; &lt;cease_time&gt; 14/08/31 00:07:00    &lt;/cease_time&gt; &lt;problem_text&gt;
      Something went wrong                                     &lt;/problem_text&gt; &lt;/alarm&gt;
  </code></pre>
  
  <p>I know it doesn't have the proper styling but that's how my script receives it so I thought of giving you guys the whole picture. The file basically has hundreds of <code>&lt;alarm&gt;</code> elements under a <code>&lt;root&gt;</code> element. </p>
  
  <p>What I want to do is is parse the file with iterparse and get all the text information from the child elements of <code>&lt;alarm&gt;</code>. My script so far looks like this:</p>
  
  <pre><code>import xml.etree.cElementTree as etree
  
  try:
      sourcefile = open('file.xml')
  except IOError:
      print('Cannot open ', sourcefile)
      return -1
  
  for event, elem in etree.iterparse(sourcefile):
      if elem.tag == 'alarm':
          print("event:", event)
          for child in elem:
              print(child.tag, child.text)
      elem.clear()
  </code></pre>
  
  <p>But I get <code>None</code> as a result from <code>child.text</code>. Here's the output I get when I run the script:</p>
  
  <pre><code>[big@bang src]$ ./parse_xml.py
  event: end
  alarm_id None
  site None
  event_time None
  cease_time None
  problem_text None
  </code></pre>
  
  <p>Can you guys give me a hand with this?</p>