How to maintain case-sensitive tags in BeautifulSoup.BeautifulStoneSoup? How to maintain case-sensitive tags in BeautifulSoup.BeautifulStoneSoup? xml xml

How to maintain case-sensitive tags in BeautifulSoup.BeautifulStoneSoup?


You could use Beautiful Soup 4, as follows (requires the lxml XML library):

In [10]: from bs4 import BeautifulSoupIn [11]: xml = "<TestTag>a string</TestTag>"In [12]: soup = BeautifulSoup(xml, "xml")In [13]: print soup<?xml version="1.0" encoding="utf-8"?><TestTag>a string</TestTag>In [14]: