users@jaxb.java.net

Re: Regarding JAXB

From: Kohsuke Kawaguchi <kohsuke.kawaguchi_at_sun.com>
Date: Thu, 27 Oct 2005 15:46:48 -0700

Hi, please consider sending inquiries to users_at_jaxb.dev.java.net in the
future. Thanks!

Ajith K. wrote:
> One requirement that has come for the project is like we have to build a
> XML from java objects. This XML to be build is required for creating the
> HTML mail body after applying XSL.
> We have our own java objects which need to be converted or marshalled to
> XML.

OK.

> The examples I have seen for marshalling of java objects to XML, All of
> them depends on XSD from which the runtime implementation is created and
> also the holder objects and their implementation.
>
> Is it possible to use our own Java objects bypassing the creation of
> holder objects at runtime and then marshall it to XML? And also can it
> be done without having a XSD or DTD.

Yes. This is very much possible in JAXB 2.0.

> Since we want to implement this for a mailing framework, it not possible
> to create objects at runtime everytime a change is done to the mail.
> So we are in process of creating a generic framework in which it will
> accept a java object (any) and convert it to XML. Can this be done using
> JAXB.

If those objects haev JAXB 2.0 annotations, yes, you can treat them and
produce an e-mail without knowing anything specific about those classes
that you are handling.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com