Tutorial by Examples

Jsoup can be be used to easily extract all links from a webpage. In this case, we can use Jsoup to extract only specific links we want, here, ones in a h3 header on a page. We can also get the text of the links. Document doc = Jsoup.connect("http://stackoverflow.com").userAgent("Mozi...
Selecting only the attribute value of a link:href will return the relative URL. String bodyFragment = "<div><a href=\"/documentation\">Stack Overflow Documentation</a></div>"; Document doc = Jsoup.parseBodyFragment(bodyFragment); ...
Jsoup can be used to manipulate or extract data from a file on local that contains HTML. filePath is path of a file on disk. ENCODING is desired Charset Name e.g. "Windows-31J". It is optional. // load file File inputFile = new File(filePath); // parse file as HTML document ...

Page 1 of 1