tags:

views:

525

answers:

2

Castor framework (xml to java bean binder framework) provides functionality to map my existing java bean to xml. Can I achieve same thing using JAXB ?

A: 

JAXB really works the other way round. Given an xsd, JAXB will generate a set of java objects reflecting the structure. Its not always easy to represent the structure of your POJOs in the form of an XSD. For your task I would suggest you use JIBX since this provides much finer control over how the individual xml entities are mapped to your Java objects

Il-Bhima
+3  A: 

JAXB can also be used to map existing beans to xml. For this purpose exists the schemagen tool (also part of the JDK, at least in JDK 6) and the JAXB annotations defined in the javax.xml.bind.annotations can be used to customize the mappings.

Depending on your requirements and existing code this might be more or less painful.

Hardy
BTW, to learn about JAXB you should start here - https://jaxb.dev.java.net/
Hardy