On Mon, 25 Mar 2002, Mark J. Stang wrote:

> This is either a bug or something you are doing wrong.   Can you
send
> a sample of the code so the list can try and determine which it is?
>
> Mark
>
 
Hi, below is my code segment:
    Thanks for help.

public class DBXMLProxy
{

   public static String add_doc(String docname, String URI) throws
Exception {
      Collection col = null;
      String retval;
      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/mobiledata");

         String data = readFileFromDisk(docname);

         XMLResource document = (XMLResource) col.createResource(URI,
            "XMLResource");
         document.setContent(data);
         col.storeResource(document);
         retval = "1";
      }
      catch (XMLDBException e) {
         System.out.println("XML:DB Exception occured " + e.errorCode
+ " " +
            e.getMessage());
         retval = null;
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
      return retval;
   }
  ...
  similar routines to do xml related work
  ....

   public static void main(String[] args) throws Exception
    {
      ...
      loop
      {
        get request from other programs, and call requested routine.
      }
     ...
   }
}
      
-- 
Jinsuo Zhang

CISE department
Univ of Florida

Reply via email to