thunar

Python lxml: Ignore XML declaration (errors)

一笑奈何 提交于 2019-12-11 08:42:05
问题 I am trying to parse the file browser Thunar's custom actions files ( ~/.config/Thunar/uca.xml ) with the lxml Python module. For some reason, Thunar obviously writes a malformed declaration into these files: <?xml encoding="UTF-8" version="1.0"?> Obviously, the version is expected to appear as the first "attribute" in the declaration. lxml raises an XMLSyntaxError if I try to parse the file. And no, I cannot simply correct the declaration, becaue Thunar keeps overwriting it with the bogus