title: elif giving syntax error python?
body: <p>I'm trying to parse an XML document and get certain tags.  I'd like to grab the name tag (only if it's the name tag nested within artist) and the title tag (only if it's the one nested within release).<br>
  That's not too important, though, the important thing is that I'm for some reason getting an error saying the elif statement is invalid syntax<br>
  I've looked through other posts and made sure that my tabbing is correct and that there aren't any extra newlines after any of the if's.  </p>
  
  <p>This is the code snippet:      </p>
  
  <pre><code>from lxml import etree
  import sys
  
  #infile = raw_input("Please enter an XML file to parse:  ")
  outfile = open('results.txt', 'a')
  
  path = []
  for event, elem in etree.iterparse('releases7.xml', events=("start", "end")):
      if event == 'start':
          path.append(elem.tag)
      elif event == 'end':
          # process the tag
          if elem.tag == 'name':
              if 'artist' in path and not 'extraartists' in path and not 'track' in path:
                  outfile.write( 'artist = ' + elem.text.encode('utf-8') + '\n' )
          elif elem.tag == 'title':
              if 'release' in path and not 'track' in path:
                  outfile.write( 'release title = ' + elem.text.encode('utf-8') + '\n')
              else:
                  print 'nonrelease'
          path.pop()
  </code></pre>
  
  <p>This is the error:</p>
  
  <pre><code>File "DataDestroy_Fast.py", line 18
  elif elem.tag == 'title':
     ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>(Note:  Using Python2.7 on Mac OSX)</p>