Code example for InputSource

Methods: setCharacterStream

0
		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
		try { 
 
			DocumentBuilder db = dbf.newDocumentBuilder();
 
			InputSource is = new InputSource();
			is.setCharacterStream(new StringReader(xml));
			doc = db.parse(is);
 
		} catch (ParserConfigurationException e) {
			Log.e("Error: ", e.getMessage());
			return null; 
		} catch (SAXException e) {
			Log.e("Error: ", e.getMessage());
			return null; 
		} catch (IOException e) {
			Log.e("Error: ", e.getMessage());
			return null; 
		} 
		// return DOM 
		return doc;