background image

More about Unmarshalling

<< JAXB Generating Classes | Simple Type Definitions >>
<< JAXB Generating Classes | Simple Type Definitions >>

More about Unmarshalling

More about Unmarshalling
Unmarshalling provides a client application the ability to convert XML data into JAXB-derived
Java objects.
More about Marshalling
Marshalling provides a client application the ability to convert a JAXB-derived Java object tree
back 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 back into XML data.
More about Validation
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 one could confirm that they did
not invalidate the XML document when modifying the document in JAXB form.
Representing XML Content
This section describes how JAXB represents XML content as Java objects.
Java Representation of XML Schema
JAXB supports the grouping of generated classes in Java packages. A package consists of the
following:
A Java class name that is derived from the XML element name, or specified by a binding
customization.
An ObjectFactory class, which is a factory that is used to return instances of a bound Java
class.
Representing XML Content
The Java EE 5 Tutorial · September 2007
492