title: To find element based on grandchildren tags using elementtree
body: <p>I'm completely new to xml parsing .I have some thousands of xml's and I want to find out all element <strong>DE</strong> , only when I have <strong>country</strong> tag</p>
  <p>Here is my sample xml</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;DE&gt;
     &lt;CT&gt;
        &lt;IG&gt;
           &lt;FS id=&quot;01&quot;&gt;
              &lt;FE id=&quot;A&quot; fId=&quot;B&quot;&gt;
                 &lt;title&gt;Apple&lt;/title&gt;
              &lt;/FE&gt;
           &lt;/FS&gt;
           &lt;country syse=&quot;21&quot; subSys=&quot;2&quot;&gt;
              &lt;FF FR=&quot;101&quot; fe=&quot;01&quot; /&gt;
              &lt;referTo refType=&quot;t06&quot;&gt;
                 &lt;CF Code=&quot;350&quot; /&gt;
              &lt;/referTo&gt;
              &lt;place id=&quot;00A&quot; placeValue=&quot;00AB&quot;&gt;
                 &lt;Q&gt;001&lt;/Q&gt;
                 &lt;TQ&gt;0001&lt;/TQ&gt;
                 &lt;PR Value=&quot;A&quot; CodeValue=&quot;C&quot; /&gt;
              &lt;/place&gt;
              &lt;place id=&quot;00E&quot; placeValue=&quot;00EF&quot;&gt;
                 &lt;Q&gt;001&lt;/Q&gt;
                 &lt;TQ&gt;0001&lt;/TQ&gt;
                 &lt;PR Value=&quot;03&quot; AValue=&quot;957&quot; /&gt;
                 &lt;Books&gt;
                    &lt;IA&gt;
                       &lt;Part /&gt;
                    &lt;/IA&gt;
                    &lt;PRGroup&gt;
                       &lt;country Code=&quot;5&quot;&gt;
                          &lt;PR Value=&quot;02&quot; AValue=&quot;345&quot; /&gt;
                          &lt;constrain&gt;Double condition.&lt;/constrain&gt;
                          &lt;constrain&gt;Double condition.&lt;/constrain&gt;
                       &lt;/country&gt;
                    &lt;/PRGroup&gt;
                 &lt;/Books&gt;
              &lt;/place&gt;
           &lt;/country&gt;
        &lt;/IG&gt;
     &lt;/CT&gt;
  &lt;/DE&gt;
  </code></pre>
  <pre><code>import xml.etree.ElementTree as ET
  tree = ET.parse(content)
  root = tree.getroot()
  Num = root.findall(&quot;//DE[//place/Books/PRGroup/country]&quot;)
  </code></pre>
  <p>am getting predicate error or absolute path error when am trying different ways but am not able to figure this out.<br />
  How can I retrieve the results and access the attributes based on that
  could you please help me on this.</p>