How to parse badly formed XML in Java?

后端 未结 3 667
清酒与你
清酒与你 2021-01-04 20:14

I have XML that I need to parse but have no control over the creation of. Unfortunately it\'s not very strict XML and contains things like:

This         


        
3条回答
  •  旧时难觅i
    2021-01-04 20:50

    Use libraries such as tidy or tagsoup.

    TagSoup, a SAX-compliant parser written in Java that, instead of parsing well-formed or valid XML, parses HTML as it is found in the wild: poor, nasty and brutish, though quite often far from short.

提交回复
热议问题