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 绑定
基础教程推荐
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- 降序排序:Java Map 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01