HI folks,
Can anyone help on xupdate, i have been trying it out for the past
3 days, but in vain.
My config is Cocoon 2.0.1, tomcat 3.2, jdk 1.3.1 and win2000.
I am trying to execute the code below,if i use service.update()
method i get "0 rows updated" message.
my search criteria is right , i am in a fix as to where the
problem could be.
If i you updateResource() with the object id, i get the foll.
exception at the xindice server and the message "0 rows
updated".
Exception:
va.lang.ClassCastException:
org.apache.xml.dtm.ref.DTMNodeIterator
at
org.apache.xindice.core.xupdate.XObjectImpl.nodeset(Unknown
Source)
Thanx,
Shesh
-----------------------------------------------------
Source
-------------------------------------------------------
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
/**
* Simple XML:DB API example to update the database.
*/
public class XUpdate
{
public static void main(String[] args) throws Exception
{
Collection col = null;
try
{
String driver =
"org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col =
DatabaseManager.getCollection("xmldb:xindice:///db/addresses");
// col =
DatabaseManager.getCollection("xmldb:xindice://localhost:4080/db/addresses");
String xupdate = "<xu:modifications version=\"1.0\"
xmlns:xu=\"http://www.xmldb.org/xupdate\"> "+
" <xu:update select=\"/addresses/address[@id='2']/country\">"
+
"Mumbai city" +
"</xu:update>" +
"</xu:modifications>";
System.out.println("Xupdate :"+xupdate);
XUpdateQueryService service = (XUpdateQueryService)
col.getService("XUpdateQueryService", "1.0");
long count=service.update(xupdate);
// long count=service.updateResource("shoid",xupdate);
System.out.println("Rows updated :"+count);
}
catch (XMLDBException e)
{
System.err.println("XML:DB Exception occured " +
e.errorCode + " " + e.getMessage());
e.printStackTrace();
}
finally
{
if (col != null)
{
col.close();
}
}
}
}
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>