title: Best way to Parse XML
body: <p>I am working with a xml file available <a href="https://earthquake.usgs.gov/realtime/product/shakemap/us2000a3y4/us/1501736303313/download/grid.xml" rel="nofollow noreferrer">here</a>.</p>
  
  <p>I want to parse and load <code>LON, LAT, PGA, PGV, MMI, PSA03, PSA10, PSA30, STDPGA, URAT and SVEL</code> as headers of CSV file.</p>
  
  <p>The <code>grid_data</code> element has all values to all these headers in a space delimiter fashion.</p>
  
  <p>I am looking for a <code>csv file output</code> like below:</p>
  
  <pre><code>LON LAT PGA PGV MMI PSA03 PSA10 PSA30 STDPGA URAT SVEL
  -99.6833 38.2891 0.04 0.04 2.04 0.09 0.02 0 0.65 1 363.294
  -99.6666 38.2891 0.04 0.04 2.06 0.09 0.02 0 0.65 1 342.531
  -99.6500 38.2891 0.04 0.04 2.11 0.1 0.02 0 0.65 1 303.783
  -99.6333 38.2891 0.04 0.04 2.08 0.09 0.02 0 0.65 1 334.629
  -99.6166 38.2891 0.04 0.05 2.15 0.09 0.02 0 0.65 1 279.535
  -99.6000 38.2891 0.04 0.04 2.08 0.09 0.02 0 0.65 1 326.391
  -99.5833 38.2891 0.04 0.04 2.02 0.08 0.02 0 0.65 1 390.897
  -99.5666 38.2891 0.04 0.04 2.08 0.09 0.02 0 0.65 1 346.033
  </code></pre>
  
  <p>Later, I'd use pandas for python to find max PGV value and do my GIS Analysis.</p>
  
  <p>So far this is the code I have: </p>
  
  <pre><code>import sys
  import traceback
  from xml.dom import minidom
  import warnings
  warnings.filterwarnings("ignore")
  
  try:
      print "*"*20 + " The Beginning " + "*"*20
  
      xml_file_location = r"C:\Users\*****\Downloads\Grids\us2000a3y4_grid.xml"
      xmldoc = minidom.parse(xml_file_location)
      itemlist = xmldoc.getElementsByTagName('grid_field')
      for item in itemlist:
          print (item.attributes['name'].value)
  
  
  
  Catch all exception and print to the screen
  except:
      e = sys.exc_info()[0]
      print( "Error: %s\n\n" % e )
  
  #Closing script
  finally:
      print "*"*20 + " The End " + "*"*20
  </code></pre>