title: Using Python ElementTree to Extract Text in XML Tag
body: <p>I have a corpus with tens of thousands of XML file (small sized files) and I'm trying to use Python and extract the text contained in one of the XML tags, for example, everything between the body tags for something like:</p>
  
  <pre><code>&lt;body&gt; sample text here with &lt;bold&gt; nested &lt;/bold&gt; tags in this paragraph &lt;/body&gt;
  </code></pre>
  
  <p>and then write a text document that contains this string, and move on down the list of XML files.</p>
  
  <p>I'm using effbot's ELementTree but couldn't find the right commands/syntax to do this. I found a website that uses miniDOM's dom.getElementsByTagName but I'm not sure what the corresponding method is for ElementTree. Any ideas would be greatly appreciated.</p>