Java XML Binding(Java XML 绑定)
问题描述
您使用什么将 XML 绑定到 Java?JAXB、Castor 和 XMLBeans 是一些可用的选择.我看到的比较都是三四年前的.我愿意接受其他建议.编组/解组的性能和易用性是特别重要的.
What are you using for binding XML to Java? JAXB, Castor, and XMLBeans are some of the available choices. The comparisons that I've seen are all three or four years old. I'm open to other suggestions. Marshalling / unmarshalling performance and ease of use are of particular interest.
澄清:我不仅想看看你使用什么框架,还想看看你使用其中一个框架而不是其他框架的理由.
Clarification: I'd like to see not just what framework you use, but your reasoning for using one over the others.
推荐答案
JiBX.以前我使用 Castor XML,但 JiBX 被证明要好得多,尤其是在性能方面(将某些应用程序代码从 Castor XML 直接移植到 JiBX 使其速度提高了 9 倍).我还发现 JiBX 的映射格式比 Castor 的更优雅.
JiBX. Previously I used Castor XML, but JiBX proved to be significantly better, particularly in terms of performance (a straight port of some application code from Castor XML to JiBX made it 9x faster). I also found the mapping format for JiBX to be more elegant than Castor's.
JiBX 通过使用编译后字节码操作而不是 Castor 采用的反射方法来实现其性能.这样做的好处是它对编写映射类的方式要求较少.不需要 getter、setter 和无参数构造函数来满足这些工具.大多数情况下,您可以在不考虑映射问题的情况下编写类,然后不加修改地对其进行映射.
JiBX achieves its performance by using post-compilation bytecode manipulation rather than the reflection approach adopted by Castor. This has the advantage that it places fewer demands on the way that you write your mapped classes. There is no need for getters, setters and no-arg constructors just to satisfy the tools. Most of the time you can write the class without considering mapping issues and then map it without modifications.
这篇关于Java XML 绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Java XML 绑定
- Jersey REST 客户端:发布多部分数据 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01