users@jaxb.java.net

Re: Help on retaining XML->Java mapping

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Fri, 19 Aug 2005 11:16:31 -0700

Ashutosh wrote:
> Hi Kohsuke,
> Based on this XML to Java mapping, I want to populate a Typemapper, which I
> later use for a WSDL2Java like utility. So this information is required to
> me for creating other artifacts like stubs etc.
> Is it not possible to do?

It depends on what you want to do. That's why I asked to give me more
information. And when I hear you say "retain information about the XML
-> Java mapping that JAXB did, say in some Map", it really made me
wonder how I should interpret your question --- you don't think the
mapping information of the schema compilation is simple enough to fit
into a java.util.Map, do you.

> On further exploring, we came up with com.sun.tools.xjc.api package for
> programatically
> using XJC related tasks.

Using classes in that package is one way, although it only provides a
limited information. The other is to write it as a plug-in, in that way
you get access to Model and Outline, which exposes considerably more
information. Both are JAXB RI specific.

> But my concern is this is the package name which is
> specific to sun. Aren't there use cases for making it part of JAXB API
> itself, so that other implementations are also guranteed to implement it?

It's really just a matter of priority; defining a portable schema
compiler API was just considered to be a lower priority by the EG.
To me, it is somewhat understandable, given that even javac doesn't have
a portable API.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com