title: Parsing xml file in django
body: <p>I've an xml document on my project folder and i've problem with extraction of values of an attribute of an element.</p>
  
  <p>My xml file looks like this :</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  
  &lt;results filename="/home/maker/media/image" syncfile="/home/maker/media/synchro.xml"&gt;
      &lt;readbit number="1" frame="10" bit="0" score="-0.483138" status="n" /&gt;
      &lt;readbit number="2" frame="20" bit="1" score="0.416175" status="n" /&gt;
      &lt;readbit number="3" frame="30" bit="0" score="-0.457450" status="n" /&gt;
      &lt;readbit number="4" frame="40" bit="1" score="0.597008" status="y" /&gt;
      ....
  &lt;/results&gt;
  </code></pre>
  
  <p>What i tried in my view to get all values of the attribut bit:</p>
  
  <pre><code>def parse(request):
      xmldoc = minidom.parse('synchro.xml')
      readbitlist = xmldoc.getElementsByTagName('readbit')
      elements = []
      for s in readbitlist :
          x = s.attributes['bit'].value
          elements.append(x)
      return render(request, 'parse.html', {'elements': elements})
  </code></pre>
  
  <p>In my template:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt; Mark &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   {% for element in elements %}
   &lt;p&gt; {{ element }} &lt;/p&gt;
   {% endfor %}
  &lt;/body&gt;
  </code></pre>