Code example for StringReader

Methods: close

0
	 
	// Get results in the form of a DOM to be parsed 
	public static Document getDOMbody(String response) {
		Document doc = null;
		try { 
			StringReader reader = new StringReader (response);
			InputSource inputSource = new InputSource( reader );
			DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
		    DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
		    doc = dBuilder.parse(inputSource);
		    reader.close();
		} catch (Exception e) {
			Log.v("PARSE ERROR", e.getMessage());
		} 
	     
		return doc;
	} 
	 
	// Parse the HTTP response 
	public static String parseHttpResponse(HttpResponse response) {
		// Parse the xml input resulting from a refresh post