title: Printing XML text file in Python?
body: <p>I want to print any text between pair of tags <code>&lt;en&gt;</code> as long as x='PERS', I tried that below, but the output was not what I wanted.</p>
  
  <p><strong>XML Sample</strong></p>
  
  <pre><code>&lt;Text&gt;
  &lt;PHRASE&gt;
  &lt;en x='PERS'&gt; John &lt;/en&gt;
  &lt;V&gt; Went &lt;/V&gt;
  &lt;prep&gt; to &lt;/prep&gt;
  &lt;V&gt; meet &lt;/V&gt;
  &lt;en x='PERS'&gt; Alex &lt;/en&gt;
  &lt;/PHRASE&gt;
  &lt;PHRASE&gt;
  &lt;en x='PERS'&gt; Mark &lt;/en&gt;
  &lt;V&gt; lives &lt;/V&gt;
  &lt;prep&gt; in &lt;/prep&gt;
  &lt;en x='LOC'&gt; Florida &lt;/en&gt;
  &lt;/PHRASE&gt;
  &lt;PHRASE&gt;
  &lt;en x='PERS'&gt; Nick &lt;/en&gt;
  &lt;V&gt; visited&lt;/V&gt;
  &lt;en x='PERS'&gt; Anna &lt;/en&gt;
  &lt;/PHRASE&gt;
  &lt;/TEXT&gt;
  </code></pre>
  
  <p><strong>I want the output:</strong> John-Alex,Nick-Anna. 
  but I got : Mark-Mark. Meaning that I only want to print 2 PERS when they appear in one phrase</p>
  
  <p>This is the code I wrote, I used element tree.</p>
  
  <pre><code>import xml.etree.ElementTree as ET
  tree = ET.parse('output.xml')
  root = tree.getroot()
  print("------------------------PERS-PERS-------------------------------")
  PERS_PERScount=0
  for phrase in root.findall('./PHRASE'):
      ens = {en.get('x'): en.text for en in phrase.findall('en')}
      if 'PERS' in ens and 'PERS' in ens:
          print("PERS is: {}, PERS is: {} /".format(ens["PERS"], ens["PERS"]))
          #print(ens["ORG"])
          #print(ens["PERS"])
          PERS_PERScount = PERS_PERScount + 1
  print("Number of PERS-PERS relation", PERS_PERScount)
  </code></pre>
  
  <p>I am not sure if the problem is in print or the if condition, or both ?!</p>