Problems with SAX parser in Java (SAX2 driver class javax.xml.parsers.SAXParser found but cannot be

P

Per Magnus L?vold

Hi!
I am new to XML parsing, and I'm trying to parse an XML file which is
passed as a BufferedReader object.
I have followed the steps described in a Javaworld article
(http://www.javaworld.com/javaworld/jw-08-2000/jw-0804-sax.html) which
seems quite simple. I've also downloaded the latest Web Services
Developer Pack, installed it, and added the jar-file to the classpath
in JDeveloper.

After programming the parser class, I get an error message which I
can't figure out of:
"Unexpected error: SAX2 driver class javax.xml.parsers.SAXParser found
but cannot be loaded"

Why can't it be loaded? Any ideas?

Here is a sample of my code:

/*
* this is the class that calls the XML parser (myXMLParser)
* I beleive the error must lie here somewhere, or perhaps in the
configuration?
*/
myXMLParser test = new myXMLParser();
String parserclass =
System.getProperty("org.xml.sax.driver","javax.xml.parsers.SAXParser");
/*
* I beleive the error comes on this next line. 'parserclass' is
* identified as "javax.xml.parsers.SAXParser", which is found but
cannot
* be loaded? What could be wrong? It is added to the classpath.
*/
XMLReader xr = XMLReaderFactory.createXMLReader(parserclass);
xr.setContentHandler(test);
// 'br' (below) is the BufferedReader object of an XML file
xr.parse(new InputSource(br));

Regards, PML
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top