最佳StAX实施
时间:2020-03-06 14:36:05 来源:igfitidea点击:
我的快速搜索显示了参考实现(http://stax.codehaus.org),Woodstox实现(http://woodstox.codehaus.org)和Sun的SJSXP实现(https://sjsxp.dev.java.net /)。
请评论它们的相对优点,并让我介绍我应考虑的任何其他实现。
解决方案
值得注意的是:
SJSXP performance is consistently faster than BEA, Oracle and RI for all of the documents described here in this study. However, it lags behind Woodstox and XPP3 in some document sizes and in the best cases, exhibits similar performance compared to these two parsers.
Sun上的文章:用于XML解析器的流API
http://javolution.org/具有良好的StAX实现
伍德斯托克斯为我赢得了每一次胜利。这不仅是性能,不是sjsxp抽搐而过于ped腐,woodstox就是这样。
对Javolution的评论:不,这不是Stax实现。它确实实现了类似于Stax的API,但是由于Javolution避免使用Strings等,因此它不能与源兼容。
无论哪种方式,它们的实现都不是特别好-它的速度并不快,并且功能不足,无法检测到xml问题(例如重复属性),也不会处理实体等。因此,除非我们对所有内容都使用Javolution类,否则我没有太多理由使用它。