Chapter 2. Technologies i n XML 49
2.10 Java Architecture for XML Binding (JAXB)
The Java Architecture for XML Binding provides an API and tools that automate
the mapping between XML documents and Java objects. These are available as
an early access release. The public version of the JAXB specifications an d a
pre-release version of the reference implementation will be available by the third
quarter 2002. The final draft is scheduled to be published in the forth quarter of
the same year.
The JAXB API com piles an XML Schema i nto Java classes. The Java clas ses
handle all the details of XML parsing and formatting. The generated classes
ensure that the constraints expressed in the DTD are enforced in the methods
and Java technology language data types. The early access release only works
on DTD, but later versions are being produced to support other schemes.
The classes generated by JAXB perform at a greater efficiency than the SAX and
DOM parsers, because the classes are more customized than the generic
parsers. The generated application validates structure and content with the help
of the Java classes. The structure and content validation classes perform better
than the SAX, because the derived classes are precompiled. Unlike the DOM
parser, it does not need to create the whole tree. The content tree created is
specific to one schema, and the classes do not need any redundant
tree-manipulation functionality.
The JAXB expert group is now working on the new specification. Among the
features are:
򐂰Support for a subset of W3C XML Schema and XML namespaces
򐂰More flexible unmarshalling and marshalling functionality
򐂰Enhanced validation capabilities, such as allowing validation to be turned on
for development purposes, and turned off for deployment.
To understand JAXB in depth, visit Java Architecture for XML Binding (JAXB) at
Java.sun.com:
http://www.java.sun.com/xml/jaxb/
2.11 Cocoon
Cocoon provides an XML publishing framework that is designed around the SAX
API. It can interact with common data sources, including files, relational
databases, and XML databases. The content delivery can be customized to
different devices such as HTML, WML, RTF, PDF and others. Its main aim is to
provide a platform for building applications with distinct separation between
content, logic, and presentation.