title: Trying to parse an XML file with Python - what am I doing wrong?
body: <p>I'm working with XML and Python for the first time. The ultimate goal is to send a request to a REST service, receive a response in XML, and parse the values and send emails depending on what was returned. However, the REST service is not yet in place, so for now I'm experimenting with an XML file saved on my C drive.</p>
  
  <p>I have a simple bit of code, and I'm confused about why it isn't working.</p>
  
  <p>This is my xml file ("XMLTest.xml"):</p>
  
  <pre><code>&lt;Response&gt;
      &lt;exitCode&gt;1&lt;/exitCode&gt;
      &lt;fileName&gt;C:/Something/&lt;/fileName&gt;
      &lt;errors&gt;
          &lt;error&gt;Error generating report&lt;/error&gt;
      &lt;/errors&gt;
  &lt;/Response&gt;
  </code></pre>
  
  <p>This is my code so far:</p>
  
  <pre><code>from xml.dom import minidom
  
  something = open("C:/XMLTest.xml")
  something = minidom.parse(something)
  
  nodeList = []
  for node in something.getElementsByTagName("Response"):  
      nodeList.extend(t.nodeValue for t in node.childNodes)
  print nodeList
  </code></pre>
  
  <p>But the results that print out are...</p>
  
  <pre><code>[u'\n\t', None, u'\n\t', None, u'\n\t', None, u'\n']
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>I'm trying to get the node values. Is there a better way to do this? Is there a built-in method in Python to convert an xml file to an object or dictionary? I'd like to get all the values, preferably with the names attached.</p>