<P>Hi</P>
<P>I'm not sure if this is a JDOM issue or a Xerces issue, but I'm getting the following error when I try to use the JDOM SAXBuilder setProperty() method to get to my Xerces parser to set a schemaLocation for a namespace. </P>
<P>Here's the code (it's the setProperty() call that breaks): </P>
<P><FONT size=1>SAXBuilder builder =new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);<BR>builder.setFeature("</FONT><A href="http://apache.org/xml/features/validation/schema"><FONT size=1>http://apache.org/xml/features/validation/schema</FONT></A><FONT size=1>", true);<BR>builder.setProperty("</FONT><A href="http://apache.org/xml/properties/schema/external-schemaLocation"><FONT size=1>http://apache.org/xml/properties/schema/external-schemaLocation</FONT></A><FONT size=1>",<BR> "</FONT><A href="http://www.xbrl.org/2001/XLink/xbrllinkbase"><FONT size=1>http://www.xbrl.org/2001/XLink/xbrllinkbase</FONT></A><FONT size=1> </FONT><A href="http://www.xbrl.org/2001/xbrl-linkbase.xsd"><FONT size=1>http://www.xbrl.org/2001/xbrl-linkbase.xsd</FONT></A><FONT size=1>");</FONT></P>
<P>I know the namespace/schemaLocation strings are valid because if I comment out setProperty() and paste them into the document I'm trying to validate itself as the schemaLocation attribute of the root, validation succeeds. However, I think the spec says that's just a 'hint' for the parser, and also some documents I'll be seeing only have the filename not the complete url of the schema, so I'd like to force it like this. According to some code I got from JDOM, the above should work. However, when I run my app I get the following trace:</P>
<P> </P>
<P><FONT size=1>java.lang.ClassCastException<BR> at org.apache.xerces.impl.xs.XMLSchemaLoader.processExternalHints(Unknown Source)<BR> at org.apache.xerces.impl.xs.XMLSchemaValidator.reset(Unknown Source)<BR> at org.apache.xerces.parsers.BasicParserConfiguration.reset(Unknown Source)<BR> at org.apache.xerces.parsers.DTDConfiguration.reset(Unknown Source)<BR> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)<BR> at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)<BR> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)<BR> at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)<BR>
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:371)<BR> at org.jdom.input.SAXBuilder.build(SAXBuilder.java:814)<BR> at JDOMLinkBaseSAXViewer.main(JDOMLinkBaseSAXViewer.java:143)<BR></FONT></P>
<P>Any help?</P>
<P> </P>
<P>Thnaks in advance, </P>
<P>Brian Ales</P><BR><BR><p><br><hr size=1>Do you Yahoo!?<br>
<a href="http://webhosting.yahoo.com/ps/wh3/prod/">Yahoo! Web Hosting</a> - establish your business online