users@jaxb.java.net

Re: Converting XML to Java Objects...possible?

From: Prashant <prashant_at_pramati.com>
Date: Tue, 10 Apr 2007 10:42:24 +0530

Yes, this is possible with Jaxb and is the primary objective of this
specification.

JAXB generates the Java Classes from a XSD document.

Then you can "marshall" any XML instance document of this schema to a
Java Objects.

If you think of XSD Schema document as a "blue print" Jaxb will generate
Class files (Blue print in Java), then for any incoming XML instance
document (data) JAXB can create Java Object instances.

Perhaps this will help : http://www.jcp.org/en/jsr/detail?id=31

*2.1* Please describe the proposed Specification:
The proposed specification will define an /XML data-binding facility/
for the Java^TM Platform. Such a facility compiles an XML schema into
one or more Java classes. These automatically-generated classes handle
the translation between XML documents that follow the schema and
interrelated instances of the derived classes. They also ensure that the
constraints expressed in the schema are maintained as instances of the
classes are manipulated.

-Prashant

tweety123 wrote:
> Hi, As far as I know about JAXB, it provides the facility to convert "XSD"
> (not XML) to Java "classes" (not objects). This can be done using xjc
> compiler. Can XML files (i.e. ones with data) be converted to Java objects
> (retaining the data from XML files)? If yes, please throw some light on how
> it can be done. If no, then is there some java technology to do such a
> thing?
>
> Thanks.
>