I am trying xml validation against given xsd file in android and everytime I include the following line the application stops unexpectedly:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Here is relevant code snippet:
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
File schemaLocation = new File("/sdcard/sep.xsd");
Schema schema = factory.newSchema(schemaLocation);
Validator validator = schema.newValidator();
Source source = new StreamSource("/sdcard/gtp.xml");
try {
validator.validate(source);
}
catch (SAXException ex) {
Toast toast = Toast.makeText(this, "invalid", Toast.LENGTH_SHORT);
toast.show();
}