Parse HTML in Android

前端 未结 5 840
逝去的感伤
逝去的感伤 2020-11-22 06:22

I am trying to parse HTML in android from a webpage, and since the webpage it not well formed, I get SAXException.

Is there a way to parse HTML in Andro

5条回答
  •  无人共我
    2020-11-22 06:45

    Have you tried using Html.fromHtml(source)?

    I think that class is pretty liberal with respect to source quality (it uses TagSoup internally, which was designed with real-life, bad HTML in mind). It doesn't support all HTML tags though, but it does come with a handler you can implement to react on tags it doesn't understand.

提交回复
热议问题