I receive xml strings from an external source that can contains unsanitized user contributed content.
The following xml string gave a ParseError in cElementTre
cElementTre
It seems to complain about \x08 you will need to escape that.
\x08
Edit:
Or you can have the parser ignore the errors using recover
recover
from lxml import etree parser = etree.XMLParser(recover=True) etree.fromstring(xmlstring, parser=parser)