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));
Stop searching for code, let great code find you!  Add Codota to your java IDE