What to use instead of XMLBeans now that it has been retired?

眉间皱痕 提交于 2019-11-30 00:28:11

问题


I'm starting a new project where I have third party XSD. My Java application needs to generate XML messages that conform to this XSD and read incoming XML messages that conform to this XSD. In the past I have used Apache XMLBeans for this (http://xmlbeans.apache.org/). It looks like XMLBeans has been retired. 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'm 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.

In other words, using the XStream example given here: http://x-stream.github.io/tutorial.html, 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?

Any help would be greatly appreciated.

Thanks, John


回答1:


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



来源:https://stackoverflow.com/questions/27727546/what-to-use-instead-of-xmlbeans-now-that-it-has-been-retired

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!