R
Ren, Ziheng
Hi,
i have already found a xindice based java gui. but it appears always a big
problem from the xupdate functions. If i tip some commands in and try to
execute them, it will appear an exception, this result from the example
http://xml.apache.org/xindice/guide-developer.html#N1025F are
extraordinarily similar:
*********************** Exception ************************
org.apache.xindice.client.corba.db.APIException:
IDLrg/apache/xindice/client/corba/db/APIException:1.0
at
org.apache.xindice.client.corba.db.APIExceptionHelper.read(APIExceptionHelpe
r.java:112)
at
org.apache.xindice.client.corba.db._CollectionStub.queryCollection(_Collecti
onStub.java:833)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResul
t(XUpdateQueryServiceImpl.java:165)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpd
ateQueryServiceImpl.java:185)
at XUpdate.main(XUpdate.java:41)
XMLB Exception occured 1 Query Processing Error
**********************************************************
******************** Source Code **************************
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
/**
* Simple XMLB 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("XMLB Exception occured " + e.errorCode + " "
+
e.getMessage());
}
finally {
if (col != null) {
col.close();
}
}
}
}
**********************************************************
******************* Baum Struktur ************************
db
-addressbook
-address1 (XML Datei aus Xindice)
-address2 (XML Datei aus Xindice)
**********************************************************
i have also tested another gui(from
http://titanium.dstc.edu.au/xml/xmldbgui/screenshots.shtml) in different
versions of jre. but it appears the same problem. i'm not sure, whether it's
my problem or has xindice made sth wrong...
Thank you for your friendly help.
i have already found a xindice based java gui. but it appears always a big
problem from the xupdate functions. If i tip some commands in and try to
execute them, it will appear an exception, this result from the example
http://xml.apache.org/xindice/guide-developer.html#N1025F are
extraordinarily similar:
*********************** Exception ************************
org.apache.xindice.client.corba.db.APIException:
IDLrg/apache/xindice/client/corba/db/APIException:1.0
at
org.apache.xindice.client.corba.db.APIExceptionHelper.read(APIExceptionHelpe
r.java:112)
at
org.apache.xindice.client.corba.db._CollectionStub.queryCollection(_Collecti
onStub.java:833)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.updateResul
t(XUpdateQueryServiceImpl.java:165)
at
org.apache.xindice.client.xmldb.services.XUpdateQueryServiceImpl.update(XUpd
ateQueryServiceImpl.java:185)
at XUpdate.main(XUpdate.java:41)
XMLB Exception occured 1 Query Processing Error
**********************************************************
******************** Source Code **************************
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
/**
* Simple XMLB 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("XMLB Exception occured " + e.errorCode + " "
+
e.getMessage());
}
finally {
if (col != null) {
col.close();
}
}
}
}
**********************************************************
******************* Baum Struktur ************************
db
-addressbook
-address1 (XML Datei aus Xindice)
-address2 (XML Datei aus Xindice)
**********************************************************
i have also tested another gui(from
http://titanium.dstc.edu.au/xml/xmldbgui/screenshots.shtml) in different
versions of jre. but it appears the same problem. i'm not sure, whether it's
my problem or has xindice made sth wrong...
Thank you for your friendly help.