[jdom-interest] JDOM Xerces and Xalan versions

Martin Bravenboer mbravenb at students.cs.uu.nl
Wed Oct 24 13:50:07 PDT 2001


Hey,


> I am experiencing ClassCastException when attempting to use the JDOM
> SAXBuilder with Tomcat 4.0.1 on the JDK 1.4.  It's trying to cast a
> SAXParser to an XMLReader (which I have built the source for and know it
> implements... very strange)


I had exactly the same problem, with JDK 1.4 beta 2 and Tomcat. I used a 
very dirty hack to solve it. I didn't understand the problem (have tried 
quite a lot of options) and had to use Xerces for XML Schema support.

import org.jdom.input.SAXBuilder;
import org.apache.xerces.parsers.SAXParser;
import org.xml.sax.XMLReader;

public class XercesBuilder extends SAXBuilder
{
	public XercesBuilder(boolean validating)
	{
		super(validating);
	}

	protected XMLReader createParser() throws Exception
	{
		return new SAXParser();
	}
}

Hope anyone can find out what's going, it's really very obscure.

Greetings,
Martin




More information about the jdom-interest mailing list