Using Xeces 1.1.3, I'm attempting to validate and XML instance document contained in a jar file against a schema contained in the same package in the same jar file.The problem I'm encountering is how to I specify the schemaLocation attribute on the instance document. I've tried several permutations, none of which work. XMLValidator.class consistently reports file not found.
For example the two file myxml.xml and myschema.xsd are located in package
in the same jar file. The jar file is in the classpath. If I specify the xml instance document using the the following  schemaLocation attribute
    xsi:schemaLocation=" /com/mycompany/files/myschema.xsd"
I get the following error  message and exception
[Error] :1:213: General Schema Error: Stopping after fatal error: File "file:///com/mycompany/files/myschema.xsd" not found..
        at org.apache.xerces.validators.common.XMLValidator.resolveSchemaGrammar(
        at org.apache.xerces.validators.common.XMLValidator.bindNamespacesToElementAndAttributes(
        at org.apache.xerces.validators.common.XMLValidator.callStartElement(
        at org.apache.xerces.framework.XMLDocumentScanner.scanElement(
        at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(
        at org.apache.xerces.framework.XMLDocumentScanner.parseSome(
        at org.apache.xerces.framework.XMLParser.parse(
        at com.synergy.xml.wrappers.NonValidatingDOMParser.parse(
        at com.synergy.rules.SRule.getRuleDocument(
        at SLoadRulesFrameWork.<init>(
        at SLoadRulesFrameWork.main( grammar not found
Looking at and the way in which it uses the DefaultEntityHandler's expandSystemId function it appears that it expects the schema to be on the file system, and not as in my case wrapped up in a jar file. I've included the code from lines 2036 to 2039 of XMLValidator to illustrate the point.
            if (source == null) {
                loc = fEntityHandler.expandSystemId(loc);
                source = new InputSource(loc);
            try {
                parser.parse( source );
            }catch( IOException e ) {
            }catch( SAXException e ) {
                file://System.out.println("loc = "+loc);
                reportRecoverableXMLError( XMLMessages.MSG_GENERIC_SCHEMA_ERROR,
                                           XMLMessages.SCHEMA_GENERIC_ERROR, e.getMessage() );
It's quite possible that I've misinterpreted the code, but is there any way in which I could specify the EntityHandler used by XMLValidator so that I could use getClass().getResouceAsStream() for example to reference the schema.
Thanks in advance for any help with this issue.
Tony Dodd