[jdom-interest] SAXParser exception problems
Kevin L Cobb
kevin.cobb at emergint.com
Fri May 19 05:25:45 PDT 2006
I think its simply that you aren't including the JAR file that has the
class, org.apache.xerces.parsers.SAXParser, in it. In you java.exe call,
add the classpath designation and include the JAR that contains this
missing class. Something like this:
java.exe -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-cp xerces.jar "bsh-2.0b4.jar"
Another hint, if you need to include other JARs in the classpath,
separte them with semicolons.
java.exe -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser
-cp xerces.jar;myOtherJar.jar;andAnother.jar "bsh-2.0b4.jar"
-Kevin
________________________________
From: jdom-interest-bounces at jdom.org
[mailto:jdom-interest-bounces at jdom.org] On Behalf Of Alan Boldock
Sent: Friday, May 19, 2006 2:04 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] SAXParser exception problems
Greetings folks,
this is not necessarily a JDOM question but I hope some one can help or
point me in a good direction:
I'm a beginner at this stuff so sorry if these are stupid questions.
I'm trying to write A screen scraping program to run on an XML Document
from within BeanShell using a SAX parser to Parse out the text in the
XML.
I'm starting BeanShell like this (all windows sorry)
java.exe -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser
"bsh-2.0b4.jar"
(as specified in Elliot Rust Harold, Processing XML with Java, page 263)
Now I want to use a SAXParser I have Xerces installed but when I do
this:
import org.xml.sax.*;
import org.xml.sax.helpers.XMLReaderFactory;
import java.io.IOException;
XMLReader parser = XMLReaderFactory.createXMLReader();
(as mentioned in the demo on page 262)
Now my understanding is that XMLReader is an interface and that
org.apache.xerces.parsers.SAXParser
is the static object being invoked here?
However I'm getting
java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser
is this perhaps a BeanShell or windows thing? Or am I missing the point?
Help greatly appreciated.
Alan
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.392 / Virus Database: 268.6.1/343 - Release Date:
18/05/2006
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20060519/cfb071df/attachment.htm
More information about the jdom-interest
mailing list