You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xmlbeans.apache.org by Vladimir Horev <vo...@neti.ee> on 2004/11/21 20:41:36 UTC
making generated jar available at run-time
Hello folks!
I generate some classes (that go to jar file) from XSD schema file. My
application relies on java reflection to check whether some specified
name, like "email.to.address" exists in given xml schema and I do this
by inspecting generated class files.
So the problem is that I need to generate that jar file under weblogic
server in runtime, and when I call XmlObject.Factory.parse(myFile) the
xmlbeans framework should return my generated class (email.class) as
root element of the parsed xml doc, not ordinary XmlObject implementation.
Please, give me some insight into how I could accomplish this (if that
is possible at all).
thank you all in advance,
Vladimir Horev
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
Re: making generated jar available at run-time
Posted by Vladimir Horev <vo...@neti.ee>.
brief overview of the problem:
I'm writing an interpretor for high level computer language. One
feature of that language is ability to read incoming xml file, that
satisfies some kind of xsd schema. Suppose, we have the following input
xml file:
<goods>
<item>
<name>ABCDEF</name>
</item>
</goods>
Users of the language can read the value of "name" element in incoming
document using the following construction:
IF $goods.item.name = "ABCDE" THEN
...............
FI
When I do interpret the text of such program, and see construct like
"$goods.item.name", I'm trying to obtain the value of "name" element
using xmlbeans and reflection. So, it would be something like:
XmlObject xobj = XmlObject.Factory.parse(incomingFile);
// I look if XmlObject contains a field "goods", then I inspect whether
the return type of getGoods() method
// contains field "item" etc. till I reach the field "name".
Problem is the following: new types of xml documents are added in run
time by user, and consequently, I use xmlbeans compiler to generate
appropriate xml "beans". The result of such generation is a jar file
containing all the nesessary structures that were found in XSD. And I
would like that construction
XmlObject.Factory.parse(incomingFile);
would return me the root class of my structure, so in case of this file
<goods>
<item>
<name>ABCDEF</name>
</item>
</goods>
the real type that method parse returns should be of type "Goods.class".
Then I can use reflection and inspect it's properties. Unfortunately,
the package generated by compiler is not in the classpath and xmlbeans
can't see it and that's my problem is.
I hope, I managed to explain it.
Thanks again,
Vladimir.
robert burrell donkin wrote:
> On 21 Nov 2004, at 19:41, Vladimir Horev wrote:
>
>> Hello folks!
>>
>> I generate some classes (that go to jar file) from XSD schema file.
>> My application relies on java reflection to check whether some
>> specified name, like "email.to.address" exists in given xml schema
>> and I do this by inspecting generated class files.
>>
>> So the problem is that I need to generate that jar file under
>> weblogic server in runtime, and when I call
>> XmlObject.Factory.parse(myFile) the xmlbeans framework should return
>> my generated class (email.class) as root element of the parsed xml
>> doc, not ordinary XmlObject implementation.
>>
>> Please, give me some insight into how I could accomplish this (if
>> that is possible at all).
>> thank you all in advance,
>
>
> i'm not sure whether this can or can't be done using xmlbeans and
> weblogic but the approach seems a little bit unusual. using a
> generator (such as xmlbeans) has many advantages (such as strong
> typing) which do not apply when using dynamic generation and
> reflection. it may well be that xmlbeans is not sure a good match for
> your use case.
>
> can you give a few more details about the problem that this approach
> aims to solve?
>
> - robert
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: dev-help@xmlbeans.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org
Re: making generated jar available at run-time
Posted by robert burrell donkin <rd...@apache.org>.
On 21 Nov 2004, at 19:41, Vladimir Horev wrote:
> Hello folks!
>
> I generate some classes (that go to jar file) from XSD schema file. My
> application relies on java reflection to check whether some specified
> name, like "email.to.address" exists in given xml schema and I do this
> by inspecting generated class files.
>
> So the problem is that I need to generate that jar file under weblogic
> server in runtime, and when I call XmlObject.Factory.parse(myFile) the
> xmlbeans framework should return my generated class (email.class) as
> root element of the parsed xml doc, not ordinary XmlObject
> implementation.
>
> Please, give me some insight into how I could accomplish this (if that
> is possible at all).
> thank you all in advance,
i'm not sure whether this can or can't be done using xmlbeans and
weblogic but the approach seems a little bit unusual. using a generator
(such as xmlbeans) has many advantages (such as strong typing) which do
not apply when using dynamic generation and reflection. it may well be
that xmlbeans is not sure a good match for your use case.
can you give a few more details about the problem that this approach
aims to solve?
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org