Using Python ElementTree to Extract Text in XML Tag

thedoginthewok

New Member
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:\[code\]<body> sample text here with <bold> nested </bold> tags in this paragraph </body>\[/code\]and then write a text document that contains this string, and move on down the list of XML files.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.
 
Back
Top