title: Python 3.4 - XML Parse - IndexError: List Index Out of Range - How do I find range of XML?
body: <p>Okay guys, I'm new to parsing XML and Python, and am trying to get this to work. If someone could help me with this it would be greatly appreciated. If you can help me (educate me) on how to figure it out for myself, that would be even better! </p>
  
  <p>I am having trouble trying to figure out the range to reference for an XML document as I can't find any documentation on it. Here is my code and I'll include the entire Traceback after.</p>
  
  <pre><code>#import library to do http requests:
  import urllib.request
  
  #import easy to use xml parser called minidom:
  from xml.dom.minidom import parseString
  #all these imports are standard on most modern python implementations
  
  #download the file:
  file = urllib.request.urlopen('http://www.wizards.com/dndinsider/compendium/CompendiumSearch.asmx/KeywordSearch?Keywords=healing%20%word&amp;nameOnly=True&amp;tab=')
  #convert to string:
  data = file.read()
  #close file because we dont need it anymore:
  file.close()
  #parse the xml you downloaded
  dom = parseString(data)
  #retrieve the first xml tag (&lt;tag&gt;data&lt;/tag&gt;) that the parser finds with name tagName:
  xmlTag = dom.getElementsByTagName('Data.Results.Power.ID')[0].toxml()
  #strip off the tag (&lt;tag&gt;data&lt;/tag&gt;  ---&gt;   data):
  xmlData=xmlTag.replace('&lt;id&gt;','').replace('&lt;/id&gt;','')
  #print out the xml tag and data in this format: &lt;tag&gt;data&lt;/tag&gt;
  print(xmlTag)
  #just print the data
  print(xmlData)
  </code></pre>
  
  <p>Traceback</p>
  
  <pre><code>/usr/bin/python3.4 /home/mint/PycharmProjects/DnD_Project/Power_Name.py
  Traceback (most recent call last):
    File "/home/mint/PycharmProjects/DnD_Project/Power_Name.py", line 14, in &lt;module&gt;
  xmlTag = dom.getElementsByTagName('id')[0].toxml()
  IndexError: list index out of range
  </code></pre>
  
  <p>Process finished with exit code 1</p>