简体   繁体   中英

How get one phrase from HTML by JSOUP

For example i have HTML-block:

<h2><a href="http://google.ru" style="text-decoration: underline;"><img src="http://any_image.jpg"/></a>some_text</h2>

And i want to get word "some_text". If i use code like this:

Elements elements = doc.select("h2");

I will get all code. Help please, i'm newer in JSOUP

尝试这个:

String text = doc.select("h2").first().text();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM