Mapping Java to XML using annotations
The JAXB compiler binds an XML schema to Java objects. JAXB 2.0 has added the provision to bi-directionally marshal a Java object to an XML schema or an XML document using annotations. The annotations are defined in the javax.xml.bind.annotation
package. The following table shows some of the most commonly used annotations, as defined in the javax.xml.bind.annotation
package.
Annotation Type |
Description |
Annotation Elements |
---|---|---|
|
Maps a class to an XML schema complex type with simpleContent or an XML schema simple type. |
- |
|
Maps a class or an enum type to an XML schema type, which may be a simple type or a complex type. |
|
|
Maps a package name to a XML namespace. |
|