Freigeben über


Java/XML Binding Options? WebSphere prefers JAXB 2.0...

I'm looking to put together more Java and .NET interop samples. If any of you have any particular requests, let me know.  One of the key areas for interop I'm looking at is XML serialization. 

Today I was scanning the web looking for insight into the leading Java-to-XML binding frameworks. For those of you who are .NET literate but not Java literate, "XML data binding" is the term Java people (and maybe programmers for other platforms too) use for what we .NET-heads call "XML Serialization".   According to my unofficial count, there are, let's see... ah...roughly..... a zillion different options.   XStream, XMLBeans, JAXB, JiBX, Castor, Zeus, Quick, etc.  Then there are the vendor options, like Electric XML (from The Mind Electric, which was bought by Webmethods, which was bought by SoftwareAG, which ... ?? who knows what they are doing with Glue now? when I visited the webmethods.com website, it was down?).  At one point, Oracle had its own option, IBM had its own option, BEA's was what became XMLBeans (via the "Beehive" gambit), and there were many others, I'm sure.

Let a thousand flowers bloom indeed. The problem with this "1000 flowers" approach is it presents a challenge to any developer who wants to just solve a problem.  Where's the critical mass?  Every developer has to go and evaluate this decision, and who knows which is the right choice for any given set of circumstances?  Choice is great but too many choices can lead to higher decisions costs, and too much redundancy can stifle progress.  One set of devs learns techniques and tools for JiBX and the next set learns the same for XMLBeans and ne'er the twain shall meet. 

As I was looking, I learned that IBM's WebSphere Feature Pack for Web Services, released in June 2007, provides JAXB 2.0 support as the preferred Java-XML binding mechanism. 

Seeing that JAXB is also the JCP-blessed option, it seems like the question "Which Java-XML binding framework is the mainstream one?" has been answered. Maybe this discussion has been over for a long time and I just missed the memo?

I am sure there will be numerous little frameworks that continue to explore the boundaries of XML-to-Java data binding, but JAXB seems like the mainstream winner approach for now.  It is the Honda Accord or Toyota Camry of Java-to-XML binding - a safe, reliable, well-supported, well-known choice. Other options may have nifty features or cooler styling, but parts, service and maintenance on the Accord is going to be cheap and easy in the long term.  You can't go wrong wiith that.

I've produced numerous examples of how to interoperate between Java and .NET using XML, and I chose other frameworks for the Java side, including XMLBeans and most recently, XStream, but at this point I think JAXB is going to be my mainstream preference for an Java XML data binding framework going forward.

If anyone has any guidance that disagrees with this, please advise!

Comments

  • Anonymous
    May 08, 2008
    JAXB is far from perfect. I am evaluating various XML -> Java -> XML frameworks at the moment and I am not very happy with JAXB. It is intrusive, does not cope well with multidimensional arrays, doesn't allow for flexible XML customization etc. It is very simple though, albeit more complex than JiBX (data binding) or XStream (if all you need is serialization). JiBX on the other hand allows for very flexible and easy xml customization for already existing classes. The only reason why I didn't choose it is that it needs to modify bytecode of serialized classes, which is not an option in my situation. By the way, in java world you differentiate between XML serialization and data binding - these are two common terms describing different needs.