Re: xupdate update fails but query using xpath succeeds?
Yan Langlois <[email protected]> Mon, 05 Sep 2005 00:01:39 +0200
| Newsgroups | gmane.text.xml.xindice.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
When you use the method "updateResource("PO-NI-01", updateXml);" the
operation only concerns the document called PO-NI-01. I think this
document does not exist in your database.
When you test this line : ResourceSet resourceSet =
queryService.query(queryXml);. the operation concerns on the whole
collection.
To correct your program, you should use this method:
"updateService.*update*(updateXml);", because the operation concerns the
whole collection. Or you should check if the document "PO-NI-01" exists.
Tell me whether it helps you or not,
Yan.
Julie McCabe wrote:
>Hello,
>
>Im trying to execute a xupdate to change the value of an element in an
>document.
>
>String updateXml = "<xupdate:modifications version=\"1.0\""
> + " xmlns:xupdate=\"http://www.xmldb.org/xupdate\">"
> + "<xupdate:update
>select=\"/domain/service[@key='PLAYOUT']/memberVariable[name='channel'] \">"
>+ "channel1"
> + "</xupdate:update>"
> + "</xupdate:modifications>";
>
> Collection collection = con.getCollection();
> XUpdateQueryService updateService = (XUpdateQueryService)
> collection.getService("XUpdateQueryService", "1.0");
> updateService.updateResource("PO-NI-01", updateXml);
>
>The exception thrown is @ the server ...
>1168620 [http-8080-Processor23] WARN
>org.apache.xindice.core.xupdate.XUpdateQueryResolver - ignored exception
>java.lang.NullPointerException
> at org.xmldb.xupdate.lexus.commands.UpdateCommand.execute(Unknown
>Source)
> at
>org.apache.xindice.core.xupdate.XUpdateImpl.execute(XUpdateImpl.java:116)
> at
>org.apache.xindice.core.xupdate.XUpdateQueryResolver$XUpdateQuery.execute(XUpdateQueryResolver.java:142)
> at
>org.apache.xindice.core.xupdate.XUpdateQueryResolver.query(XUpdateQueryResolver.java:84)
> at
>org.apache.xindice.core.query.QueryEngine.query(QueryEngine.java:122)
> at
>org.apache.xindice.core.Collection.queryDocument(Collection.java:1242)
> at org.apache.xindice.server.rpc.messages.Query.execute(Query.java:58)
> at
>org.apache.xindice.server.rpc.RPCMessageInterface.run(RPCMessageInterface.java:48)
> at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
> at
>sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.apache.xmlrpc.Invoker.execute(XmlRpcServer.java)
> at
>org.apache.xmlrpc.XmlRpcServer$Worker.executeInternal(XmlRpcServer.java)
> at org.apache.xmlrpc.XmlRpcServer$Worker.execute(XmlRpcServer.java)
> at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
> at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java)
> at
>org.apache.xindice.server.XindiceServlet.doPost(XindiceServlet.java:90)
>....................
>
>>From the client it appears as if the update is successfull! Ive tested the
>select part of the xupdate query and it returns a document segement as
>expected - I tested this with ....
>
>Collection collection = con.getCollection();
> XPathQueryService queryService = (XPathQueryService)
> collection.getService("XPathQueryService", "1.0");
> ResourceSet resourceSet = queryService.query(queryXml);
>
>
>Any ideas on this matter are greatly appreciated, as it doesnt make sense to
>me :)
>
>Configuration: xindice 1.1b4, tomcat 5.0.30, jdk 1.5, os RH 9.0.
>
>Regards,
>Julie.
>
>
>
>
>