Java tutorial
//package com.java2s; import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; public class Main { public static Document readXmlFromString(String data) throws Exception { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.parse(new org.xml.sax.InputSource(new StringReader(data))); return document; } }