Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

JAXB vs. Castor or Zeus

843834Feb 12 2002 — edited Oct 24 2002
Hi,

How does JAXB compare to things like Castor or Zeus?

Specifically, does Castor/Zeus support DTD's or do they only work with XML schemas.

Also, do Casor/Zeus support all the features JAXB supports (or is supposed to support)?

I read through a little tutorial about using Castor and it seemed to be a little more complex than JAXB. Is this true? With JAXB, all you have to write is your DTD and binding schema, run it through the xjc compiler and you have your XML classes. Castor seemed to require more more steps to get the XML java classes. Unless I just misread the Castor stuff.

Any info would be very appreciated.

Thanks,

Nate

Comments

843834
It is true : Castor is more complex than JAXB, at least under its current implementation.
Castor is a framework, while JAXB is lightweight.

With Castor, you have much more control over your classes.
We've had some hard times with JAXB, when dealing with collections nested inside other collections, but the API is much more simple to use.

Last, JAXB ships with its own parser and sometimes you can have nasty "side effects" with the other parsers already deployed.

Hope this helps.
843834
It depends on your needs. The current implementation of Castor is able to marshall/unmarshall XML to java without the need for any mapping definition. This only works if the elements in the document meet certain criteria when compared to your bean.

You can also introduce a mapping file to explicitly define how XML gets translated into your bean.

One major advantage of Castor over JAXB is that Castor does not need to build any intermediate java classes. It can create an instance of your bean and unmarshall the XML data into it directly. Likewise, it can marshall a bean directly. Castor also provides a JDO approach that uses XML to persist object data.

The disadvantages of Castor are that it has a questionable future and it does not currently marshall/unmarshall EJBs (as far as I can tell).
1 - 2
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 21 2002
Added on Feb 12 2002
2 comments
239 views