开发者

extract paragraphs from HTML page

开发者 https://www.devze.com 2023-02-18 09:12 出处:网络
Using Jsoup, I want to extract all paragraphs from an HTML page, i.e. whatever is between <p> and </p>.

Using Jsoup, I want to extract all paragraphs from an HTML page, i.e. whatever is between <p> and </p>.

How do I accomplish th开发者_StackOverflow中文版is?


Can'y you just do:

myDocument.getElementsByTag('p') 

JSoup getElementsByTag

You can then iterate over the returned elements and get their data/text/ownText / whatever you think is most relevant for what you want to do.

JSoup Element.text()

0

精彩评论

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