把Java对象映射成XML文档,这是Java对象持久化的一种新思路。在XML.com的一篇文章里,作者对四种主要的Java-XML映射工具进行了全面的比较:
- Breeze XML Binder, a tool produced by Breeze Factor
- Castor, an open source project under ExoLab
- JAXB Reference Implementation, created by SUN
- SOApxdk">XGen, a tool produced by Commerce One.
比较的标准主要有以下几条:(1)对XML大纲(schema)特性的支持程度;(2)生成Java代码的可用性;(3)Java-XML转换(以及反向转换)的工作情况。
测试的结果如下。可以看到,Sun的JAXB参考实现竟然有着绝佳的表现,不论在性能还是特性集方面,都仅次于XGen,名列第二。这让我对JAXB又多了几分信心。
2003-9-9908201.gif" width=492 border=0>

Feature
Breeze
Castor
JAXB RI
XGen
Customization Disallowed
![]()
![]()
![]()
![]()
Package Name Mapped from Namespace
![]()
![]()
1
![]()
Automatic Unmarshaling
![]()
![]()
![]()
![]()
Open Source
![]()
![]()
2
![]()
Free of Charge
![]()
![]()
![]()
![]()
Schema Location Roundtrippable
![]()
![]()
![]()
![]()
Schema Location Settable
![]()
3
3
![]()
Schemas without a Target Namespace Supported
![]()
![]()
![]()
![]()
Instance Validation on Unmarshal
![]()
![]()
4
![]()
Constraint Check of Values on Set
5
![]()
![]()
![]()
Value Validation when Marshaling
![]()
![]()
![]()
5
Code Generation Command Line Tool Interface
![]()
![]()
![]()
![]()
Code Generation Programmatic Interface
![]()
![]()
![]()
![]()
Code Generation GUI Interface
![]()
![]()
![]()
![]()
Generated Code Implements Generic Interfaces
![]()
![]()
6
![]()
1 -- Mapped if no other package name is specified.
2-- JAXB will be available as an open source project in the upcoming future. More information can be found at .NET/">http://jaxb.dev.java.net/.
3 -- Only on marshaller class.
4 -- Off by default.
5 -- Some values validated.
6 -- Interfaces based on functionality instead of type of XML Schema construct.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-962416/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10752043/viewspace-962416/
本文对比了四种Java-XML映射工具:BreezeXMLBinder、Castor、JAXB及XGen。从XML大纲支持程度、代码可用性和转换工作情况等方面进行了详细评估。结果显示,JAXB表现出色。
2606

被折叠的 条评论
为什么被折叠?



