java - Jsoup - seprate all url while download text of a page -


how can use in jsoup remove link while downloading webpage.

i use following code give me text of webpage

public static void url(string urltosearch) throws ioexception {         url = urltosearch;         document doc = jsoup.connect(url).get();          string textonly = jsoup.parse(doc.tostring()).text();         output ob = new output();         ob.write(textonly);      } 

but there way through can separate link while downloading text of page

how can use in jsoup remove link while downloading webpage

you can select a elements href attribute , remove document object representing dom structure of page.

so code can

document doc = jsoup.connect(url).get(); doc.select("a[href]").remove();//remove found `<a href...>` elements dom string textonly = doc.text();//generate text dom without links 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -