I'm having some problems with Xindice, the XML database.
Presently, I'm (trying) to run the Windows version of Xindice 1.0. I can run some of the example code, some not. The XUPdate code is giving me problems for a simple update on the database. When I try to run this code:
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
/**
* Simple XML
B 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/addressbook");
String xupdate = "<xu:modifications version=\"1.0\"" +
" xmlns:xu=\"http://www.xmldb.org/xupdate\">" +
" <xu:remove select=\"/person/phone[@type = 'home']\"/>" +
" <xu:update select=\"/person/phone[@type = 'work']\">" +
" 480-300-3003" +
" </xu:update>" +
"</xu:modifications>";
XUpdateQueryService service =
(XUpdateQueryService) col.getService("XUpdateQueryService", "1.0");
service.update(xupdate);
}
catch (XMLDBException e) {
System.err.println("XML
B Exception occured " + e.errorCode + " " +
e.getMessage());
}
finally {
if (col != null) {
col.close();
}
}
}
}
I get this exception:
org.apache.xindice.client.corba.db.APIException: IDL
rg/apache/xindice/client/corba/db/APIException:1.0
at org.apache.xindice.client.corba.db.APIExceptionHelper.read(APIExceptionHelper.java:112)
at org.apache.xindice.client.corba.db._CollectionStub.queryCollection(_CollectionStub.java:833)
at org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResult(XUpdateQueryServic
eImpl.java:165)
at org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpdateQueryServiceImpl.
java:185)
at org.apache.xindice.examples.XUpdate.main(XUpdate.java:91)
XML
B Exception occured 1 Query Processing Error
I looked at the javadocs and they say absolutely nothing on API Exceptions.
I'm running JDK 1.3 just as they asked and have all the jars they asked for in my CLASSPATH.
What's going on? How come their own example code would throw an exeption? Am I doing something wrong, or did they mess up their distribution?