I am using BeautifulStoneSoup to parse an XML document and change some attributes. I noticed that it automatically converts all XML tags to lowercase. For example, my source file has <DocData>
elements, which BeautifulSoup converts to <docdata>
. This appears to be causing problems since the program I am feeding my modified XML document to does not seem to accept the lowercase versions. Is there a way to prevent this behavior in BeautifulSoup?
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- Illegal to have multiple roots (start tag in epilo
- How to get the background from multiple images by
- Evil ctypes hack in python
No, that's not a built-in option. The source is pretty straightforward, though. It looks like you want to change the value of encodedName in Tag.
__str__.
html.parser
) to xml parsersoup = BeautifulSoup(yourXmlStr, 'xml')