This should give you a pretty good skeleton for what you need to do. It i simply a rehash of the "dbXML Developers Guide" to take a DOM node as its input. I am
most likely missing an exception or two in the catch block as I have not tested the code.

   package org.dbxml.examples;

   import org.xmldb.api.base.*;
   import org.xmldb.api.modules.*;
   import org.xmldb.api.*;
   import org.w3c.dom.Node ;

   import java.io.*;

   public addDocument(Node dom) throws Exception {
      Collection col = null;

      try {
         String driver = "org.dbxml.client.xmldb.DatabaseImpl";
         Class c = Class.forName(driver);

         Database database = (Database) c.newInstance();
         DatabaseManager.registerDatabase(database);
         col = DatabaseManager.getCollection("xmldb:dbxml:///db/some_collection");

         XMLResource document = (XMLResource) col.createResource(null, "XMLResource");
         document.setContentAsDom(dom);
         col.storeResource(document);
         System.out.println("Document inserted");
      }
      catch (XMLDBException e) {
         System.err.println("XML:DB Exception occured " + e.errorCode);
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }

Hope it helps.

- Joel

Praveen Kumar K wrote:

Hi all,
   Sorry for resending.I have read all the API but
didn't find any clue(may be i'm blind) about
submitting to the dbXML as DOM object.I'm working for
a huge medical application. Fron end is using XML and
maintaing DOM as well. It has so many forms to fill
but it is maintaining the DOM as well. Now I'ld like
to submit the data in the end. Then all the data
stored in DOM object till now should submit to the
database. How can I do this? It's very urgent for
me.Please help me out.
ThanX in adv.

=====
Good judgement comes from experience, and experience comes from bad judgement.

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

_______________________________________________
dbXML-Core-General mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dbxml-core-general

begin:vcard 
n:Rosi-Schwartz;Joel
tel;fax:+44 1435 831011
tel;home:+44 1435 831010
tel;work:+44 1435 831010
x-mozilla-html:TRUE
org:Techne Research Limited
version:2.1
email;internet:[EMAIL PROTECTED]
title:Architect
adr;quoted-printable:;;Downgate Farmhouse=0D=0AFurnace Lane;Warbleton near Heathfield;East Sussex;TN21 9AZ;United Kingdom
fn:Joel Rosi-Schwartz
end:vcard

Reply via email to