lxml.etree.XMLSyntaxError: Namespace prefix * for * on * is not defined, line *, column *
I got the following error when I process the following xml input. Is
there a way to let lxml ignore the error.
lxml.etree.XMLSyntaxError: Namespace prefix xsi for nil on
ED_INST_TYPE is not defined, line 1, column 254
<row>
Peng Yu schrieb am 26.01.2018 um 00:25:
I got the following error when I process the following xml input. Is there a way to let lxml ignore the error.
lxml.etree.XMLSyntaxError: Namespace prefix xsi for nil on ED_INST_TYPE is not defined, line 1, column 254
<row>
9347073 <ACTIVITY>DP2</ACTIVITY>NS 1 N 09/13/2017 09/30/2017 06/30/2022 853 DP2NS106663 RFA-RM-16-004 1DP2NS106663-01 </row>
If you only need to parse this once, are really stuck with this and have no way to get the XML file corrected, you might get away with enabling the "recover=True" option in the parser to make it try to recover from errors and keep going, at the risk of losing data along the way. However, I highly recommend to contact the source of the file instead and make them fix it. Ignoring errors means that you cannot be sure which errors were actually hidden and what data you received or lost. Parser errors are there exactly for allowing you to reject the file and blame the source, so that you can comfortably request a correct input file from them. Stefan
participants (2)
-
Peng Yu
-
Stefan Behnel