dev@jaxb.java.net

Re: xjc at runtime

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 10 Jan 2007 16:49:25 +0100

Hi.

> i use JAXB 2.0 and i wanna know if i can use the JAXB compiler (xjc) at the runtime by
> my own code , like a method or class that can compile xml schema to java beans, rather
> than generate the beans in the command-line approach. coz my xml schema changes at
> runtime . ????????
>
> thanks ...

See org.jvnet.jaxb2.maven2.test.RunXJC2Mojo. It executes the XJC mojo
programmaticlly. If you want to generate code from your own code, the
simplest solution would be to inherit from this class and override the
corresponding methods (like getSchemaDirectory() and so on) to point to
your directories.

However you'll still need to compile and load the classes, which could
be very tricky.

Bye.
/lexi