You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Matthieu RIOU <ma...@yahoo.fr> on 2003/10/13 11:51:20 UTC

Updating specific documents in a Collection

Hi,
 
I want to update a document in a collection but the element used to select the document in the collection and the element I want to replace are different. For example in :
 
<user>
      <name>Joe</name>
      <address>
            <street>Michigan Avenue</street>
            <city>Chicago</city>
      </adresse>
</user>
 
How can I express that I want to change the city to Detroit in the document having Joe as name ?? My understanding is that xupdate is made to update a document so how do you do when you want to update only some documents in a collection ??
 
Thanks a lot. Matt.





---------------------------------
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Testez le nouveau Yahoo! Mail

org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe ????

Posted by Matthieu RIOU <ma...@yahoo.fr>.
Hi,

I'm trying to execute the following xupdate query with
xindice :

<xu:modifications version="1.0"
xmlns:xu="http://www.xmldb.org/xupdate">
   <xu:update
select="/root/twister-id[.='variable16036']/../part11">
     
      <xu:value-of
select="/root/twister-id[.='variable26036']/../part21"/>
   </xu:update>
</xu:modifications>

I'm getting a rather puzzling exception and have
absolutely no idea of what could be the problem :

org.omg.CORBA.UNKNOWN:   vmcid: 0x0  minor code: 0
completed: Maybe
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at java.lang.Class.newInstance0(Class.java:306)
	at java.lang.Class.newInstance(Class.java:259)
	at
com.sun.corba.se.internal.iiop.messages.ReplyMessage_1_2.getSystemException(ReplyMessage_1_2.java:90)
	at
com.sun.corba.se.internal.iiop.ClientResponseImpl.getSystemException(ClientResponseImpl.java:105)
	at
com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:309)
	at
org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
	at
org.apache.xindice.client.corba.db._CollectionStub.queryCollection(_CollectionStub.java:820)
	at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResult(XUpdateQueryServiceImpl.java:165)
	at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpdateQueryServiceImpl.java:185)
	at
org.smartcomps.twister.engine.priv.core.dynamic.impl.xao.VariableXAO.copyVariable(VariableXAO.java:77)
	at
org.smartcomps.twister.engine.priv.core.dynamic.impl.xao.VariableXAO.main(VariableXAO.java:128)
org.xmldb.api.base.XMLDBException: 
	at
org.apache.xindice.core.FaultCodes.createXMLDBException(FaultCodes.java:247)
	at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResult(XUpdateQueryServiceImpl.java:170)
	at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpdateQueryServiceImpl.java:185)
	at
org.smartcomps.twister.engine.priv.core.dynamic.impl.xao.VariableXAO.copyVariable(VariableXAO.java:77)
	at
org.smartcomps.twister.engine.priv.core.dynamic.impl.xao.VariableXAO.main(VariableXAO.java:128)

If somebody have any idea about it, please tell me.

Thanks. Matt.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: Updating specific documents in a Collection

Posted by Craig Schaepe <cr...@comcast.net>.
But what if <user> is in a collection of <userS> and I want to replace the
whole <user> element and its contents.  It seems I can only do this by
removing the current <user> and appending the new <user> at the correct
location.  I would prefer to do this in with one command.
It seems the <xupdate:update> command does not support the updating of a
block of xml only the element data.

-Craig

----- Original Message ----- 
From: "Julie McCabe" <ju...@qub.ac.uk>
To: <xi...@xml.apache.org>
Sent: Monday, October 13, 2003 6:12 AM
Subject: Re: Updating specific documents in a Collection


Hi,

I think the following should work,

use the xupdate XML as,

<xupdate:modifications version="1.0"
xmlns:xupdate="http://www.xmldb.org/xupdate">
<xupdate:update
select="/user/name[.='Joe']/../city">Detriot</xupdate:update>
</xupdate:modifications>

then if your using Java -  call s'thing like,

XUpdateQueryService updateService = ....
updateService.update(updateXml);


Regards,
Julie.

On Monday 13 October 2003 10:51, Matthieu RIOU wrote:
> Hi,
>
> I want to update a document in a collection but the element used to select
> the document in the collection and the element I want to replace are
> different. For example in :
>
> <user>
>       <name>Joe</name>
>       <address>
>             <street>Michigan Avenue</street>
>             <city>Chicago</city>
>       </adresse>
> </user>
>
> How can I express that I want to change the city to Detroit in the
document
> having Joe as name ?? My understanding is that xupdate is made to update a
> document so how do you do when you want to update only some documents in a
> collection ??
>
> Thanks a lot. Matt.
>
>
>
>
>
> ---------------------------------
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Testez le nouveau Yahoo! Mail


Re: Updating specific documents in a Collection

Posted by Julie McCabe <ju...@qub.ac.uk>.
Hi,

I think the following should work,

use the xupdate XML as,

<xupdate:modifications version="1.0" 
xmlns:xupdate="http://www.xmldb.org/xupdate">
	<xupdate:update select="/user/name[.='Joe']/../city">Detriot</xupdate:update>
</xupdate:modifications>

then if your using Java -  call s'thing like,

XUpdateQueryService updateService = ....
updateService.update(updateXml);


Regards,
Julie.

On Monday 13 October 2003 10:51, Matthieu RIOU wrote:
> Hi,
>
> I want to update a document in a collection but the element used to select
> the document in the collection and the element I want to replace are
> different. For example in :
>
> <user>
>       <name>Joe</name>
>       <address>
>             <street>Michigan Avenue</street>
>             <city>Chicago</city>
>       </adresse>
> </user>
>
> How can I express that I want to change the city to Detroit in the document
> having Joe as name ?? My understanding is that xupdate is made to update a
> document so how do you do when you want to update only some documents in a
> collection ??
>
> Thanks a lot. Matt.
>
>
>
>
>
> ---------------------------------
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Testez le nouveau Yahoo! Mail