Code example for SAXParserFactory

Methods: setFeaturesetNamespaceAwaresetValidating

0
		this.entityResolver = entityResolver;
		this.astroboaVersion = astroboaVersion;
 
		//Create SAX Parser 
		parserFactory = SAXParserFactory.newInstance();
		parserFactory.setNamespaceAware(true);
		parserFactory.setValidating(false);
		parserFactory.setFeature("http://apache.org/xml/features/validation/schema",true);
		parserFactory.setFeature("http://xml.org/sax/features/validation", true);
		parserFactory.setFeature("http://xml.org/sax/features/namespaces",true);
		//parserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); This feature is not recognized 
		 
		/* 
		 *  
		 * A true value for this feature allows the encoding of the file to be specified as a  
		 * Java encoding name as well as the standard ISO encoding name. Be aware that other  
		 * parsers may not be able to use Java encoding names. If this feature is set to false,  
		 * an error will be generated if Java encoding names are used.   
		 */ 
		parserFactory.setFeature("http://apache.org/xml/features/allow-java-encodings",true);
 
		errorHandler = new DefaultErrorHandler();
		 
	} 
 
Experience pair programming with AI  Get Codota for Java