jsoup 1.8.1 發布,極大的性能提升!

jopen 10年前發布 | 8K 次閱讀 jsoup

jsoup 1.8.1 發布啦!

jsoup 1.8.1 顯著提升了文本和樹序列化的性能;可以選擇 HTML 或者 XML 輸出;還有大量的功能改進和 bug 修復。此版本現已提供下載

更新內容如下:

改進

  • 可以選擇 HTML 或者 XML 輸出,默認是 HTML

  • Element.text() 性能改進

  • Element.html() 性能改進

  • 縮短文件讀的時間,同時也改進了文件解析器,提升大概 10% 的速度

  • 添加 Element.cssSelector()

  • Tightened the scope of what characters are escaped in attributes and textnodes, to align with the spec.

  • 如果禁用了 pretty-print,將不會去除 Element.html() 以外的空格

  • HTML Cleaner 中允許基礎白名單中帶有 span 標簽,relaxed whitelist 中帶有 spandiv 標簽

  • 放松 doctype 驗證,可以不指定名稱

  • CSS Selectors 支持 quoted 屬性值

Bug 修復

  • Fixed an issue where <svg><img/></svg> was parsed as <svg><image/></svg>

  • Fixed an issue where a UTF-8 BOM character was not detected if the HTTP response did not specify a charset, and the HTML body did, leading to the head contents incorrectly being parsed into the body. Changed the behavior so that when the UTF-8 BOM is detected, it will take precedence for determining the charset to decode with.

  • Fixed an issue in parsing a base URI when loading a URL containing a http-equiv element.

  • Fixed an issue for Java 1.5 / Android 2.2 compatibility, and verify it doesn't regress.

  • Fixed an issue that would throw an NPE when trying to set invalid HTML into a title element.

  • Fixed support for nth-of-type selectors with unknown tags.

  • Added support for application/*+xml mimetypes.

  • Fixed support for allowing script tags in cleaner whitelists.

更多內容請看發行說明

jsoup 是一款 Java 的HTML 解析器,可直接解析某個URL地址、HTML文本內容。它提供了一套非常省力的API,可通過DOM,CSS以及類似于JQuery的操作方法來取出和操作數據。

jsoup的主要功能如下:

  1. 從一個URL,文件或字符串中解析HTML;

  2. 使用DOM或CSS選擇器來查找、取出數據;

  3. 可操作HTML元素、屬性、文本;

jsoup是基于MIT協議發布的,可放心使用于商業項目。

來自:http://www.oschina.net/news/55684/jsoup-1-8-1

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!