title: How to parse XML from string in python
body: <p>I'm trying to parse an XML from a string in Python with no success.
  The string I'm trying to parse is:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&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:573a453c-72c0-4185-8c54-9010593dd102&quot;&gt;
     &lt;data&gt;
        &lt;config xmlns=&quot;http://www.calix.com/ns/exa/base&quot;&gt;
           &lt;profile&gt;
              &lt;policy-map&gt;
                 &lt;name&gt;ELINE_PM_1&lt;/name&gt;
                 &lt;class-map-ethernet&gt;
                    &lt;name&gt;Eth-match-any-1&lt;/name&gt;
                    &lt;ingress&gt;
                       &lt;meter-type&gt;meter-mef&lt;/meter-type&gt;
                       &lt;eir&gt;1000000&lt;/eir&gt;
                    &lt;/ingress&gt;
                 &lt;/class-map-ethernet&gt;
              &lt;/policy-map&gt;
              &lt;policy-map&gt;
                 &lt;name&gt;ELINE_PM_2&lt;/name&gt;
                 &lt;class-map-ethernet&gt;
                    &lt;name&gt;Eth-match-any-2&lt;/name&gt;
                    &lt;ingress&gt;
                       &lt;meter-type&gt;meter-mef&lt;/meter-type&gt;
                       &lt;eir&gt;10000000&lt;/eir&gt;
                    &lt;/ingress&gt;
                 &lt;/class-map-ethernet&gt;
              &lt;/policy-map&gt;
           &lt;/profile&gt;
        &lt;/config&gt;
     &lt;/data&gt;
  &lt;/rpc-reply&gt;
  </code></pre>
  <p>I'm trying to use xml.etree.ElementTree library to parse the xml and I also tried to remove the first line related to xml version and encoding with no results. The code snippet to reproduce the issue I'm facing is:</p>
  <pre><code>import xml.etree.ElementTree as ET
  
  reply_xml='''
  &lt;data&gt;
     &lt;config&gt;
        &lt;profile&gt;
           &lt;policy-map&gt;
              &lt;name&gt;ELINE_PM_1&lt;/name&gt;
              &lt;class-map-ethernet&gt;
                 &lt;name&gt;Eth-match-any-1&lt;/name&gt;
                 &lt;ingress&gt;
                    &lt;meter-type&gt;meter-mef&lt;/meter-type&gt;
                    &lt;eir&gt;1000000&lt;/eir&gt;
                 &lt;/ingress&gt;
              &lt;/class-map-ethernet&gt;
           &lt;/policy-map&gt;
           &lt;policy-map&gt;
              &lt;name&gt;ELINE_PM_2&lt;/name&gt;
              &lt;class-map-ethernet&gt;
                 &lt;name&gt;Eth-match-any-2&lt;/name&gt;
                 &lt;ingress&gt;
                    &lt;meter-type&gt;meter-mef&lt;/meter-type&gt;
                    &lt;eir&gt;10000000&lt;/eir&gt;
                 &lt;/ingress&gt;
              &lt;/class-map-ethernet&gt;
           &lt;/policy-map&gt;
        &lt;/profile&gt;
     &lt;/config&gt;
  &lt;/data&gt;
  '''
  
  root = ET.fromstring(reply_xml)
  for child in root:
      print(child.tag, child.attrib)
  </code></pre>
  <p><code>reply_xml</code> is a string containing the above mentioned xml so it should work but if I inspect the root variable using the debugger I see that it is not being populated correctly.
  It seems that the first xml tag (<code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</code>) creates some problems but even if I manually remove it I am not able to parse the xml correctly.</p>
  <p>Any clue to parse that xml?</p>