問題描述
我正在尋找最新的、內存效率高的高性能 java XML 解析 API.我需要解析 3 MB 到 5 MB 的 XML 文件.
I am looking for latest, memory efficient and high-performance java XML parsing API. I need to parse 3 MB to 5 MB XML files.
我對此進行了谷歌搜索,了解到 Sun Java Streaming XML Parser (SJSXP) 和 Woodstox 比 DOM 快得多.薩克斯.兩者都使用 StAX API.*這些技術不支持模式驗證.
I did google on this and come to know about Sun Java Streaming XML Parser (SJSXP) and Woodstox is much faster than DOM & SAX. Both are using StAX API. *schema validation is not supported by these technologies.
Aalto XML 處理器也實現了 StAX API.
Aalto XML processor is also implements StAX API.
我還沒有找到關于這些技術性能的具體發現.
I have not found concrete findings on performance on these technologies.
在內存效率、高性能和易用性方面哪一個是最好的?
Which one will be best in context of memory efficient, high-performance and ease of use ?
推薦答案
這里還有一些可能相關的鏈接:
Here are some more links that might be relevant:
- 用于數據綁定的 Stax 實現:http://technotes.blogs.sapo.pt/1708.html
- 高效使用 Woodstox:http://www.cowtowncoder.com/blog/archives/2006/06/entry_2.html
- 使用 Woodstox 加速 XSLT:http://www.cowtowncoder.com/blog/archives/2009/04/entry_235.html
性能方面:SJSXP 最慢;它只是 Xerces 內部的重新包裝,包裝在 Stax API 中.這對性能有一些負面影響(因為它并不是真正為拉解析而設計的).伍德斯托克斯快一點;小文檔和寫作速度更快,解析較長文檔時差異更小.
As to performance: SJSXP is the slowest; it's just a repackage internals of Xerces, wrapped in Stax API. This has some negative effects on performance (since it's not really designed for pull parsing). Woodstox is bit faster; much faster for small documents and writing, less difference when parsing longer documents.
到目前為止,Aalto 是三者中最快的,尤其是在解析方面.它通常比 Woodstox 或 SJSXP 快 50% - 100%.一個缺點是它不處理 DTD(因此不處理外部實體;它處理預定義和字符實體).
And Aalto is by far fastest of the three, especially for parsing. It is commonly 50% - 100% faster than either Woodstox or SJSXP. One downside is that it does not handle DTDs (and thereby not external entities; it handles pre-defined and character entities).
免責聲明:我是 Woodstox 和 Aalto 的作者;以及 SJSXP 的貢獻者(錯誤修復)
Disclaimer: I am author of Woodstox and Aalto; as well as contributor to SJSXP (bug fixes)
這篇關于Java - XML 解析器性能:Sun Java Streaming XML Parser (SJSXP) vs Woodstox的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!