尝试使用jsoup轻松解析:
// To parse the html pagedocument doc = Jsoup.connect("http://www.website.com").get();document doc1 = Jsoup.parse("<html><head><title>First parse</title></head>" + "<body> <p>Parsed HTML into a doc.</p></body></html>");String content = doc.body().text();// To get specific elements such as linksElement links = doc.select("a[href]");for(Element e: links){ System.out.println("link: " + e.attr("abs:href"));}
要了解更多信息,请访问Jsoup Docs
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)