File input = new File("/tmp/input.html"); Document doc = Jsoup.parse(input, "UTF-8", "<a href="http://www.CideSnippet.cn/">http://www.CideSnippet.cn/"); Element content = doc.getElementById("content"); Elements links = content.getElementsByTag("a"); for (Element link : links) { String linkHref = link.attr("href"); String linkText = link.text(); } //源代码片段来自云代码http://yuncode.net