You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Laurent Yew <dr...@yahoo.com> on 2005/01/11 17:38:48 UTC

Problem with Xupdate

i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - now with 250MB free storage. Learn more.
		
---------------------------------
Do you Yahoo!?
 The all-new My Yahoo! � What will yours do?

Re: Problem with Xupdate

Posted by Laurent Yew <dr...@yahoo.com>.
Thanks for the fast reply but it does seems to be working. i tried instead of using a string for the XupdateQuery. i changed the query to a file and use a file reader to read it and pass it over.
It seems to be working but the original file is not changed. I'll look intensifly into the XupdateQuery file i created.
 
from
laurent

Hanifa Mohammed <ma...@yahoo.com> wrote:
hi
first u set ur URI that is give the proper URI
is this correct
"xmldb:xindice:///db/addressbook"
before /db/ you should give the localhost:8080 
 
then add the jar files in your build file
 
hope this will clear ur  error
 
urs
hanif

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more. 

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Find what you need with new enhanced search. Learn more.

Re: Problem with Xupdate

Posted by Hanifa Mohammed <ma...@yahoo.com>.
hi
first u set ur URI that is give the proper URI
is this correct
"xmldb:xindice:///db/addressbook"
before /db/ you should give the localhost:8080 
 
then add the jar files in your build file
 
hope this will clear ur  error
 
urs
hanif

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Problem with Xupdate

Posted by Laurent Yew <dr...@yahoo.com>.
thank you for your valuable advice. I deeply appreciate it.
 
Sincerely,
Laurent

Janvier Majirus <ma...@yahoo.fr> wrote:
I don't yet use JCreator.
I think a best way to understand an API is by trying it in native form. So try your code in command line, i think it shall work.
Reagards,
 
Majirus

Laurent Yew <dr...@yahoo.com> wrote:
I'm running my codes in JCreator.I haven't tried running it in the command line.

Janvier Majirus <ma...@yahoo.fr> wrote: Hi laurent,
I copied, compiled and run your example from command line without any problem.
How do you call your .class?
Sincerely, i don't see what is wrong in this snapshot.
 
regards,
majirus

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more. 

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?

---------------------------------
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr�ez votre Yahoo! Mail


---------------------------------
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.

---------------------------------
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr�ez votre Yahoo! Mail
		
---------------------------------
Do you Yahoo!?
 Meet the all-new My Yahoo! � Try it today! 

Re: Problem with Xupdate

Posted by Janvier Majirus <ma...@yahoo.fr>.
I don't yet use JCreator.
I think a best way to understand an API is by trying it in native form. So try your code in command line, i think it shall work.
Reagards,
 
Majirus

Laurent Yew <dr...@yahoo.com> wrote:
I'm running my codes in JCreator.I haven't tried running it in the command line.

Janvier Majirus <ma...@yahoo.fr> wrote: Hi laurent,
I copied, compiled and run your example from command line without any problem.
How do you call your .class?
Sincerely, i don't see what is wrong in this snapshot.
 
regards,
majirus

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more. 

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! – What will yours do?

---------------------------------
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail


---------------------------------
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
		
---------------------------------
 Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail

Re: Problem with Xupdate

Posted by Laurent Yew <dr...@yahoo.com>.
I'm running my codes in JCreator.I haven't tried running it in the command line.

Janvier Majirus <ma...@yahoo.fr> wrote:Hi laurent,
I copied, compiled and run your example from command line without any problem.
How do you call your .class?
Sincerely, i don't see what is wrong in this snapshot.
 
regards,
majirus

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more. 

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! � What will yours do?

---------------------------------
D�couvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Cr�ez votre Yahoo! Mail

		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - Easier than ever with enhanced search. Learn more.

Re: Problem with Xupdate

Posted by Janvier Majirus <ma...@yahoo.fr>.
Hi laurent,
I copied, compiled and run your example from command line without any problem.
How do you call your .class?
Sincerely, i don't see what is wrong in this snapshot.
 
regards,
majirus

Laurent Yew <dr...@yahoo.com> wrote:
i am having some difficulty running the following codes:
 
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 XindiceUpdate {
   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:DB Exception occured " + e.errorCode + " " +
            e.getMessage());
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}

error message which i got was:
 
org.apache.xindice.client.corba.db.APIException: IDL : org/apache/xindice/client/corba/db/APIException:1.0
 
 
Please help me. Thank you
 


---------------------------------
Do you Yahoo!?
Yahoo! Mail - now with 250MB free storage. Learn more.

---------------------------------
Do you Yahoo!?
The all-new My Yahoo! – What will yours do?
		
---------------------------------
 Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail