background image

About Unmarshalling

<< The JAXB Binding Process | Java Representation of XML Schema >>
<< The JAXB Binding Process | Java Representation of XML Schema >>
4
B
INDING BETWEEN
XML S
CHEMA AND
J
AVA
C
LASSES
5. Validate (optional). The unmarshalling process optionally involves valida-
tion of the source XML documents before generating the content tree.
Note that if you modify the content tree in Step 6, below, you can also use
the JAXB Validate operation to validate the changes before marshalling the
content back to an XML document.
6. Process content. The client application can modify the XML data repre-
sented by the Java content tree by means of interfaces generated by the
binding compiler.
7. Marshal. The processed content tree is marshalled out to one or more XML
output documents. The content may be validated before marshalling.
More About Unmarshalling
Unmarshlling 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 mar-
shalling. There is also no requirement that the Java content tree be valid with
respect to its original schema in order to marshal it back into XML data.
More About Validation
Validation is the process of verifying that an XML document meets all the con-
straints 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.