Code example for SAXParserFactory

Methods: newSAXParsersetFeaturesetNamespaceAwaresetValidating

		// SAX2 namespace-prefixes should be true for either builder 
		setSafeFeature(fty, "", true);
		// Set SAX2 namespaces feature appropriately 
		setSafeFeature(fty, "", nsaware);
		setSafeFeature(fty, "", validate);
		setSafeFeature(fty, "", validate);
		_parser = fty.newSAXParser();
	private static 
	void setSafeFeature(SAXParserFactory fty, String feature, boolean value) {
		try { 
			fty.setFeature(feature, value);
		} catch (Throwable ex) {
			//IGNORE IT (crimson doesn't support ...validation/schema) 
			if (feature.startsWith(""))
				log.warning("Ignored: "+fty+" doesn't support "+feature+". Cause: "+Exceptions.getMessage(ex));
Connect your IDE to all the code out there  Get Codota for Java