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

2

24

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.

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.

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?

Posey answered 1/1, 2015 at 0:41 Comment(7)
If you are using axis2, be sure to checkout the options they suggest in ADB, JiBX and XMLBeans (now retired) here.Luanneluanni
Use xsd to generate the classesParticiaparticipant
Sorry, but requests for library recommendations are explicitly off-topic. I suggest that you Google for "xsd java generate" ... or try the "software recommendations" site; see below.Geochemistry
Why do you say XMLBeans is "retired"? Do you know any official statements?Headstock
If you go to the xml beans site there is a banner at the top indicating the project has been retired: xmlbeans.apache.orgPosey
Yes it does! Started this week! From that info i got here: attic.apache.org/projects/xmlbeans.htmlHeadstock
XMLBeans has been brought out of retirement and is being managed by the Apache POI PMC. xmlbeans.apache.orgGirlfriend
D
10

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

Dealt answered 1/1, 2015 at 0:49 Comment(4)
It looks like (so far) JAXB is going to provide exactly what we need. I was able to generate Java classes from the xsd (573 Java classes were generated). There was a 'property value already defined' error that came up that did not occur when I generated the XMLBeans classes. I was able to work around this issue for now (I'm guessing I will need to write a jaxb binding file for the permanent fix). Thanks for the help Steve it is very much appreciated.Posey
The only? problem with JAXB for me, is the "unmarshaller / marshaller" mess... :-\ XMLBeans is very simple and transparent. Also, i don't know how to implement a "xml database" (xmlbeans creates methods to manipulate the xml elments as a list or array)Headstock
The issue we ran into was the issue with thread safe v. performance. Creating the context object is slow for very large xml. The marshaller and unmarshaller are NOT thread safe. More here: jaxb.java.net/guide/Performance_and_thread_safety.html and here: #7400922Posey
A recent link to the mentioned performance and thread safety. The repo is at github.com/javaee/jaxb-v2Kilar
W
3

XMLBeans has been unretired:

The Apache POI project has unretired the XMLBeans codebase and is maintaining it as a sub-project. Until now the XMLBeans codebase was held in the Apache Attic where former Apache projects are kept for the public good.

The latest release as of August 2020 is:

3.1.0 (March 26, 2019)

Having said that, I am not sure I would recommend using it, based on its history of retirement. Other solutions, such as JAXB, might be prefered since it will probably be better maintained in the future.

Whalen answered 31/8, 2020 at 7:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.