Java Mailing List Archive

http://www.junlu.com/

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

[jdom-interest] ClassCastException

Lachlan Paterson

2004-07-14

Replies:

I am using the the latest JDOM release (Beta 10 Release Candidate 1), and having problems parsing and validating against a schema, after setting the external-schemaLocation property.

I am following the example here: http://jdom.org/docs/faq.html#a0360 and I am using Xerces-J 2.6.2 as my parser. This is my code (where sFile is the schema):
     
builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
builder.setFeature("http://apache.org/xml/features/validation/schema", true);
builder.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
builder.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation"   , sFile.toURL());
org.jdom.Document doc = builder.build(xmlDoc);


I get this exception:

java.lang.ClassCastException
 at org.apache.xerces.impl.xs.XMLSchemaLoader.reset(Unknown Source)
 at org.apache.xerces.impl.xs.XMLSchemaValidator.reset(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.configurePipeline(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.jdom.input.SAXBuilder.build (SAXBuilder.java:455)
 at org.jdom.input.SAXBuilder.build (SAXBuilder.java:809)
 at org.jdom.input.SAXBuilder.build (SAXBuilder.java:788)

I don't know if this is a JDOM problem, a SAX problem, or something I am doing wrong. Has anyone else run into this?

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