users@jaxb.java.net

Re: Reusing bindings from previous xjc run

From: jon gold <dev_at_samizdatdigital.org>
Date: Fri, 22 Oct 2004 12:11:26 -0700

one suggestion (don't know if it actually works, but it's close to
something we're doing ourselves): when compiling schema B, tell XJC to
use the runtime for A in A's jar (there's an xjc flag something like
'use runtime foo' or some such).

jon

Lachlan O'Dea wrote:
> Hi, I've been having trouble making xjc do what I want.
>
> Say I have a utility library that uses XML schema A. My build runs xjc
> and puts everything into a jar. This jar is then used by a variety of
> applications.
>
> One application uses XML schema B, which imports schema A as a
> namespace. The problem is that when I run xjc over schema B, it goes and
> regenerates all the schema A bindings. I would like the generated schema
> B bindings to just reuse the schema A bindings that already exist.
>
> I tried using the same namespace and package names for the schema A
> stuff in both places, then ignoring the second lot of generated schema A
> bindings. It doesn't seem to work though. The Schema B bindings seem to
> be tied to the internals of the schema A bindings, so that they don't
> work with the classes in the utility jar.
>
> Any suggestions on how to do this? All I've found is the advice
> "generate all your bindings in a single xjc invocation". That doesn't
> really work here, since I'm reusing a jar that has already been built.
>
> The brute force option is to put the schema A bindings in a different
> package on the second run. I duplicate a whole bunch of code, but it
> should work. The problem there is that any code written to use the
> bindings can't work with both versions. I'd have to duplicate that code
> too.
>
> I hope all this is making sense.
>
> --
> Lachlan O'Dea
> Computer Associates
> Senior Software Engineer
> tel: +61 3 8416 5627
> fax: +61 3 8416 5810
> mobile: +61 412 390 650
> odela01_at_ca.com
>
> Relax and enjoy your shoes!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net