我在哪里可以找到的Java XML框架的详细比较? [英] Where I can find a detailed comparison of Java XML frameworks?

查看:302
本文介绍了我在哪里可以找到的Java XML框架的详细比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想选择我的Java项目的XML处理框架,我的名字.. XOM,JDOM,等我在哪里可以找到所有流行的Java XML框架的详细比较失去了什么?

I'm trying to choose an XML-processing framework for my Java projects, and I'm lost in names.. XOM, JDOM, etc. Where I can find a detailed comparison of all popular Java XML frameworks?

推荐答案

由于布莱斯指出,坚持使用标准。但也有在此期间创造解决不同的问题/用例的多个标准。选择哪一个完全取决于您的要求。我希望下面的比较可以帮助您选择是正确的。

As Blaise pointed out stick with the standards. But there are multiple standards created over the period to solve different problems/usecases. Which one to choose completely depends upon your requirement. I hope the below comparison can help you choose the right one.

现在有两件事情你必须选择。 API API的实现(有很多)

Now there are two things you have to choose. API and the implementations of the API (there are many)

SAX:优点


  • 基于事件的

  • 内存使用效率

  • 比DOM快

  • 支持架构验证

SAX:缺点


  • 没有对象模型,你必须挖掘
    这些事件,并创建你自己

  • XML的单解析,并且只能
    前进

  • 只读API

  • 没有XPath的支持

  • 有点难以用

DOM:优点


  • 在内存中的对象模型

  • preserves元素顺序

  • 双向

  • 读取和写入API

  • XML操作

  • 使用简单

  • 支持架构验证

DOM:缺点


  • 内存消耗较大的XML文档
    (通常用于XML文档
    小于10 MB)


  • 即你工作的节点通用模型

斯塔克斯:优点


  • 最佳SAX和DOM DOM即易于的
    和SAX的效率

  • 内存使用效率

  • 拉模型

  • 读取和写入API

  • 支持subparsing

  • 可以读取多个文档同时
    在一个单线程

  • XML的并行处理是比较容易

斯塔克斯:缺点


  • 没有架构验证支持(据
    我记得,不知道他们是否有
    现在添加)

  • 只能前进喜欢萨克斯

  • 没有XML操作

JAXB:优点


  • 允许您访问和处理XML
    无需知道XML数据

  • 双向

  • 更多的内存比DOM高效

  • SAX和DOM是通用的解析器在哪里
    作为JAXB创建具体到一个解析器
    您的XML Schmea

  • 数据转换:JAXB可以转换XML
    Java类型

  • 支持通过对象XML操作
    API

JAXB:缺点


  • 只能解析有效的XML

特里克斯:对于使用XSLT从1格式XML转换成另一种形式

Trax: For transforming XML from 1 form to another form using XSLT

SAX,DOM,斯塔克斯,JAXB只是规范。有许多开源和这些规范的商业实现。大多数时候,你可以坚持用什么来与JDK或应用程序服务器。但有时你需要使用默认提供不同的实现。这是在那里你可以AP preciate的 JAXP包装API JAXP ,您可以通过配置切换的实现,而不需要修改code。它还提供了解析,转换,验证和查询XML文档的解析器/规格无关的API。

SAX, DOM, Stax, JAXB are just specifications. There are many open source and commercial implementations of these specifications. Most of the time you can just stick with what comes with JDK or your application server. But sometimes you need to use a different implementation that provided by default. And this is where you can appreciate the JAXP wrapper api. JAXP allows you to switch implementations through configuration without the need to modify your code. It also provides a parser/spec independent api for parsing, transformation, validation and querying XML documents.

性能和各种实现的其他比较


  • 斯塔克斯:
    <一href=\"http://java.sun.com/performance/reference/whitepapers/StAX-1_0.pdf\">http://java.sun.com/performance/reference/whitepapers/StAX-1_0.pdf

  • 大多数的API:
    <一href=\"http://www.ibm.com/developerworks/xml/library/x-databdopt2/\">http://www.ibm.com/developerworks/xml/library/x-databdopt2/

  • JAXB与上SO XmlBeans的讨论:VS的Apache XMLBeans的
  • JAXB
  • http://www.ibm.com/developerworks/xml/library/x-injava/

  • Stax: http://java.sun.com/performance/reference/whitepapers/StAX-1_0.pdf
  • Most of the API: http://www.ibm.com/developerworks/xml/library/x-databdopt2/
  • JAXB versus XmlBeans discussion on SO: JAXB vs Apache XMLBeans
  • http://www.ibm.com/developerworks/xml/library/x-injava/

现在的标准是好的,但过一段时间,你会遇到这样的疯狂的用例,你必须支持为 100千兆字节大小 XML文档的解析,或者您需要的超高速 XML的处理(可能是你正在实施一个XML解析器芯片),这是当你需要倾倒的标准和寻找做事情的方式不同。其有关使用正确的工具合适的工作!而这正是我建议你看看 VTD-XML

Now standards are good but once in a while you encounter this crazy usecase where you have to support parsing of XML document that is 100 gigabytes of size or you need ultra fast processing of XML (may be your are implementing a XML parser chip) and this is when you need to dump the standards and look for a different way of doing things. Its about using the right tool for the right job! And this is where I suggest you to have a look at vtd-xml

在SAX和DOM的最初几天,人们希望比它们中的提供简单的API的。 JDOM dom4j的,的XmlBeans 的JiBX ,的Castor 是我所知道的那些走红。

During the initial days of SAX and DOM, people wanted simpler API's than provided by either of them. JDOM, dom4j, XmlBeans, JiBX, Castor are the ones I know that became popular.

这篇关于我在哪里可以找到的Java XML框架的详细比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆