We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
开发者_JS百科 Improve this questionHow can i transition from Castor to JAXB in an existing project?
There are a couple of approaches you can take:
Approach #1 - Retain Domain Classes
If you are looking to use the same domain objects used by Castor you will need to annotate them with JAXB annotations. If you are using Castor's mapping file, and continue to use a mapping file you will need to use a JAXB implementation with an equivalent extensions such as EclipseLink MOXy (I'm the tech lead):
- http://bdoughan.blogspot.com/2010/12/extending-jaxb-representing-annotations.html
Approach #2 - Generate New Classes
If you used Castor's source code generator to generate classes from an XML schema you can simply use JAXB's source code generator to generate new classes from the same XML schema. For an example see:
- http://bdoughan.blogspot.com/2010/09/processing-atom-feeds-with-jaxb.html
精彩评论