parsing large xml file with Python - etree.parse error

后端 未结 2 1040
长情又很酷
长情又很酷 2021-02-20 14:15

Trying to parse the following Python file using the lxml.etree.iterparse function.

\"sampleoutput.xml\"


  Item 1
         


        
2条回答
  •  猫巷女王i
    2021-02-20 14:36

    As far as I know, xml.etree.ElementTree usually expects the XML file to contain one "root" element, i.e. one XML tag that encloses the complete document structure. From the error message you posted I would assume that this is the problem here as well:

    ´Line 5´ refers to the second tag, so I guess Python complains that there is more data following after the assumed root element (i.e. the first tag) was closed.

提交回复
热议问题