I am getting SAXNotRecognizedException, while trying to set the property of ‘isSupportingExternalEntities’ in Java 8
final SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
sf.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
Exception:
org.xml.sax.SAXNotRecognizedException: Property ‘javax.xml.stream.isSupportingExternalEntities’ is not recognized.
I guess you use the wrong property for SchemeFactory. According to OWASP docs you should use the following code
SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
Schema schema = factory.newSchema(Source);