Hi,
i am a student of university. I had choosen xindice for universitary project. I
had win xp, jdk 1.5, tomcat 5.5 and i had set all like instruction on apache
web site.
But xupdate not work.
This is the error at command line:
Exception in thread "main" java.lang.ClassNotFoundException: org.apache.xindice.
client.xmldb.DatabaseImpl
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at PartsXupdate.main(PartsXupdate.java:10)
This is my servlet:
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
public class PartsXupdate {
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://localhost:8080/db/esame");
String xupd = "<xupdate:modifications version=\"1.0\"" +
"xmlns:xupdate=http://www.xmldb.org/xupdate>" +
"<xupdate:insert-after select=\"/scheda/info/id[value='1']\">" +
"<xupdate:element name=\"commento\">Bel libro!</xupdate:element>" +
"</xupdate:insert-after>" +
"</xupdate:modifications>";
String nome="1.xml";
/* We are using XUpdateQueryService */
XUpdateQueryService service =
(XUpdateQueryService) col.getService("XUpdateQueryService",
"1.0");
service.updateResource(nome, xupd);
}
catch (XMLDBException e) {
System.err.println("XML:DB Exception occurred " + e.errorCode);
}
finally {
if (col != null) { col.close();}
}
}
}
Thank for help!
Bye
------------------------------------------------------
Passa a Infostrada. ADSL e Telefono senza limiti e senza canone Telecom
http://click.libero.it/infostrada