I am writing a script that edits an XML file with BeautifulStoneSoup, but the library converts all tags to lower case. Is there an option to conserve the case?
import BeautifulSoup
xml = "<TestTag>a string</TestTag>"
soup = BeautifulSoup.BeautifulStoneSoup(xml, markupMassage=False)
print soup.prettify() # or soup.renderContents()
#prints
>>> <testtag>a string</testtag>
#instead of the expected
>>> <TestTag>a string</TestTag>
You could use Beautiful Soup 4, as follows (requires the lxml XML library):