jsoup release 1.8.2
2015-Apr-13
jsoup 1.8.2 dramatically improves performance on Android, in parsing, HTML generation, and querying. Also added is file upload support, W3C DOM interoperability, and a range of other improvements and bug-fixes.
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.
Improvements
- Performance improvements for parsing HTML on Android, of 1.5x to 1.9x, with larger parses getting a bigger speed increase. For non-Android JREs, around 1.1x to 1.2x.
- Dramatic performance improvement in HTML serialization on Android (KitKat and later), of 115x. Improvement by working around a character set encoding speed regression in Android.
- Performance improvement for the class name selector on Android (.class) of 2.5x to 14x. Around 1.2x on non-Android JREs.
- File upload support. Added the ability to specify input streams for POST data, which will upload content in MIME multipart/form-data encoding.
- Add a meta-charset element to documents when setting the character set, so that the document's charset is unambiguous.
- Added ability to disable TLS (SSL) certificate validation. Helpful if you're hitting a host with a bad cert, or your JDK doesn't support SNI.
- Added ability to further tweak the canned Cleaner Whitelists by removing existing settings.
- Added option in Cleaner Whitelist to allow linking to in-page anchors (#)
- Use a lowercase doctype tag for HTML5 documents.
- Add support for 201 Created with redirect, and other status codes. Treats any HTTP status code 2xx or 3xx as an OK response, and follow redirects whenever there is a Location header.
- Added support for HTTP method verbs PUT, DELETE, and PATCH.
- Added support for overriding the default POST character of UTF-8 in
Connection
. - W3C DOM support: added ability to convert from a jsoup document to a W3C document, with the
W3CDom
helper class. - In the
HtmlToPlainText
example program, added the ability to filter using a CSS selector. Also clarified the usage documentation. - Improved the equals() and hashcode() methods in
Node
, to consider all their child content, for DOM tree comparisons. - Improved performance in Selector when searching multiple roots.
Bug Fixes
- Fixed validation of cookie names in HttpConnection cookie methods.
- Fixed an issue where
option
tags would be missed when preparing a form for submission if missing a selected attribute. - Fixed an issue where submitting a form would incorrectly include radio and checkbox values without the checked attribute.
- Fixed an issue where Element.classNames() would return a set containing an empty class; and may have extraneous whitespace.
- Fixed an issue where attributes selected by value were not correctly space normalized.
- In head+noscript elements, treat content as character data, instead of jumping out of head parsing.
- Fixed performance issue when parsing HTML with elements with many children that need re-parenting.
- Fixed an issue where a server returning an unsupport character set response would cause a runtime UnsupportedCharsetException, instead of falling back to the default UTF-8 charset.
- Fixed an issue where Jsoup.Connection would throw an IO Exception when reading a page with zero content-length.
Many thanks to everyone who contributed patches, suggestions, and bug reports. If you have any suggestions for the next release, I would love to hear them; please get in touch via the mailing list or to me directly.