I use lxml as follows to parse the exported XML file from another system:
xmldoc = open(filename) etree.parse(xmldoc)
But I get:
lxml.etree.XMLSyntaxError: Entity 'eacute' not defined, line 4495, column 46
Obviously this has problems with Unicode entity names, but how would I get around this? Via open () or parse ()?
Edit: I forgot to include my DTD in the same folder - now it is and has the following declaration:
<!ENTITY eacute "é">
and mentioned (and always has been) in xmldoc like this:
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE DScribeDatabase SYSTEM "foo.dtd">
But I'm still getting the same problem ... do I need to declare DTDs in Python as well?
source share