jsoup 1.5.1 released

2011-Feb-19 jsoup 1.5.1 has been released and is now available for download.

Faster selectors

jsoup now implements single-pass selector evaluators, contributed by Anton Kazennikov. This significantly speeds up the execution of combined selector queries.

Previously when selecting elements with a combined selector (e.g. div:contains(text)), jsoup would make multiple passes through the DOM for each component of the query, extracting each element that matched the sub-component, then merging and filtering the final result set. The new implementation does the filtering as elements are extracted, enabling a fast single pass through the DOM for the most complicated queries.

Scala support

Brandon Beck contributed a fix that enables jsoup to work in Scala.

Features, fixes, and improvements

  • Added ability to change an element's tag with Element.tagName(String), and to change many at once with Elements.tagName(String).
  • Added Node.wrap(String), Node.before(String), and Node.after(String), to allow HTML to be easily added to all nodes. These functions were previously supported on Elements only.
  • Added TextNode.splitText(int), which allows a text node to be split into two nodes at a specified index point. This is convenient if you need to surround some text in an element.
  • Updated Jsoup.Connect so that cookies set on a redirect response will be included on both the redirected request and response.
  • Infinite redirection loops in Jsoup.connect are now prevented.
  • Allow Jsoup.connect to parse application/xml and application/xhtml+xml responses.
  • Modified Jsoup.connect to always follow relative links, regardless of the underlying HTTP sub-system.
  • Defined U (underline) element as an inline tag.
  • Force strict entity matching (must be &xxx; and not &xxx) in element attributes.
  • Implemented Elements.clone() (contributed by knz).
  • Fixed tokeniser optimisation when scanning for missing data element close tags.
  • Fixed issue when using descendant regex attribute selectors.