Jsoup – Quick Start Example

Jsoup is a java library for parsing the html either from URL or String or File.

Dependency

Jsoup dependency can be downloaded from here : http://jsoup.org/download

Quick Start Example

Note : method select(cssQuery) accepts CSS-like selector pattern for finding the elements.

OUTPUT

Title : jsoup Java HTML Parser, with best of DOM, CSS, and jquery

href : /
text : jsoup

href : /news/
text : News

href : /bugs
text : Bugs

href : /discussion
text : Discussion

href : /download
text : Download

href : /apidocs/
text : API Reference

*** omitted the remaining output for readability ***

 

 

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

www.000webhost.com