�yvind,
your col equals null.
add 'col =' in line marked with 8-O. No offence ;-)
So long, hope it helps.
On Mon, 28 Jan 2002, �yvind Vestavik wrote:
>
>
>I am passing a well formed xml document as a DOM document into a method
>that is supposed to insert it into a dbxml database. But whenever i start
>my program i get a java.lang.NullpointerExeption
>
>I have found the line causing the trouble and it goes like this
>
>XMLResource resource =
> (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
>
>Anyone who could tell me what's wrong??
>
>The whole class/method goes like:
>
>import org.xmldb.api.base.*;
>import org.xmldb.api.modules.*;
>import org.xmldb.api.*;
>import org.w3c.dom.Document;
>import java.io.*;
>
>Public class AddDocument{
>
> public void add(Document doc) throws Exception{
>
> Collection col = null;
> try{
>
> String driver = "org.dbxml.client.xmldb.DatabaseImpl";
> Class c = Class.forName(driver);
> Database database = (Database) c.newInstance();
> 8-O
DatabaseManager.getCollection("xmldb:dbxml:///db/REAP/Profiles");
>
> String id = "test";
>
> //this is the line where the exception is thrown:
> XMLResource document =
> (XMLResource) col.createResource(id,
> XMLResource.RESOURCE_TYPE);
>
> document.setContentAsDom(doc); //doc is the received xml dom
> document
> col.storeResource(document);
>
> }
>
> catch (XMLDBExeption e){
> System.err.println("Error occured " + e.errorCode)
> }
>
> finally{
> if (col !=null){
> col.close;
> }
> }
> }
>}
>
>It would really help me if anyone of you knew what's wrong..
>
>Thanks �yvind
>
>�yvind Vestavik
>�vre M�llenberggt 44b
>7014 Trondheim
>[EMAIL PROTECTED]
>41422911
>
>
regards
Heinrich
--
http://www.xmlBlaster.org