jsoup Java HTML Parser release 1.14.3
jsoup 1.14.3 is out now, adding native XPath selector support, and also includes a number of bug fixes, improvements, and performance enhancements.
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 HTML5 DOM methods and CSS selectors.
Download jsoup now.
- Added native XPath support with
- Added full support for the
<template>tag, up to the HTML5 parser spec.
- Added support in
CharacterReaderto track newlines, so that parse errors can be reported more intuitively.
- Tracked parse errors now have more details, including the erroneous token, to help clarify the errors.
- Speed and memory optimizations for the
:containsOwn(text)selectors are now whitespace normalized, aligning to the document text that they are matching against.
Element, speed optimized adopting all of an element's child nodes into a currently empty element. Improves the HTML adoption agency algorithm when adopting elements with many children.
- Increased the parse speed when in
<title>) and unescaped
<tag>tokens are found, by memoizing the
</title>scan and reducing GC.
- When parsing custom tags (in HTML or XML), added a flyweight cache on
Tag.valueOf(String)to reduce memory overhead when many tags are repeated. Also tuned other areas of the parser when many very deeply stacked custom elements were present.
- The OSGi bundle meta-data incorrectly set a version on the import of javax.annotation (used as a build-time dependency for nullability assertions).
- When tracking errors or checking for validity in the
Cleaner, errors were incorrectly raised for missing optional closing tags.
Attributes.equals()method was sensitive to the order of its contents, but it should not be.
- When the HTML parser was configured to preserve case,
Elementtext methods would miss adding whitespace for
- Attribute names are now normalized & validated correctly for the specific output syntax (HTML or XML). Previously, syntactically invalid attribute names could be output by the
html()methods. Such attributes are still available in the DOM, and will be normalized if possible on output.
- Bugfix [Fuzz]: fixed an IOOB when an empty select tag was followed by a body tag that needed reparenting.
- Fixed nullability annotations for
Node.equals(Object)and other equals methods.
- Added JDK 17 to the CI builds.
My sincere 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 with me directly.