title: Python - Continuing after exception at the point of exception
body: <p>I'm trying to extract data from an xml file. A sample of my code is as follows:</p>
  
  <pre><code>    from xml.dom import minidom
      dom = minidom.parse("algorithms.xml")
      ...
         parameter = dom.getElementsByTagName("Parameters")[0]
         # loop over parameters
         try:
              while True:
                  parameter_id = parameter.getElementsByTagName("Parameter")[m].getAttribute("Id")
                  parameter_name = parameter.getElementsByTagName("Name")[m].lastChild.data
                  ...
                  parameter_default = parameter.getElementsByTagName("Default")[m].lastChild.data
                  print parameter_id
                  print parameter_default
                  m = m+1
          except IndexError:
              #reached end of available parameters
              pass
          #except AttributeError:
              #parameter doesn't exist
              #?
  </code></pre>
  
  <p>If all elements for each parameter exist, the code runs correctly. Unfortunately the data I am supplied often has missing entries in it, raising an AttributeError exception. If I simply pass on that error, then any elements that do exist but are retrieved later in the loop than when the exception occurred are skipped, which I don't want. I need some way to continue where the code left off and skip to the next line of code if this specific exception is raised.</p>
  
  <p>The only way to work around this that I can think of would be to override the minidom's class methods and  catch the exception there, but that seems far too messy and too much work to handle what should be a very simple and common problem. Is there some easier way to handle this that I am missing?</p>