Reputation: 4955
I used XStream many years ago, but I see that the libraries is not updated since 2008 (latest news). Is there now a more modern and up to dates Java XML serialization library?
Upvotes: 16
Views: 20184
Reputation: 1
An alternative is EasyML (http://github.com/cordisvictor/easyml-lib/). Supports Java 8, 11, 17, 21+.
Faster than XStream.
XStream is also being maintained on GitHub.
Upvotes: 0
Reputation: 719386
The fact that something hasn't been updated1 for 3 years doesn't mean that it is out of date. It might simply mean that there has been no need to update it. If there is no need to change a project, why change it?
Another possible explanation for the apparent lack of "progress" is that changing library APIs tends to be disruptive to projects that depend on them. This is particularly problematic for projects that combine lots of third-party components and libraries into one Java application.
Looking for alternatives to a library can be a good idea, especially if you need features that the existing library doesn't provide. But simply looking for an alternative because the library hasn't been updated recently is not wise. If XStream does what you need, stick with it. Newer doesn't necessarily mean better.
1 - ... when the question was originally asked.
UPDATE - 2023
XStream has been receiving updates with a new release at least once a year since 2011. Refer to the Changes page for details, and look at the activity on the Github repository for the project. As of now, the theory that XStream is not being maintained is (IMO) thoroughly debunked.
Upvotes: 10
Reputation: 2097
Underscore-java can read and write xml files. I am the maintainer of the project. Java 11+ is supported.
Upvotes: 0
Reputation: 149047
Note: I'm the EclipseLink JAXB (MOXy) lead, and a member of the JAXB (JSR-222) expert group.
You are correct in considering a libraries release frequency when making a software choice. There are many reasons for a new product release:
Another important aspect of evaluating any open source project is the number of active committers. Sites like ohloh.net are useful for that:
JAXB (JSR-222)
JAXB is more than an implementation, it is a standard that is developed through the Java Community Process (JCP). There have been participants from such object-to-XML libraries as XML Beans (BEA), EMF (IBM), TopLink (Oracle), etc. Because JAXB is part of Java EE it is available in every application server: WebLogic, GlassFish, WebSphere, JBoss, etc.
JAXB Offers:
EclipseLink JAXB (MOXy)
MOXy is a JAXB implementation that offers many useful extensions, including:
True Object to XML Mapping by Leveraging XPath
XPath based mapping allows you to start with both Java classes and an XML schema and map the two together.
Mapping File for Handling 3rd Party Classes
In the current JAXB spec the metadata is supplied via annotations. This can be problematic to use with 3rd party classes that cannot be modified. This is why MOXy offers a way to specify the mappings via XML:
Extensions for Mapping JPA Entities
Often times you need to do more with your Java objects then just map then to XML. You may also need to persist them to a database. This means your object model may have additional constraints on it that you need to account for. MOXy offers a number of extensions for this kind of use case:
Comparisons
Below are a couple comparisons I have done comparing JAXB to XStream and Simple:
Upvotes: 10
Reputation: 22673
In order of preference, relevancy and activity:
Visit the JAXB project's site to check out the tutorial and guide. Have also a look at the original JAXB architecture whitepaper.
The JAXB projet listed above is the reference implementation of the API, and is packaged in by the GlassFish Application Server.
Visit the EclipseLink project's site and read this introductory article to EclipseLink on InfoQ, and see Blaise Doughan's answer about MOXy.
EclipseLink originated from Oracle's TopLink and is now open source, managed by the Eclipse Foundation, and used in a number of Eclipse-based products.
Yes, XStream, because it's actually been updated in 2011 with a major update and 2 service releases since you asked, so it seems well-maintained and a pretty good contender used by mature projects. Don't forget to check what's new in version 1.4.x.
Visit the XStream project's site and its tutorial to compare.
Visit the XmlBeans project's site.
XmlBeans is a well-tested project that has been around for a while.
Visit the JiBX project's site, follow the tutorial and guide.
JiBX might be a simpler alternative if you don't like the complexity of XmlBeans or even JAXB.
Upvotes: 23
Reputation: 278
XStream 1.4.6 was released in Dec 2013, with Java 8 improvements, so the library HAS been updated since 2008.
Upvotes: 0
Reputation: 7000
XStream is pretty good and it does it's job well. Even for recent projects, I prefer to use XStream for use cases where it fits because it's easy to use, lightweight, and performs really well.
If you are looking at some serious bean-binding work, take a look at Simple Framework. It's also a good tool. This helped me out in one project where I needed to do some serious custom mapping work with annotations. http://simple.sourceforge.net/
Upvotes: 4