Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which one is better for schema to code generation, XMLBeans or JAXB?

Tags:

java

xml

xsd

Want to use a library for XML schema to code generation and wanted to know if people have a preference between XMLBeans and JAXB. Performance, Schema validation capability, Memory Usage.. Any indicators will help..

like image 785
user42587 Avatar asked Dec 09 '22 22:12

user42587


1 Answers

My personal preference would be JAXB. It has a more modern approach using annotations and many Java 5 features. XMLBeans on the other hand is still Java 1.4 compliant - if this is required for you. Some other thoughts in no particular oder are:

  • From Java 6 on JAXB is bundled with the JDK - so it is available out of the box.
  • JAXB works with annotated Java (POJO like) classes - XMLBeans generated interfaces and no classes
  • JAXB allows to annotate Java classes to use them for marshalling and unmarshalling or you can start with a XML Schema, generate the Java classes and then fo into un-/marshalling
  • XMLBeans allows only to start with a XML Schema, generates interfaces and then use this for un-/marshalling
like image 147
Joachim Avatar answered May 13 '23 15:05

Joachim