title: Using python, elementtree, xml parser to get attributes not working for some reason?
body: <p>I'm new to python and parsing xml, but I'm having trouble with a particular xml file which is spat out by a program I work with.  I'm trying parse this xml file using python and elementtree in order to extract the url data (the URL below is fake).  Any ideas as to why this isn't working?</p>
  
  <p>my python code:</p>
  
  <pre><code>def xmlTreeParser(fileName,attribute,tagName):
  tree = ET.parse(fileName)
  root = tree.getroot()
  
  attribArray = [element.attrib[attribute] for element in root.findall(tagName)]
  print attribArray
  
  xmlTreeParser("xml_file.xml",'text','Expr')
  </code></pre>
  
  <p>here's my xml file:</p>
  
  <pre><code>&lt;Query id="f9cef041-085d-47e0-8d16-15e36bba1ec8" name=""&gt;
    &lt;Description /&gt;
    &lt;JustSortedColumns /&gt;
    &lt;Conditions linking="All"&gt;
      &lt;Condition class="PDCT" enabled="True" readOnly="False" linking="Any"&gt;
        &lt;Condition class="SMPL" enabled="True" readOnly="False"&gt;
          &lt;Operator id="Contains" /&gt;
          &lt;Expressions&gt;
            &lt;Expr class="ENTATTR" id="Person.LinkedInUrl" /&gt;
            &lt;Expr class="CONST" type="String" kind="Scalar" value="https://www.linkedin.com/Bill-Smith" text="https://www.linkedin.com/Bill-Smith" /&gt;
          &lt;/Expressions&gt;
        &lt;/Condition&gt;
      &lt;/Condition&gt;
    &lt;/Conditions&gt;
  &lt;/Query&gt;
  </code></pre>
  
  <p>The python I wrote works just fine on another, test, xml file that I wrote myself.  I'm at a loss as to why I can't parse this particular block of xml.  Thanks everyone.</p>