简体   繁体   中英

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.

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"); but with fpt url, nothing happen! 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"); //

"tabular" is not present in response.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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