[jdom-interest] SAXParser exception problems

Alan Boldock alan at boldenterprise.com.au
Thu May 18 23:04:12 PDT 2006


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/9c6537c1/attachment.htm


More information about the jdom-interest mailing list