How to parse invalid (bad / not well-formed) XML?

后端 未结 4 685
自闭症患者
自闭症患者 2020-11-21 04:44

Currently, I\'m working on a feature that involves parsing XML that we receive from another product. I decided to run some tests against some actual customer data, and it lo

4条回答
  •  难免孤独
    2020-11-21 05:14

    A standard XML parser will NEVER accept invalid XML, by design.

    Your only option is to pre-process the input to remove the "predictably invalid" content, or wrap it in CDATA, prior to parsing it.

提交回复
热议问题