我有一个包含多个article
节点的大 XML 文件。我只包含了一个问题。我尝试在 Python 中解析它以过滤一些数据,但我得到了错误
File "<string>", line unknown
ParseError: undefined entity Ö: line 90, column 17
XML 文件示例
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dblp SYSTEM "dblp.dtd">
<dblp>
<article mdate="2019-10-25" key="tr/gte/TR-0146-06-91-165" publtype="informal">
<author>Alejandro P. Buchmann</author>
<author>M. Tamer Özsu</author>
<author>Dimitrios Georgakopoulos</author>
<title>Towards a Transaction Management System for DOM.</title>
<journal>GTE Laboratories Incorporated</journal>
<volume>TR-0146-06-91-165</volume>
<month>June</month>
<year>1991</year>
<url>db/journals/gtelab/index.html#TR-0146-06-91-165</url>
</article>
</dblp>
从我在谷歌的搜索中,我发现如果节点名称有问题,就会出现这种错误。但是,出现错误的行是author
文本中的第二行。
这是我的 Python 代码
with open('xaa.xml', 'r') as xml_file:
xml_tree = etree.parse(xml_file)