简体   繁体   English

使用jsoup读取表内容

[英]Use jsoup to read table content

Can anyone help me figure out why I can't use jsoup to read table in this link below: http://data.fpt.vn/InfoDNS.aspx?domain=google.com I use it to get DNS of a host. 谁能帮我找出原因,为什么我不能使用jsoup读取下面的此链接中的表: http ://data.fpt.vn/InfoDNS.aspx?domain=google.com我使用它来获取主机的DNS。

Here is the code that I used: 这是我使用的代码:

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());
     }
 }
 }

It work with the url of espn and doc.select("table.tablehead"); 它与espn和doc.select(“ table.tablehead”)的网址一起使用; but with fpt url, nothing happen! 但是使用fpt url,什么都不会发生! Thank you for your help! 谢谢您的帮助!

looks like the response you are seeking is not present, when i did the "view source"(in browser) of the link. 当我执行链接的“查看源代码”(在浏览器中)时,看来您正在寻找的响应不存在。

doc.select("table.tabular"); doc.select(“ table.tabular”); // //

"tabular" is not present in response.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM