title: Python XML Parsing can't find children of children
body: <p>I'm trying to parse XML returned as a string from a http get request. I need to get a specific link inside the XML structure but for some reason I can't get to the link I need.
  I tried <code>**enumerating**</code> the XML and printing <strong><code>child.attrib</code></strong> but the link I need is not displaying.</p>
  
  <p>I need to find an element that is a child of a child and the element is called Vm, then I need to get the .attrib of that element.</p>
  
  <p>Thus, I did some more research and tried finding the XML I needed by node name</p>
  
  <p>The XML structure is:</p>
  
  <pre><code>&lt;vapp&gt;
     &lt;link&gt;&lt;/link&gt;
     &lt;othertags&gt;&lt;/othertags&gt;
     &lt;Children&gt;
        &lt;Vm href='link I need'&gt;
        &lt;other tag options&gt;
        &lt;/other tag options&gt;
        &lt;/vm&gt;
     &lt;/Children&gt;
  &lt;/vapp&gt;
  </code></pre>
  
  <p>python code:</p>
  
  <pre><code>for i, child in enumerate(vappXML):
     if 'href' in child.attrib and 'name' in child.attrib:
        vapp_url =  child.attrib['href']
  
        r=requests.get(vapp_url, headers = new_headers)
        vmlinkXML = fromstring(r.content)
  
        for VM in vmlinkXML.findall('Children'):
           print VM
  
        for i, child in enumerate(vmlinkXML):
           if 'vm-' in child:
              print child.attrib
  
           if 'href' in child.attrib:
              vm_url =  child.attrib['href']
              if 'vm-' in vm_url:
                 print vm_url
  </code></pre>
  
  <p>I can't get to the url no matter how I try. I only get the main child of vApp it never parses the  tag, or rather my code never goes further than the first child of the vapp and I don't know why.</p>
  
  <p>I guess I wasn't clear. I'm parsing vCloud Director Rest API XML that is returned as a string. The first level is the vApp link which is essentially a container for VMs. I need to get the VM link under each vApp. The first one will select vApp links and query them.</p>
  
  <p>Once it does a get request on the vApp link it gets the next level of XML data which is the structure I put above. so it passes the initial XML statement and returns vApp information.</p>
  
  <p>Even when I print out every child.attrib fom vmlinkXML the link with vm doesnt get printed. however, If I just print r.content the link is there. Its almost like the XML parser doesn't see the  tag.</p>
  
  <p><strong>I'm using Pythons XML.etree</strong></p>
  
  <pre><code>from lxml import etree
  from xml.etree.ElementTree import XML, fromstring, tostring
  </code></pre>
  
  <p><strong>So to be clear the structure is:</strong></p>
  
  <p>to get the vApp Links /api/admin/extension/vapps/query
  then the returned information will contain links to each vapp in vCloud.
  then I call the vApp link
  <a href="https://vcloud.test.co/api/vApp/vapp-3b4980e7-c5ab-4462-9cfe-abc6292c15748" rel="nofollow">https://vcloud.test.co/api/vApp/vapp-3b4980e7-c5ab-4462-9cfe-abc6292c15748</a>
  and it will return a structure similar to this:</p>
  
  <pre><code>&lt;vapp&gt;
     &lt;link&gt;&lt;/link&gt;
     &lt;othertags&gt;&lt;/othertags&gt;
     &lt;Children&gt;
        &lt;Vm href='link I need'&gt;
        &lt;other tag options&gt;
        &lt;/other tag options&gt;
        &lt;/vm&gt;
     &lt;/Children&gt;
  &lt;/vapp&gt;
  </code></pre>
  
  <p> Tag contains the next level of link I need to query. However the XML parser with child.attrib never outputs anything under the  tag.</p>