0
   <div id="fareSelectModifySearch"> 
     <table width="100%" cellpadding="0" cellspacing="0" border="0"> 
      <tbody>
           <tr> 
            <td style="padding-left:8px;"><strong>1 Traveler(s)</strong> &nbsp;<span     id="routeInfo">     New York, NY (JFK) to Las Vegas, NV (LAS) on 09/20/2013</span></td> 
           </tr>  
      </tbody>
     </table> 
    </div>

我想提取td元素数据,即

2013 年 9 月 20 日,1 名旅客纽约,纽约 (JFK) 到拉斯维加斯,内华达 (LAS)

谁能给我这个使用Jsoup库的源代码。

4

2 回答 2

0

您是否尝试过 .text() 方法?

来自 jSoup 文档。

 String text() 
      Get the combined text of all the matched elements.
于 2013-08-22T07:10:27.043 回答
0

尝试这个

Document site2 = Jsoup.connect("http://wl.filegenie.com/~ikp4success/test.html")

                .timeout(3000000)

                .get();


        String values = site2.select("td").text();
        System.out.println(values);

我将文件上传到我的服务器仅供参考。

于 2013-08-22T20:42:48.500 回答