簡體   English   中英

jsoup:提取兩個之間的標簽<img>

[英]jsoup : Extract Tags between two <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:info@aoec.com">info@aoec.com</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分開。

試試JSoup ,強烈推薦。

您的圖片標簽之間沒有任何內容。 它們在“ a”標簽內。

請在您的問題中添加您想要的文本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM