Code example for XMLReader

Methods: parsesetContentHandler

0
 
			/* Get the XMLReader of the SAXParser we created. */ 
			XMLReader xr = sp.getXMLReader();
			/* Create a new ContentHandler and apply it to the XML-Reader */ 
 
			xr.setContentHandler(responsesHandler);
 
			ByteArrayInputStream tobeparsed = new ByteArrayInputStream(
					responseAsXML.getBytes("UTF-8"));
 
			InputSource is = new InputSource(tobeparsed);
			is.setEncoding("UTF-8");
			xr.parse(is);
 
			/* Parsing has finished. */ 
 
		} catch (FactoryConfigurationError e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();
		} catch (ParserConfigurationException e) {
			// TODO Auto-generated catch block