hi Koshuke,
I work with Ashutosh, and thought I would also throw some light on
this problem we are trying to solve.
Given an XML schema, we need a means to prepare a map of all the XML
types encountered in the schema with the corresponding JAXB specific
Java type names. This information is required for us in some other
code generation process.
We thought that, the JAXB compiler should provide a means to get a
collection or map of all the XML types / Java types in a way that is
independent of vendor-specific JAXB compiler. In other words, we felt
that JAXB API should enforce this facility on the JAXB compiler.
May be I lack the full knowledge of the API. Please guide us if there
is already an existing means to meet this need, in a vendor-neutral
way.
Thanks!
Venkat
> Date: Fri, 19 Aug 2005 11:16:31 -0700
> From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
> Content-type: multipart/signed; protocol="application/x-pkcs7-signature";
> micalg=sha1; boundary=------------ms070902000902090407080603
> Subject: Help on retaining XML->Java mapping
>
> 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
>