问题
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