- File input = new File("/tmp/input.html");
- Document doc = Jsoup.parse(input, "UTF-8", "<a href="http://www.CodeSnippet.cn/">http://www.CodeSnippet.cn/");
- Elements links = doc.select("a[href]"); // 链接
- Elements pngs = doc.select("img[src$=.png]");
- // 所有 png 的图片
- Element masthead = doc.select("div.masthead").first();
- // div with class=masthead
- Elements resultLinks = doc.select("h3.r > a"); // direct a after h3
- //该片段来自于http://www.codesnippet.cn/detail/240120131918.html
来源: http://www.codesnippet.cn/detail/240120131918.html