What are the differences between JAXB 1.0 and JAXB 2.0
Join the DZone community and get the full member experience.
Join For FreeWhat are the differences between JAXB 1.0 and JAXB 2.0?
- JAXB 1.0 only requires JDK 1.3 or later. JAXB 2.0 requires JDK 1.5 or later.
- JAXB 2.0 makes use of generics and thus provides compile time type safety checking thus reducing runtime errors.
- Validation is only available during marshalling in JAXB 1.0. Validation is also available during unmarshalling in JAXB 2.0.
- Termination occurs in JAXB 1.0 when a validation error occurs. In JAXB 2.0 custom ValidationEventHandlers can be used to deal with validation errors.
- JAXB 2.0 uses annotations and supports bi-directional mapping.
- JAXB 2.0 generates less code.
- JAXB 1.0 does not support key XML Schema components like anyAttribute, key, keyref, and unique. It also does not support attributes like complexType.abstract, element.abstract, element.substitutionGroup, xsi:type, complexType.block, complexType.final, element.block, element.final, schema.blockDefault, and schema.finalDefault. In version 2.0, support has been added for all of these schema constructs.
References: http://javaboutique.internet.com/tutorials/jaxb/index3.html
From http://dublintech.blogspot.com/2011/04/what-are-differences-between-jaxb-10.html
Type safety
Java Development Kit
Schema
Java (programming language)
Marshalling (computer science)
XML
Attribute (computing)
Construct (game engine)
Annotation
Opinions expressed by DZone contributors are their own.
Comments