ParseError: not well-formed (invalid token) using cElementTree

前端 未结 13 1043
日久生厌
日久生厌 2020-12-16 11:10

I receive xml strings from an external source that can contains unsanitized user contributed content.

The following xml string gave a ParseError in cElementTre

13条回答
  •  独厮守ぢ
    2020-12-16 11:39

    What helped me with that error was Juan's answer - https://stackoverflow.com/a/20204635/4433222 But wasn't enough - after struggling I found out that an XML file needs to be saved with UTF-8 without BOM encoding.

    The solution wasn't working for "normal" UTF-8.

提交回复
热议问题