|
Java Architecture for XML Binding |
|
|
The content objects created are instances of
the classes produced by the binding compiler.
Apart from a binding compiler, a JAXB
implementation must provide runtime APIs for
JAXB-related operations such as marshalling.
The APIs are provided as a part of the binding
framework. The binding framework comprises
of a main package, javax.xml.bind. This package
contains classes and interfaces for performing
operations such as unmarshalling, marshalling,
and validation (marshalling and validation will be covered later).
Validating the Source Data: You can validate
source data against an associated schema as part of the unmarshalling operation. JAXB
providers have a lot of flexibility here. The JAXB
specification mandates that all provider
implementations report validation errors when
the errors are encountered, but the
implementation does not have to stop
processing the data. It is possible for a JAXB
implementation to successfully unmarshal an invalid XML document, and build a Java content
tree. However, the result won’t be valid.
The
main requirement is that all JAXB
implementations must be able to unmarshal
valid documents. Additionally, you also have the flexibility of
turning the validations witch off if you don’t
want to incur the additional validation
processing overhead.
III. Marshal the Content Tree:
Marshalling is the opposite of unmarshalling.
Marshalling involves transforming the content
tree into a XML document.
|
|
Features of JAXB 2.0
JAXB is one of the APIs included with the
Java EE platform and also a part of Java Web
Services Development Pack (JWSDP). In this
article we are discussing the features of
JAXB 2.0; However JAXB 2.1 is available for
downloading.
JAXB 2.0 includes some new features:
• It supports for all of the XML Schema
constructs.
• It includes parameterized types also.
• It allows us to bind Java-to-XML by
using the annotations.
• In this version setValidation () method
of the UnMarshaller interface has been
replaced with the JAXP 1.3 validation.
• The new version of JAXB (JAXB 2.0)
requires smaller runtime libraries that
require lesser runtime memory.
• JAXB 2.0 generates a value class
instead of an interface and its
implementation class. For each toplevel element, JAXB 2.0 generates a
Factory class method instead of an
interface and an implementation class.
• It generates significantly fewer Java
classes from a schema.
How JAXB 2.0 works
To understand how to process XML
documents in Java with JAXB 2.0, one need
to give a closer look at the two main JAXB
components:
I The binding compiler (which binds a |
|
Oct 2007 | Java Jazz Up | 48 |
|
|
|
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63 ,
64,
65 ,
66 ,
67 ,
68 ,
69 ,
70,
71,
72,
73,
74,
75,
76,
77,
78,
Download PDF |
|
|
|
|
|
|
|
|
|