Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Node; public class Main { public static Node stringToNode(final String confXmlString) { try { return DocumentBuilderFactory.newInstance().newDocumentBuilder() .parse(new ByteArrayInputStream(confXmlString.getBytes())).getFirstChild(); } catch (final Exception e) { throw new RuntimeException(e); } } }