[英]Use jsoup to read table content
誰能幫我找出原因,為什么我不能使用jsoup讀取下面的此鏈接中的表: http ://data.fpt.vn/InfoDNS.aspx?domain=google.com我使用它來獲取主機的DNS。
這是我使用的代碼:
import java.net.URL;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;
import org.jsoup.nodes.TextNode;
import org.jsoup.select.Elements;
public class dnsjava {
public static void main(String... args) throws Exception {
String fpt = "http://data.fpt.vn/InfoDNS.aspx?domain=google.com";
String espn = "http://espn.go.com/mens-college-basketball/conferences/standings/_/id/2/year/2012/acc-conference"
org.jsoup.nodes.Document doc = Jsoup.connect(fpt).get();
Elements table = doc.select("table.tabular");
for (Element row : table.select("tr")) {
Elements tds = row.select("td");
System.out.println(tds.text());
System.out.println(tds.text());
}
}
}
它與espn和doc.select(“ table.tablehead”)的網址一起使用; 但是使用fpt url,什么都不會發生! 謝謝您的幫助!
當我執行鏈接的“查看源代碼”(在瀏覽器中)時,看來您正在尋找的響應不存在。
doc.select(“ table.tabular”); //
"tabular" is not present in response.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.