既然 XMLBeans 已经退役了,用什么来代替它呢?

What to use instead of XMLBeans now that it has been retired?(既然 XMLBeans 已经退役了,用什么来代替它呢?)

本文介绍了既然 XMLBeans 已经退役了,用什么来代替它呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始一个拥有第三方 XSD 的新项目.我的 Java 应用程序需要生成和读取符合此 XSD 的 XML 消息.过去,我为此使用了 Apache XMLBeans.看起来 XMLBeans 已经退役了.

I am starting a new project where I have third party XSD. My Java application needs to generate, and readm XML messages that conform to this XSD. In the past I have used Apache XMLBeans for this. It looks like XMLBeans has been retired.

现在 XMLBeans 已经退役了,有什么好的替代品呢?我在其他项目中使用过 XStream 但我不记得 XStream 有能力生成 Java来自 XSD 的类,所以我认为对于这个用例来说,它不是 XMLBeans 的好选择.我在 XSD 中定义了数百种类型,并且真的不希望必须创建数百个 Java 类来手动在 Java 中表示它们.

What is a good replacement for XMLBeans now that it has been retired? I have used XStream on other projects but I don't recall that XStream has the ability to generate Java classes from an XSD so I am thinking that it is not a good choice over XMLBeans for this use case. I have hundreds of types defined in the XSD and would really prefer not to have to create the hundreds of Java classes to represent them in Java by hand.

换句话说,使用 XStream 示例,我有一个 在 XSD 中定义的 Person 类型(和其他 99 个).使用 XMLBeans 我可以生成 Java 类来表示这些对象,但是使用 XStream 我需要手动或使用其他工具来创建 Java 类(例如 Person).在这种情况下我应该使用什么工具?

In other words, using the XStream example, I have a Person type (and 99 others) defined in the XSD. Using XMLBeans I can generate the Java classes to represent these objects, but using XStream I would need to create the Java classes (e.g. Person) by hand or using some other tool. What tool should I use in this case?

推荐答案

你看过 JAXB 吗?我没有对其中任何一个做过任何事情,但是在谷歌上搜索XMLBeans 的替代品"会带来很多对这个包的引用.这是一篇比较它们的文章...

Have you looked at JAXB? I haven't done anything with either of these, but googling for "alternative to XMLBeans" brings up lots of references to this package. Here's an article that compares them...

http://blog.bdoughan.com/2012/01/how-does-jaxb-compare-to-xmlbeans.html

这篇关于既然 XMLBeans 已经退役了,用什么来代替它呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:既然 XMLBeans 已经退役了,用什么来代替它呢?

基础教程推荐