Getting exist queryResult into XMLBeans

View: New views
3 Messages — Rating Filter:   Alert me  

Getting exist queryResult into XMLBeans

by Klaus Dobbler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey.

I am currently developing a software under java to query data from  
exist and put the results into XMLBeans.

  my collection consits of 1 document. this document has some  
xsi:type attributes. (for example ContentCollectionType)

I'm using the xml:db api through java and I'm getting the result as  
XMLResource. (i inserted the needed namespaces in the  
XPathQueryService before) Then i convert this into a DOM-Node  
(getMemebers as Dom) and parse the DOM Node into a XMLObject. With a  
XMLCursor i go to the first Element after the exist result element,  
call getObject(), getDomNode() and parse it again into a XMLObject.  
This XMLObject i assign to the apropriate Beans-Type. For some types  
it works, but not for the Elements with the xsi:type attributes.

Does somebody know why this could be, or how i can do this better and  
easier?  I hope there is somebody who can help me,

regards

Klaus

regards

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


RE: Getting exist queryResult into XMLBeans

by Radu Preotiuc-Pietro :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Klaus,

After you go to the first Element after the existing result element, as
you say, why do you call getDomNode() and parse it again into XmlObject?
This seems redundant, why not just use the result of
XmlCursor.getObject()?

Radu

> -----Original Message-----
> From: Klaus Dobbler [mailto:klaus_d@...]
> Sent: Wednesday, June 04, 2008 6:46 AM
> To: user@...
> Subject: Getting exist queryResult into XMLBeans
>
> Hey.
>
> I am currently developing a software under java to query data
> from exist and put the results into XMLBeans.
>
>   my collection consits of 1 document. this document has some
> xsi:type attributes. (for example ContentCollectionType)
>
> I'm using the xml:db api through java and I'm getting the
> result as XMLResource. (i inserted the needed namespaces in
> the XPathQueryService before) Then i convert this into a
> DOM-Node (getMemebers as Dom) and parse the DOM Node into a
> XMLObject. With a XMLCursor i go to the first Element after
> the exist result element,  
> call getObject(), getDomNode() and parse it again into a XMLObject.  
> This XMLObject i assign to the apropriate Beans-Type. For
> some types it works, but not for the Elements with the
> xsi:type attributes.
>
> Does somebody know why this could be, or how i can do this
> better and easier?  I hope there is somebody who can help me,
>
> regards
>
> Klaus
>
> regards
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...
>
>

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@...
For additional commands, e-mail: user-help@...


Re: Getting exist queryResult into XMLBeans

by Klaus Dobbler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Radu,

i wondered about that, too, but if i don't do that i always get a  

java.lang.ClassCastException: org.apache.xmlbeans.impl.values.XmlAnyTypeImpl,

when i'm trying to set my xmlobject to the apropriate beans-type.

But, how i described in my first mail, this only works for the root element of the schema, if i want to query another element, which isn't the root, and set the queryresult to the beans-type i always get the ClassCastException. 

Do you have any ideas, why or how i can do this better?

regards

Klaus

Am 05.06.2008 um 02:48 schrieb Radu Preotiuc-Pietro:

Hi Klaus,

After you go to the first Element after the existing result element, as
you say, why do you call getDomNode() and parse it again into XmlObject?
This seems redundant, why not just use the result of
XmlCursor.getObject()?

Radu 

-----Original Message-----
From: Klaus Dobbler [klaus_d@...] 
Sent: Wednesday, June 04, 2008 6:46 AM
Subject: Getting exist queryResult into XMLBeans

Hey.

I am currently developing a software under java to query data 
from exist and put the results into XMLBeans.

  my collection consits of 1 document. this document has some 
xsi:type attributes. (for example ContentCollectionType)

I'm using the xml:db api through java and I'm getting the 
result as XMLResource. (i inserted the needed namespaces in 
the XPathQueryService before) Then i convert this into a 
DOM-Node (getMemebers as Dom) and parse the DOM Node into a 
XMLObject. With a XMLCursor i go to the first Element after 
the exist result element,  
call getObject(), getDomNode() and parse it again into a XMLObject.   
This XMLObject i assign to the apropriate Beans-Type. For 
some types it works, but not for the Elements with the 
xsi:type attributes.

Does somebody know why this could be, or how i can do this 
better and easier?  I hope there is somebody who can help me,

regards

Klaus

regards

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



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@...
For additional commands, e-mail: user-help@...

LightInTheBox - Buy quality products at wholesale price