Parsing and traversing documents
Parsing HTML documents:
String html = "
+ "<body><p>parsed HTML into a doc.</p></body>
Document doc = jsoup.parse (HTML);
The parser parses the HTML file as much as possible, regardless of whether the HTML file is well-formed. It can be handled very well:
(1) Non-finished labels (e.g. <p>lorem<p>ipsum resolution to <p>Lorem</p> <p>Ipsum</p>)
(2) Unspecified label (for example: Packaging <td>table data</td> into <table><tr><td>table data </td></tr ></tabel>)
(3) Create a document structure reliably (contains a head and a body of HTML, only the appropriate elements in the head)
Object model of the document
The document contains elements and Textnodes (along with several other MISC nodes: See the node of the package tree).
The inheritance chain is: The document extension Element extension node. Textnode the extension node.
An element contains a series of child nodes that have a parent element. They also provide a filtered list of child elements.
Original: Http://jsoup.org/cookbook/introduction/parsing-a-document
Java parsing HTML Jsoup (translation)-jsoup Cookbook (1)