Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] SAXParser exception problems

Alan Boldock

2006-05-19

Replies:

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

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.