jsoup is a Java library that simplifies working with real-world HTML and XML. It offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM API methods, CSS, and XPath selectors. jsoup implements the WHATWG HTML5 specification and parses HTML to the same DOM as modern browsers. With jsoup, you can scrape and parse HTML from a URL, file, or string; find and extract data using DOM traversal or CSS selectors; manipulate HTML elements, attributes, and text; clean user-submitted content against a safelist to prevent XSS attacks; and 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, creating a sensible parse tree. For example, you can fetch the Wikipedia homepage, parse it to a DOM, and select the headlines from the "In the news" section into a list of elements.