You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Stefan Lischke <s....@zertificon.com> on 2007/09/27 11:09:01 UTC

copy constructor for inherited types?

hi there,

I have to xsd types. Type A and B. B extends A and adds another element.

In source i have an instance of A and want to create a new instance of B
from A.

Any ideas? something like B.Factory.newInstance(A) for example? or do i
have to copy all fields by myself?

I tried with B.set(A) but B gets orphaned after this and i cannot set
the value of the extended Element of B

thanx in advance

Stefan

RE: copy constructor for inherited types?

Posted by Cezar Andrei <ce...@bea.com>.
Like in java, using only XMLObject's typed methods you have to set each
field.

But if you use XMLCursor API (which is not typed) you can copy or even
better (performance wise) move content from a to b.

Cezar

> -----Original Message-----
> From: Stefan Lischke [mailto:s.lischke@zertificon.com]
> Sent: Thursday, September 27, 2007 4:09 AM
> To: user@xmlbeans.apache.org
> Subject: copy constructor for inherited types?
> 
> hi there,
> 
> I have to xsd types. Type A and B. B extends A and adds another
element.
> 
> In source i have an instance of A and want to create a new instance of
B
> from A.
> 
> Any ideas? something like B.Factory.newInstance(A) for example? or do
i
> have to copy all fields by myself?
> 
> I tried with B.set(A) but B gets orphaned after this and i cannot set
> the value of the extended Element of B
> 
> thanx in advance
> 
> Stefan

Notice:  This email message, together with any attachments, may contain information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: user-help@xmlbeans.apache.org