我试图用BeautifulSoup解析不正确的xml代码:
from bs4 import BeautifulSoup as bs
soup = bs(myXML, "xml")
myXML
代码如下所示:
<body> text <a> more text <b> text </a> why do people do this </b> text </body>
我真的想解析一下:(我注意到谷歌Chrome以这种方式解决了问题)
<body> text <a> more text <b> text </b></a><b> why do people do this </b> text </body>
但BeautifulSoup将标签切换为以下内容:
<body> text <a> more text <b> text </b> why do people do this </a> text </body>
BeautifulSoup中是否有设置来修复此问题?或者我应该使用可以处理此问题的其他解析器(如果是,哪个)?