Hi Rob,
Well, Xerces releases have existed where
org.apache.xerces.parsers.SAXParser didn't implement XMLReader. They're
*really* old, and I can't imagine how you'd run into one, but I wonder if
it's possible that you've got some kind of strange situation where,
somehow, the first class by this name which Xerces class-loading strategy
encounters is from an ancient xerces?
Anyway, your code works happily on my machine--IBM JDK 1.3.1, no custom
class loaders of any kind.
Cheers,
Neil
Neil Graham
XML Parser Development
IBM Toronto Lab
Phone: 905-413-3519, T/L 969-3519
E-mail: [EMAIL PROTECTED]
|---------+---------------------------->
| | "Rob Outar" |
| | <[EMAIL PROTECTED]|
| | o.org> |
| | |
| | 10/28/2002 03:39 |
| | PM |
| | Please respond to|
| | xerces-j-user |
| | |
|---------+---------------------------->
>---------------------------------------------------------------------------------------------------------------------------------------------|
|
|
| To: <[EMAIL PROTECTED]>, "Rishi Khanna" <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: RE: Class Cast Exception
|
|
|
|
|
>---------------------------------------------------------------------------------------------------------------------------------------------|
Additional info, exception states:
SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement
XMLReader
which makes no sense.
Thanks,
Rob
-----Original Message-----
From: Rishi Khanna [mailto:[EMAIL PROTECTED]
Sent: Monday, October 28, 2002 3:22 PM
To: [EMAIL PROTECTED]
Subject: Re: Class Cast Exception
I haven't implemented this with XMLReaderFactory, but if you're
willing to try, you can load the class with the following code:
XMLReader parser = (XMLReader) Class.forName
("org.apache.xerces.parsers.SAXParser").newInstance();
----- Original Message -----
From: Rob Outar
To: [EMAIL PROTECTED]
Sent: Monday, October 28, 2002 3:13 PM
Subject: Class Cast Exception
I am trying to upgrade to Xerces 2, we are trying something very
trivial but it will not work:
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
/**
* @testcase net.onesaf.services.data.xml.sax.TestSAX
*/
public class SAX {
public SAX(){
try {
System.out.println("In here");
XMLReader parser = XMLReaderFactory.createXMLReader(
"org.apache.xerces.parsers.SAXParser");
System.out.println("out here");
}
catch(Exception e){
System.out.print(e);
}
}
but we keep getting a ClassCastException
In here
java.lang.ClassCastException
What are we doing wrong?
Thanks,
Rob
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]