title: Parse large XML with lxml
body: <p>I am trying to get my script working. So far it doesn't managed to output anything.</p>
  
  <p>This is my test.xml</p>
  
  <pre><code>&lt;mediawiki xmlns="http://www.mediawiki.org/xml/export-0.8/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.8/ http://www.mediawiki.org/xml/export-0.8.xsd" version="0.8" xml:lang="it"&gt;
  &lt;page&gt;
      &lt;title&gt;MediaWiki:Category&lt;/title&gt;
      &lt;ns&gt;0&lt;/ns&gt;
      &lt;id&gt;2&lt;/id&gt;
      &lt;revision&gt;
        &lt;id&gt;11248&lt;/id&gt;
        &lt;timestamp&gt;2003-12-31T13:47:54Z&lt;/timestamp&gt;
        &lt;contributor&gt;
          &lt;username&gt;Frieda&lt;/username&gt;
          &lt;id&gt;0&lt;/id&gt;
        &lt;/contributor&gt;
        &lt;minor /&gt;
        &lt;text xml:space="preserve"&gt;categoria&lt;/text&gt;
        &lt;sha1&gt;0acykl71lto9v65yve23lmjgia1h6sz&lt;/sha1&gt;
        &lt;model&gt;wikitext&lt;/model&gt;
        &lt;format&gt;text/x-wiki&lt;/format&gt;
      &lt;/revision&gt;
    &lt;/page&gt;
  &lt;/mediawiki&gt;
  </code></pre>
  
  <p>And this is my code</p>
  
  <pre><code>from lxml import etree
  
  def fast_iter(context, func):
      # fast_iter is useful if you need to free memory while iterating through a
      # very large XML file.
      #
      # http://www.ibm.com/developerworks/xml/library/x-hiperfparse/
      # Author: Liza Daly
      for event, elem in context:
          func(elem)
          elem.clear()
          while elem.getprevious() is not None:
              del elem.getparent()[0]
      del context
  
  def process_element(elem):
      if elem.ns.text == '0':
          print elem.title.text
  
  context=etree.iterparse('test.xml', events=('end',), tag='page')
  fast_iter(context, process_element)
  </code></pre>
  
  <p>I don't get any error, simply there's no output. What I want to get is to parse the  element if  is 0.</p>