Code example for CharArrayReader

			DocumentBuilderFactory factory = DocumentBuilderFactory
			// Use document builder factory 
			DocumentBuilder builder = factory.newDocumentBuilder();
			// Parse the document 
			Reader reader = new CharArrayReader(xml.toCharArray());
			Document doc = builder.parse(new org.xml.sax.InputSource(reader));
			return doc;
		} catch (Exception e) {
			logger.error("An error occured while creating document ** ", e);
			throw new Exception(e.getMessage());
Stop searching for code, let great code find you!  Add Codota to your java IDE