Update: 导入 Jsoup 依赖
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package cn.hezhaohui.fund;
|
||||
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
public class Application {
|
||||
public static void main(String[] args) {
|
||||
String htmlString = "<html><head><title>My title</title></head>"
|
||||
+ "<body>Body content</body></html>";
|
||||
|
||||
Document doc = Jsoup.parse(htmlString);
|
||||
String title = doc.title();
|
||||
String body = doc.body().text();
|
||||
|
||||
System.out.printf("Title: %s%n", title);
|
||||
System.out.printf("Body: %s", body);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user