开发者

Java HTML parsers modify page

开发者 https://www.devze.com 2023-03-21 11:53 出处:网络
开发者_StackOverflow社区Is it possible to use some kind of an HTML parser with which I will choose information under which tag I want to display, and just clear all the rest?
开发者_StackOverflow社区

Is it possible to use some kind of an HTML parser with which I will choose information under which tag I want to display, and just clear all the rest?

I tried using Jsoup. Developing for android. durig selection my application crashes due to 'outofmemmoryerror'


You can extract portion of tag using JSoup and can separate it out

For Example :

String html = "<p>An <a href='http://example.com/'><b>example</b></a> link.</p>";
Document doc = Jsoup.parse(html);
Element link = doc.select("a").first();
String text = doc.body().text(); // "An example link" , and ignore the rest
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号