Code example for XMLReader

Methods: setFeature, setProperty

0
	 */ 
	private final SAXParser createParser(SAXParserFactory parserFactory) throws ParserConfigurationException, SAXException, SAXNotRecognizedException, SAXNotSupportedException {
		// Initialize the parser. 
		final SAXParser parser = parserFactory.newSAXParser();
		final XMLReader reader = parser.getXMLReader();
		reader.setProperty("http://xml.org/sax/properties/lexical-handler", this); //$NON-NLS-1$
		// disable DTD validation (bug 63625) 
		try { 
			//	be sure validation is "off" or the feature to ignore DTD's will not apply 
			reader.setFeature("http://xml.org/sax/features/validation", false); //$NON-NLS-1$
			reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); //$NON-NLS-1$
		} catch (final SAXNotRecognizedException e) {
			// not a big deal if the parser does not recognize the features 
		} catch (final SAXNotSupportedException e) {
			// not a big deal if the parser does not support the features 
		} 
		return parser;
	} 
 
	/* 
	 * (non-Javadoc)