title: Removing tags from a field in an XML file
body: <p>I have an XML file that looks like this:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;posts&gt;
    &lt;row Id=&quot;1&quot; PostTypeId=&quot;1&quot; AcceptedAnswerId=&quot;8&quot; CreationDate=&quot;2012-12-11T20:37:08.823&quot; Score=&quot;67&quot; ViewCount=&quot;17934&quot; Body=&quot;&amp;lt;p&amp;gt;Assuming the world in the One Piece universe is round, then there is not really a beginning or an end of the Grand Line.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;The Straw Hats started out from the first half and are now sailing across the second half.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;Wouldn't it have been quicker to set sail in the opposite direction from where they started?     &amp;lt;/p&amp;gt;&amp;#xA;&quot; OwnerUserId=&quot;21&quot; LastEditorUserId=&quot;1398&quot; LastEditDate=&quot;2015-04-17T19:06:38.957&quot; LastActivityDate=&quot;2015-05-26T12:50:40.920&quot; Title=&quot;The treasure in One Piece is at the end of the Grand Line. But isn't that the same as the beginning?&quot; Tags=&quot;&amp;lt;one-piece&amp;gt;&quot; AnswerCount=&quot;5&quot; CommentCount=&quot;0&quot; FavoriteCount=&quot;2&quot; /&gt;
    &lt;row Id=&quot;2&quot; PostTypeId=&quot;1&quot; AcceptedAnswerId=&quot;33&quot; CreationDate=&quot;2012-12-11T20:39:40.780&quot; Score=&quot;13&quot; ViewCount=&quot;279&quot; Body=&quot;&amp;lt;p&amp;gt;In the middle of &amp;lt;em&amp;gt;The Dark Tournament&amp;lt;/em&amp;gt;, Yusuke Urameshi gets to fully inherit Genkai's power of the &amp;lt;em&amp;gt;Spirit Wave&amp;lt;/em&amp;gt; by absorbing a ball of energy from her.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;However, this process turns into an excruciating trial for Yusuke, almost killing him, and keeping him doubled over in extreme pain for a long period of time, so much so that his Spirit Animal, Poo, is also in pain and flies to him to try to help.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;My question is, why is it such a painful procedure to learn and absorb this power?&amp;lt;/p&amp;gt;&amp;#xA;&quot; OwnerUserId=&quot;26&quot; LastEditorUserId=&quot;247&quot; LastEditDate=&quot;2013-02-26T17:02:31.570&quot; LastActivityDate=&quot;2013-06-20T03:31:39.187&quot; Title=&quot;Why does absorbing the Spirit Wave from Genkai involve such a painful process?&quot; Tags=&quot;&amp;lt;yu-yu-hakusho&amp;gt;&quot; AnswerCount=&quot;1&quot; CommentCount=&quot;0&quot; /&gt;
    &lt;row Id=&quot;3&quot; PostTypeId=&quot;1&quot; AcceptedAnswerId=&quot;148&quot; CreationDate=&quot;2012-12-11T20:42:47.447&quot; Score=&quot;9&quot; ViewCount=&quot;3022&quot; Body=&quot;&amp;lt;p&amp;gt;In Sora no Otoshimono, Ikaros carries around a watermelon like a pet and likes watermelons and pretty much anything else round.  At one point she even has a watermelon garden and attacks all the bugs that get near the melons.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;What's the significance of the watermelon and why does she carry one around?&amp;lt;/p&amp;gt;&amp;#xA;&quot; OwnerUserId=&quot;29&quot; LastActivityDate=&quot;2014-01-15T21:01:55.043&quot; Title=&quot;What's the significance of the watermelon in Sora no Otoshimono?&quot; Tags=&quot;&amp;lt;sora-no-otoshimono&amp;gt;&quot; AnswerCount=&quot;2&quot; CommentCount=&quot;1&quot; /&gt;
  </code></pre>
  <p>Specifically the file contains numerous lines. Each line starts with a <code>row</code> tag. What I want to do is to capture the <code>Body</code> field inside the <code>row</code> tag. For example, the <code>Body</code> field for <code>Id = 2</code> is:</p>
  <pre><code>&quot;&amp;lt;p&amp;gt;In the middle of &amp;lt;em&amp;gt;The Dark Tournament&amp;lt;/em&amp;gt;, Yusuke Urameshi gets to fully inherit Genkai's power of the &amp;lt;em&amp;gt;Spirit Wave&amp;lt;/em&amp;gt; by absorbing a ball of energy from her.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;However, this process turns into an excruciating trial for Yusuke, almost killing him, and keeping him doubled over in extreme pain for a long period of time, so much so that his Spirit Animal, Poo, is also in pain and flies to him to try to help.&amp;lt;/p&amp;gt;&amp;#xA;&amp;#xA;&amp;lt;p&amp;gt;My question is, why is it such a painful procedure to learn and absorb this power?&amp;lt;/p&amp;gt;&amp;#xA;&quot;
  </code></pre>
  <p>I've parsed the <code>Body</code> fields using <code>ElementTree</code>. What I want to do next is to parse the words inside the <code>Body</code> field of each row. For that, I need to strip the <code>Body</code> field of any html tags. For example, after stripping the text of html tags, the <code>Body</code> field of <code>Id = 2</code> should look like this:</p>
  <pre><code>In the middle of The Dark Tournament Yusuke Urameshi gets to fully inherit Genkai's power of the .... (continued)
  </code></pre>
  <p>What I've tried so far:</p>
  <pre><code>def remove_html_tags(text):
          return bs4.BeautifulSoup(text, &quot;html.parser&quot;).text
  </code></pre>
  <p>This results in:</p>
  <pre><code>pin the middle of emthe dark tournamentem yusuke urameshi gets to fully inherit genkais power of the emspirit waveem by absorbing a ball of energy from herp
  phowever this process turns into an excruciating trial for yusuke almost killing him and keeping him doubled over in extreme pain for a long period of time so much so that his spirit animal poo is also in pain and flies to him to try to helpp
  pmy question is why is it such a painful procedure to learn and absorb this powerp
  </code></pre>
  <p>As you can see, the symbols are gone but the texts enclosed inside the symbols remain. What can I do to remove them?</p>