users@jaxb.java.net

Re: Generating java objects from xml with no pre-compiling or external tools.

From: Abel Perez <ablperez_at_pacbell.net>
Date: Fri, 16 May 2003 09:40:56 -0700

Hi Les,

>Les wrote:
> This is easily achived with a java class just internally executing the xjc
> compiler in a seperate thread with the XML file as input.

This could work if we were talking about a static context or confined group
of VM's that share a network storage partition where the xjc compiler can be
found and used. But what I am talking about is mobile code, the abilty to
have a lightweight Agent travel the net and instantiate java objects from
pure XML, not hidden implementations that represent xml.

> You just need to specify where the classes are generated and where
> the compiled classes go...

Again this would work in a given context where access to a file system
structure has been granted,
Otherwise this could open a new can of worms dealing with security.

Thanks Les :)
Abel Perez.


----- Original Message -----
From: "Les Hazlewood" <les_at_hazlewood.com>
To: <JAXB-INTEREST_at_JAVA.SUN.COM>
Sent: Friday, May 16, 2003 6:46 AM
Subject: Re: Generating java objects from xml with no pre-compiling or
external tools.


> This is easily achived with a java class just internally executing the xjc
> compiler in a seperate thread with the XML file as input.
>
> This way, the xml is converted to Java classes and those classes are
> compiled "on the fly" during runtime.
>
> You just need to specify where the classes are generated and where the
> compiled classes go...then you'd have to ensure that your current
> ClassLoader is aware of the new classes. (Class.forName() maybe?)
>
> The other way is to directly use Runtime.exec(...), but this doesn't
> guarantee platform independence like the first approach does.
>
> Les