[jdom-interest] SAXBuilder.setProperty() to schemaLocation

Brian Ales bka202 at yahoo.com
Tue Mar 11 09:32:07 PST 2003


Hi

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.  

Here's the code (it's the setProperty() call that breaks): 

SAXBuilder builder =new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
builder.setFeature("http://apache.org/xml/features/validation/schema", true);
builder.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",
                    "http://www.xbrl.org/2001/XLink/xbrllinkbase http://www.xbrl.org/2001/xbrl-linkbase.xsd");

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:

 

java.lang.ClassCastException
        at org.apache.xerces.impl.xs.XMLSchemaLoader.processExternalHints(Unknown Source)
        at org.apache.xerces.impl.xs.XMLSchemaValidator.reset(Unknown Source)
        at org.apache.xerces.parsers.BasicParserConfiguration.reset(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.reset(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.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:371)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:814)
        at JDOMLinkBaseSAXViewer.main(JDOMLinkBaseSAXViewer.java:143)


Any help?

 

Thnaks in advance, 

Brian Ales





---------------------------------
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20030311/36c8df53/attachment.htm


More information about the jdom-interest mailing list