Code example for XMLReader

Methods: parse, setContentHandler, setProperty

0
	//        factory.setFeature("http://apache.org/xml/features/validation/dynamic", true); 
	        InputSource src = new InputSource(new StringReader(input));
	        SAXParser parser = factory.newSAXParser();
	        XMLReader reader = parser.getXMLReader();
	        SAXAdapter adapter = new SAXAdapter();
	        reader.setContentHandler(adapter);
	        reader.setProperty("http://xml.org/sax/properties/lexical-handler", adapter);
	        reader.parse(src);
	         
	        return (DocumentImpl) adapter.getDocument();
	         
    	} catch (Exception e) {
    		fail(e.getMessage()); 
    	} 
    	return null; 
    } 
}