2012-10-05 99 views
1

這是我的代碼。jsoup:提取兩個之間的標籤<img>

<table width="100%" cellspacing="0" border="0" cellspadding="20"> 
    <tbody> 
    <tr> 
     <td valign="top" height="50px" align="center"> 
      <span class="footer">Contact Sue Simmons on: tel: 
      <strong>+44 (0)1727 864806  
       <a href="mailto:[email protected]">[email protected]</a> 
       <a href="http://www.aoec.com">www.aoec.com</a> 
      </strong> 
      </span> 
      <br> 
      <a href="https://twitter.com/theaoec/"> 
       <img class="style2" border="0" src="http://www.aoec.com/Images/Icons/twitter.png" alt="Twitter"> 
      </a> 
      <a href="http://www.linkedin.com/groups/AoEC-2429085"> 
       <img class="style2" border="0" src="http://www.aoec.com/Images/Icons/linkedIn.png" alt="LinkedIn"> 
      </a> 
     </td> 
    </tr> 
    </tbody> 
</table> 

我想找出兩個圖像標籤之間的標籤。 我試過它使用nextSiblingElement(),但它不工作,因爲<a>標籤導致問題。

在上面的代碼我把下面的代碼

Document cc = Jsoup.parse(html); 

Elements imageElements = cc.select("img"); 

提到現在我得到的第一個標籤時,提取它。所以我想檢查它與下一個,這兩個圖像是由td,p,div分隔。

回答

1

嘗試JSoup,強烈推薦。

+0

你能寫出你真正想做的事嗎? 「標籤之間的標籤」不是很具體,你想要的實際結果如何? –

+0

檢查我的關於您的查詢的編輯。 –

0

您的圖片標籤之間沒有任何內容。他們在一個「a」標籤內。

請向您的問題添加您想要得到的文字。