简体   繁体   中英

Having problems parsing HTML + Jsoup

I am trying to parse my html file with jsoup and I need to build Elements object which will contain an array of divs (like on picture below). How can i do that with select syntax?

在此处输入图片说明

Each element of Elements must contains "news":

在此处输入图片说明

Thanks!

You select class names with the dot ( . ) selector, and ids with # , so:

Elements newsClass = myDocument.select(".news");
Elements newsMainId = myDocument.select("#newsMain");

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