title: Parsing XML in Python with ElementTree
body: <p>I'm using the documentation here to try to get only the values (name,ip , netmask) for certain elements.
  This is an example of the structure of my xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; ?&gt;
      &lt;rpc-reply xmlns=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot; xmlns:nc=&quot;urn:ietf:params:xml:ns:netconf:base:1.0&quot; message-id=&quot;urn:uuid:5cf32451-91af-4f71-a0bd-ead244b81b1f&quot;&gt;
              &lt;data&gt;
                      &lt;interfaces xmlns=&quot;urn:ietf:params:xml:ns:yang:ietf-interfaces&quot;&gt;
                              &lt;interface&gt;
                                      &lt;name&gt;GigabitEthernet1&lt;/name&gt;
                                      &lt;type xmlns:ianaift=&quot;urn:ietf:params:xml:ns:yang:iana-if-type&quot;&gt;ianaift:ethernetCsmacd&lt;/type&gt;   
                                      &lt;enabled&gt;true&lt;/enabled&gt;
                                      &lt;ipv4 xmlns=&quot;urn:ietf:params:xml:ns:yang:ietf-ip&quot;&gt;
                                              &lt;address&gt;
                                                      &lt;ip&gt;192.168.40.30&lt;/ip&gt;
                                                      &lt;netmask&gt;255.255.255.0&lt;/netmask&gt;
                                              &lt;/address&gt;
                                      &lt;/ipv4&gt;
                                      &lt;ipv6 xmlns=&quot;urn:ietf:params:xml:ns:yang:ietf-ip&quot;/&gt;
                              &lt;/interface&gt;
                              &lt;interface&gt;
                                      &lt;name&gt;GigabitEthernet2&lt;/name&gt;
                                      &lt;type xmlns:ianaift=&quot;urn:ietf:params:xml:ns:yang:iana-if-type&quot;&gt;ianaift:ethernetCsmacd&lt;/type&gt;   
                                      &lt;enabled&gt;true&lt;/enabled&gt;
                                      &lt;ipv4 xmlns=&quot;urn:ietf:params:xml:ns:yang:ietf-ip&quot;&gt;
                                              &lt;address&gt;
                                                      &lt;ip&gt;10.10.10.1&lt;/ip&gt;
                                                      &lt;netmask&gt;255.255.255.0&lt;/netmask&gt;
                                              &lt;/address&gt;
                                      &lt;/ipv4&gt;
                                      &lt;ipv6 xmlns=&quot;urn:ietf:params:xml:ns:yang:ietf-ip&quot;/&gt;
                              &lt;/interface&gt;
                              
                      &lt;/interfaces&gt;
              &lt;/data&gt;
      &lt;/rpc-reply&gt; 
  </code></pre>
  <p>Python code: This code returns nothing .</p>
  <pre><code>import xml.etree.ElementTree as ET
      
      tree = ET.parse(&quot;C:\\Users\\Redha\\Documents\\test_network\\interface1234.xml&quot;)
      root = tree.getroot()
      namespaces = {'interfaces': 'urn:ietf:params:xml:ns:yang:ietf-interfaces'  }
      for elem in root.findall('.//interfaces:interfaces', namespaces): 
              s0 = elem.find('.//interfaces:name',namespaces)
              name = s0.text
              print(name)
          
  </code></pre>