title: Parsing XML with namespace in Python via 'ElementTree'
body: <p>I have the following XML which I want to parse using Python's <code>ElementTree</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;rdf:RDF xml:base="http://dbpedia.org/ontology/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:owl="http://www.w3.org/2002/07/owl#"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
      xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
      xmlns="http://dbpedia.org/ontology/"&gt;
  
      &lt;owl:Class rdf:about="http://dbpedia.org/ontology/BasketballLeague"&gt;
          &lt;rdfs:label xml:lang="en"&gt;basketball league&lt;/rdfs:label&gt;
          &lt;rdfs:comment xml:lang="en"&gt;
            a group of sports teams that compete against each other
            in Basketball
          &lt;/rdfs:comment&gt;
      &lt;/owl:Class&gt;
  
  &lt;/rdf:RDF&gt;
  </code></pre>
  
  <p>I want to find all <code>owl:Class</code> tags and then extract the value of all <code>rdfs:label</code> instances inside them. I am using the following code:</p>
  
  <pre class="lang-py prettyprint-override"><code>tree = ET.parse("filename")
  root = tree.getroot()
  root.findall('owl:Class')
  </code></pre>
  
  <p>Because of the namespace, I am getting the following error.</p>
  
  <pre class="lang-py prettyprint-override"><code>SyntaxError: prefix 'owl' not found in prefix map
  </code></pre>
  
  <p>I tried reading the document at <a href="http://effbot.org/zone/element-namespaces.htm">http://effbot.org/zone/element-namespaces.htm</a> but I am still not able to get this working since the above XML has multiple nested namespaces.</p>
  
  <p>Kindly let me know how to change the code to find all the <code>owl:Class</code> tags.</p>