[英]Using JSoup to Parse a document and remove divs with specific IDs and Classes
即使它很簡單並且已經提出了類似的問題,但我還是無法解決它。
public static Document removeDiv(Document document){
document.getElementById("Wrapper_FixedWidth_Footer").remove();
document.getElementById("u01").remove();
return document;
}`
請將以下文檔作為該方法的輸入。
Document doc = Jsoup.connect("https://www.oracle.com/storage/san/fs1/index.html").ignoreHttpErrors(true).userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Firefox/31.0").timeout(0).get();
更具體地說,我不想包括頁眉和頁腳。 (我不希望此文檔的頁眉和頁腳的相應div下的鏈接)
問題已解決。 看來我在代碼的其他部分檢查的搜尋器和條件有問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.