[jdom-interest] ClassCastException

Per Norrman per.norrman at austers.se
Thu Jul 15 03:28:50 PDT 2004


The value of the external-schemaLocation should be a
pair of namespace and URL, shouldn't it?

Also, I get by without the JAXP_SCHEMA_LANGUAGE property.


Lachlan Paterson wrote:

> 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@yourhost.com

More information about the jdom-interest mailing list