Title: DOMParser doesn't make a instance in Oracle 8i

Hi~

I tried to Java Stored Procedure program under Oracle 8.1.6. I programed follow way.

import java.io.*;
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.apache.xerces.dom.TextImpl;

public class DB2XML {

  public DB2XML() {
  }

  public DB2XML(String strDocType, String strDataKey) {
    getData(strDocType, strDataKey);
  }

  public static void main(String argv[]) {
    DB2XML db2XML = new DB2XML();
    try {
         db2XML.getData("minOne", "recNo:2;minNo:2");
    }
    catch(Exception e) {
            e.printStackTrace();
    }
  }

  /** Data Retrieve from Database */
  public static String getData(String docType, String strDataKey) {
    String uri = "file:///D:/db2xml.xml";
    Document document=null;
    try {
            // CourtHouse.xml을 파싱한다.
            Class domClass = Class.forName("org.apache.xerces.parsers.DOMParser");

            domParser = (org.apache.xerces.parsers.DOMParser) domClass.newInstance();

            if(domParser == null)
              return "Dom Parser NULLLLLLLLLLL";
            //domParser = new org.apache.xerces.parsers.DOMParser();

            domParser.parse(uri);
        //document = domParser.getDocument();
    }
    catch(Exception e)
    {
      return e.getClass().getName() + " Fail DOMParser"+e.toString()+" \t"+uri;
    }
  }
}


After I load the java class to Oracle, I create a function to call db2xml class.

CREATE OR REPLACE FUNCTION db_xml2(docType varchar2, dataKey varchar2 ) RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'com.cotech.xml.adapter.DB2XML.getData(java.lang.String, java.lang.String) return java.lang.String';
/

variable curDir varchar2(4000)
execute :curDir := db_xml2('test', '123');

The Return value is here,

CURDIR
--------------------------------------------------------------------------------
java.lang.NullPointerException Fail DOMParser java.lang.NullPointerException
file:///D:/db2xml.xml

Is any idea about the problem? Why does it return java.lang.NullPointerException? DOMParser doesn't be instanced, is it?

I'll appreciate any your opinions~
Have a nice day~~

=============================================
Tae Hoe Koo([EMAIL PROTECTED])
in COTECH Company(http://www.cotech.co.kr)
Tel : +82-2-6252-5146   ICQ # : 63681610
Fax : +82-2-3482-3335
Address : Seongwoo B. 11F (137-070)
               Seochodong Seochogu Seoul.

Reply via email to