You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@xmlbeans.apache.org by Christian Kaiser <ch...@phyxe.org> on 2006/08/02 20:41:52 UTC

Re: RE: AbstractTypes problem

Hello,

i am new to xmlbeans and got stuck with the same problem.
my schema consists of 200 types
I dont want to compare all types with the xquery result.

***********************************************
final Shape shape = Shape.Factory.parse(someShapteInput);

if(shape instanceof Circle) {
  final Circle = (Circle) shape;
  // do whatever you want with a circle
} else if(shape instanceof Square) {
  final Square square = (Square)shape;
.
.
.

********************************************}


i dont see how andrejs way could work for me.
(SchemaType instanceType = xo.type)

Does it work?
Is there another solution?

Thanks,

Christian


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


Re: AbstractTypes problem

Posted by Christian Kaiser <ch...@phyxe.org>.
Hi Radu,

thanks for your reply.

Radu Preotiuc-Pietro wrote:
> Not sure what you are looking for.
>   

I think I wasn`t sure, too.

Now I can specify my problem and provide a solution.

I want to build an interface, that allows me to add, replace and delete 
nodes at a specific
postition declared by an identifier.

my solution:

create an XmlObject with functionality of my compiled schema.

-->
void add(String id, XmlObject node){

        get the element with the ID via xpath.

        and move the input XmlObject with XmlCursor.move to the queryResult.
}

thanks,
Christian









> If you have an XmlObject o and you don't know what type it is, do
>
> SchemaType type = o.schemaType();
>
> Does your Schema have 200 types that are all extending a base type such
> as Shape in the example below? Can all of those types result from the
> xquery? Do you need specific processing for each of them?
>
> Radu
>
> -----Original Message-----
> From: Christian Kaiser [mailto:christian.kaiser@phyxe.org] 
> Sent: Wednesday, August 02, 2006 11:42 AM
> To: user@xmlbeans.apache.org
> Subject: Re: RE: AbstractTypes problem
>
> Hello,
>
> i am new to xmlbeans and got stuck with the same problem.
> my schema consists of 200 types
> I dont want to compare all types with the xquery result.
>
> ***********************************************
> final Shape shape = Shape.Factory.parse(someShapteInput);
>
> if(shape instanceof Circle) {
>   final Circle = (Circle) shape;
>   // do whatever you want with a circle
> } else if(shape instanceof Square) {
>   final Square square = (Square)shape;
> .
> .
> .
>
> ********************************************}
>
>
> i dont see how andrejs way could work for me.
> (SchemaType instanceType = xo.type)
>
> Does it work?
> Is there another solution?
>
> Thanks,
>
> Christian
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@xmlbeans.apache.org
> For additional commands, e-mail: user-help@xmlbeans.apache.org
>
> _______________________________________________________________________
> 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
>
>
>   


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


RE: RE: AbstractTypes problem

Posted by Radu Preotiuc-Pietro <ra...@bea.com>.
Not sure what you are looking for.

If you have an XmlObject o and you don't know what type it is, do

SchemaType type = o.schemaType();

Does your Schema have 200 types that are all extending a base type such
as Shape in the example below? Can all of those types result from the
xquery? Do you need specific processing for each of them?

Radu

-----Original Message-----
From: Christian Kaiser [mailto:christian.kaiser@phyxe.org] 
Sent: Wednesday, August 02, 2006 11:42 AM
To: user@xmlbeans.apache.org
Subject: Re: RE: AbstractTypes problem

Hello,

i am new to xmlbeans and got stuck with the same problem.
my schema consists of 200 types
I dont want to compare all types with the xquery result.

***********************************************
final Shape shape = Shape.Factory.parse(someShapteInput);

if(shape instanceof Circle) {
  final Circle = (Circle) shape;
  // do whatever you want with a circle
} else if(shape instanceof Square) {
  final Square square = (Square)shape;
.
.
.

********************************************}


i dont see how andrejs way could work for me.
(SchemaType instanceType = xo.type)

Does it work?
Is there another solution?

Thanks,

Christian


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

_______________________________________________________________________
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