I think you want to do:

reader.setEntityResolver(new EntityResolver() {
        
        @Override
        public InputSource resolveEntity(String publicId, String systemId)
                        throws SAXException, IOException {
                InputSource result = null;
                // result = get the file from disk or however you need to do it 
();
                return result;
        }
});
 

-----Original Message-----
From: Papendieck, Thomas [mailto:thomas.papendi...@opitz-consulting.com] 
Sent: Wednesday, August 10, 2011 12:50 PM
To: j-users@xerces.apache.org
Subject: xerces ignores 
reader.setProperty(SCHEMA_LOCATION_PROPERTY,"path/to/xsd")

Hi, 

sometimes I get documents where 'schemaLocation' is set to an absolute path on 
the file creators computer. In this cases validation of the document fails 
because the xsd cannnot be found at that location on my computer.

I tried to pass the location on my computer via XMLReader reader = 
XMLReaderFactory.createXMLReader(SAX_PARSER_CLASS);
            reader.setFeature(VALIDATION_FEATURE, true);
            reader.setFeature(SCHEMA_FEATURE, true);
            reader.setFeature(FULLCHECK_FEATURE, true);
            reader.setProperty(SCHEMA_LOCATION_PROPERTY, xsdNamespace + " " + 
xsdLocation);
            reader.parse(xmlLocation);
but I still get xerces complaining not finding the xsd file at the location 
refered to in the file.

How do I force xerces to use the schemaLocation I passed programmatically?

bye
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to