
Jsoup is a java library for working with real-world html. it provides a very convenient api for extracting and manipulating data, using the best of dom, css, and jquery-like methods.
jsoup implements the whatwg html specification (http://whatwg.org/html), and parses html to the same dom as modern browsers do.
* parse html from a url, file, or string
* find and extract data, using dom traversal or css selectors
* manipulate the html elements, attributes, and text
* clean user-submitted content against a safe white-list, to prevent xss
* output tidy html
jsoup is designed to deal with all varieties of html found in the wild; from pristine and validating, to invalid tag-soup; jsoup will create a sensible parse tree.