[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    RE: making generated jar available at run-time
From:       "Radu Preotiuc-Pietro" <radup () bea ! com>
Date:       2004-11-22 17:50:51
Message-ID: 4B2B4C417991364996F035E1EE39E2E124FC02 () uskiex01 ! amer ! bea ! com
[Download RAW message or body]

Right, since you are trying to use XmlBeans-generated Java classes, the only way to \
do that is via classloaders (that's true for any kind of generated classes, has \
nothing to do with XmlBeans). If you are just trying to use SchemaTypes without the \
generated Java classes, XmlBeans has other solutions (look at the SchemaTypeLoader \
class).

-----Original Message-----
From: Jacob Danner 
Sent: Sunday, November 21, 2004 10:25 PM
To: dev@xmlbeans.apache.org
Subject: RE: making generated jar available at run-time


If I understand your problem correctly, You are trying to call a method on a \
dynamically created class or a class from a jar that is not on the classpath. I just \
did some work on something similar to this. You'll wanna look into classloading. The \
code for this work lives in: \
\xml-xmlbeans\v2\test\src\misc\detailed\ClassLoadingTest.java Let me know if this \
                helps or is what you are trying to do.
-Jacobd

	-----Original Message----- 
	From: Vladimir Horev [mailto:vovan@neti.ee] 
	Sent: Sun 11/21/2004 2:33 PM 
	To: dev@xmlbeans.apache.org 
	Cc: 
	Subject: Re: making generated jar available at run-time
	
	

	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
	
	


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic