哪个Java DOM Wrapper最好或最受欢迎?

时间:2021-08-09 21:44:45

I've used jdom in the past, and have looked briefly at XOM and DOM4j. Each seems to provide essentially the same thing, as they each provide a simplified wrapper over the (very obtuse) standard W3C DOM APIs.

我过去使用过jdom,并简要介绍了XOM和DOM4j。每个似乎都提供了基本相同的东西,因为它们各自提供了(非常钝的)标准W3C DOM API的简化包装。

I know that JDOM went through some effort to develop a JSR and standardization process at one point, but as far as I know that effort never went anywhere. All of the project appear to be in stasis with little new development in the past several years.

我知道JDOM在某一方面经过了一些努力来开发JSR和标准化过程,但据我所知,努力从来没有去过任何地方。在过去的几年中,所有项目似乎都处于停滞状态,几乎没有新的发展。

Is there a consensus as to which is the best? Also what are the pros and cons of each ?

关于哪个是最好的,是否有共识?每个的优点和缺点是什么?

3 个解决方案

#1


5  

I like XOM, because I like the way Elliotte Rusty Harold thinks. Of the ones you mention I belive it's the one that strays away from the DOM standard API:s the most, but I consider that a benefit.

我喜欢XOM,因为我喜欢Elliotte Rusty Harold的想法。在你提到的那些我相信它是偏离DOM标准API的那个:最多,但我认为这是一个好处。

I once implemented a DOM library for Cocoa, and XOM was my inspiration.

我曾经为Cocoa实现了一个DOM库,XOM是我的灵感来源。

I've worked with JDOM as well, and there's absolutely nothing wrong with it, although I do prefer XOM.

我也使用过JDOM,虽然我更喜欢XOM,但它绝对没有错。

#2


2  

While dom4j is an old player, we have been using it for a while and haven't regret it yet. Strong features: simplicity, xpath support and others. Weak sides: yet to support java 5.0, but version 2.0 has been finally announced.

虽然dom4j是一个老玩家,但我们已经使用了一段时间并且还没有后悔。强大的功能:简单,xpath支持和其他。弱侧:尚未支持java 5.0,但2.0版终于宣布了。

#3


1  

It all depends on the feature set. If you want to benefit from an XSL Transformation Engine (Like Xalan) or an XPath Engine (Like Jaxen or Saxon) I would recommend sticking to the more popular framework available like Apache Xerces, JDOM.

这一切都取决于功能集。如果你想从XSL转换引擎(如Xalan)或XPath引擎(如Jaxen或Saxon)中受益,我建议坚持使用像Apache Xerces,JDOM这样更流行的框架。

After that, it's all a matter of taste. I personnally use a W3C compliant ( org.w3c.* ) like Apache Xerces because they are common enough, reasonably fast and well supported by the Java Community.

在那之后,这都是品味问题。我个人使用符合W3C标准(org.w3c。*)的Apache Xerces,因为它们很常见,速度相当快,并得到Java社区的良好支持。

Of course, if you need blinding speed and do not care about XPath, XQuery or XSL, you can surely find yourself something that is much faster and/or resource-hungry. (i.e. A StAX Implementation)

当然,如果你需要炫目的速度并且不关心XPath,XQuery或XSL,你肯定会发现自己更快和/或资源匮乏的东西。 (即StAX实施)

#1


5  

I like XOM, because I like the way Elliotte Rusty Harold thinks. Of the ones you mention I belive it's the one that strays away from the DOM standard API:s the most, but I consider that a benefit.

我喜欢XOM,因为我喜欢Elliotte Rusty Harold的想法。在你提到的那些我相信它是偏离DOM标准API的那个:最多,但我认为这是一个好处。

I once implemented a DOM library for Cocoa, and XOM was my inspiration.

我曾经为Cocoa实现了一个DOM库,XOM是我的灵感来源。

I've worked with JDOM as well, and there's absolutely nothing wrong with it, although I do prefer XOM.

我也使用过JDOM,虽然我更喜欢XOM,但它绝对没有错。

#2


2  

While dom4j is an old player, we have been using it for a while and haven't regret it yet. Strong features: simplicity, xpath support and others. Weak sides: yet to support java 5.0, but version 2.0 has been finally announced.

虽然dom4j是一个老玩家,但我们已经使用了一段时间并且还没有后悔。强大的功能:简单,xpath支持和其他。弱侧:尚未支持java 5.0,但2.0版终于宣布了。

#3


1  

It all depends on the feature set. If you want to benefit from an XSL Transformation Engine (Like Xalan) or an XPath Engine (Like Jaxen or Saxon) I would recommend sticking to the more popular framework available like Apache Xerces, JDOM.

这一切都取决于功能集。如果你想从XSL转换引擎(如Xalan)或XPath引擎(如Jaxen或Saxon)中受益,我建议坚持使用像Apache Xerces,JDOM这样更流行的框架。

After that, it's all a matter of taste. I personnally use a W3C compliant ( org.w3c.* ) like Apache Xerces because they are common enough, reasonably fast and well supported by the Java Community.

在那之后,这都是品味问题。我个人使用符合W3C标准(org.w3c。*)的Apache Xerces,因为它们很常见,速度相当快,并得到Java社区的良好支持。

Of course, if you need blinding speed and do not care about XPath, XQuery or XSL, you can surely find yourself something that is much faster and/or resource-hungry. (i.e. A StAX Implementation)

当然,如果你需要炫目的速度并且不关心XPath,XQuery或XSL,你肯定会发现自己更快和/或资源匮乏的东西。 (即StAX实施)