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:[email protected]]
Sent: Wednesday, August 10, 2011 12:50 PM
To: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]