Hello,

I think the code plenty clear. Pls verify that the
"import ..." code are
correct.


Regards, 
----------------------------------------------------------------------------
-------
Bao Le
Lecturer
http://leducbao.blogspot.com 
Faculty of Information Technology
Ton Duc Thang University of Technology
Mobile:  +(84-95) 888 2585
----------------------------------------------------------------------------
-------

-----Original Message-----
From: David Jencks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 02, 2005 10:45 PM
To: [email protected]
Subject: Re: ClassCastException

You can leave out the .copy().  setFoo() copies the
xmlobject anyway:  
otherwise you would get diamonds or directed acyclic
graphs, not trees or
setting in one place would remove the object from its
original location.

I suspect that .copy() is an XmlObject method and you
would need to
changeType on the returned object, but I didn't check.

thanks
david jencks

On Aug 2, 2005, at 6:10 AM, James Kavanagh wrote:

> As an addendum I've included the code snippet I'm
using.
>
> RequestDocument req =
>       RequestDocument.Factory.parse(new
File("C:/Temp/ex.xml"), options);
>                       
> System.out.println(
>       "Request -- " +
> req.getRequest().getCardDetails().getExpiryDate());
>
> ResponseDocument res =
ResponseDocument.Factory.newInstance();
>                       
> Request reqImpl = (Request)req.getRequest().copy();
>                       
>>> res.setRequest(reqImpl);
>                       
> System.out.println(
>       "Response -- " +
> res.getResponse().getCardDetails().getExpiryDate());
>
>>> Indicates the line where the ClassCastException is
occurring.
> Hope this makes things a little clearer.
>
> -----Original Message-----
> From: James Kavanagh
[mailto:[EMAIL PROTECTED]
> Sent: 02 August 2005 12:42
> To: [email protected]
> Subject: RE: ClassCastException
>
> Hi,
>
> I'm new to XML Beans so forgive me if I've missed
something glaringly 
> obvious...
>
> I have a schema with two elements, Request and
Response.
> The Response element is derived from the Request
element and this is 
> very helpfully reflected in the compiled objects
after using scomp.
>
> Effectively when I receive a request instance I
construct a response 
> instance which needs to have the original details of
the request. 
> There is a method ResponseDocument.setRequest()
which I call passing 
> in a cloned instance of the original RequestImpl
object. Doing this I 
> get the following ClassCastException:
>
> Cannot cast
org.apache.xmlbeans.impl.values.XmlAnyTypeImpl
(id=159) to 
> noNamespace.Request
>
> Is there something fundamentally wrong with what I'm
trying to do here?
>
> James Kavanagh
> Global-Nomi
> Mob: +447971031459
>
>
>
______________________________________________________________________
> _
> _
> ________
>
> DISCLAIMER:  This email contains proprietary
information some or all 
> of which may be legally privileged.
> It is for the intended recipient only. If an
addressing or 
> transmission error has misdirected this email,
please notify the 
> author by replying to this email.
> If you are not the intended recipient, you must not
use, disclose, 
> copy, print, or rely on this email.
> Global-Nomi cannot accept liability for any
statements made which are 
> clearly the sender's own and not  expressly made on
behalf of 
> Global-Nomi or one of its agents.
> This message is sent with the premise that it will
arrive unaltered 
> and as the author intended.  But no assumption
should be made that 
> this message is exactly as transmitted
>
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]




                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to