开发者

how to change from castor to JAXB in a project? [closed]

开发者 https://www.devze.com 2023-02-15 23:35 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

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 question

How 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
0

精彩评论

暂无评论...
验证码 换一张
取 消