The Java Tutorials have been written for JDK 8. Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.
See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.
This section describes the components and the interactions in the JAXB processing model.
The following figure shows the components that make up a JAXB implementation.
Figure: JAXB Architectural Overview
A JAXB implementation consists of the following architectural components:
The following figure shows what occurs during the JAXB binding process.
Figure: Steps in the JAXB Binding Process
The general steps in the JAXB data binding process are:
Unmarshalling provides a client application the ability to convert XML data into JAXB-derived Java objects.
Marshalling provides a client application the ability to convert a JAXB-derived Java object tree into XML data.
By default, the Marshaller uses UTF-8 encoding when generating XML data.
Client applications are not required to validate the Java content tree before marshalling. There is also no requirement that the Java content tree be valid with respect to its original schema to marshal it into XML data.
Validation is the process of verifying that an XML document meets all the constraints expressed in the schema. JAXB 1.0 provided validation at unmarshal time and also enabled on-demand validation on a JAXB content tree. JAXB 2.0 only allows validation at unmarshal and marshal time. A web service processing model is to be lax in reading in data and strict on writing it out. To meet that model, validation was added to marshal time so users could confirm that they did not invalidate an XML document when modifying the document in JAXB form.