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