analisando arquivo xml grande com Python - erro etree.parse
Tentando analisar o seguinte arquivo Python usando a função lxml.etree.iterparse.
"sampleoutput.xml"
<item>
<title>Item 1</title>
<desc>Description 1</desc>
</item>
<item>
<title>Item 2</title>
<desc>Description 2</desc>
</item>
Eu tentei o código deAnalisando arquivo XML grande com Python lxml e Iterparse
antes da chamada etree.iterparse (MYFILE) Eu fiz MYFILE = open ("/ Users / eric / Desktop / wikipedia_map / sampleoutput.xml", "r")
Mas aparece o seguinte erro
Traceback (most recent call last):
File "/Users/eric/Documents/Programming/Eclipse_Workspace/wikipedia_mapper/testscraper.py", line 6, in <module>
for event, elem in context :
File "iterparse.pxi", line 491, in lxml.etree.iterparse.__next__ (src/lxml/lxml.etree.c:98565)
File "iterparse.pxi", line 543, in lxml.etree.iterparse._read_more_events (src/lxml/lxml.etree.c:99086)
File "parser.pxi", line 590, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:74712)
lxml.etree.XMLSyntaxError: Extra content at the end of the document, line 5, column 1
alguma ideia? obrigado!