I had the opportunity to extract and process only text strings from XML files.

For this need, I was able to achieve it with the following script.

soup = BeautifulSoup(open(path,'r'), "xml")
elements = soup.findChildren(text=True, recursive=True)

The key point is passing text=True, which allows you to retrieve only text nodes.

I hope this serves as a useful reference.