i have file.html,i want to open it and extract the links with jsoup library and show those links in the out put of my program how can i use this library to do this???
String html = "<html><head><title>First parse</title></head>"
+ "<body><p>Parsed HTML into a doc.</p></body></html>";
Document doc = Jsoup.parse(html);
i want to do some thing like that,i want that file.html as String and extract the links of that
Assuming you the links are in the section, you'd do...
Element body = Document.body()
This would then give you an element object, you could then use...
body.getElementsByAttribute("href");
which would return you a list of Element of objects of all the links.
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.