Here you can find the source of stringToNode(String s)
public static Node stringToNode(String s)
//package com.java2s; /*/*from w w w . j a va 2s . c om*/ * (c) 2005-2009 Carlos G?mez Rodr?guez, todos los derechos reservados / all rights reserved. * Licencia en license/bsd.txt / License in license/bsd.txt */ import java.io.StringReader; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.stream.StreamSource; import org.w3c.dom.Node; public class Main { public static Node stringToNode(String s) { StreamSource ss = new StreamSource(new StringReader(s)); DOMResult dr = new DOMResult(); try { Transformer t = TransformerFactory.newInstance().newTransformer(); t.transform(ss, dr); } catch (TransformerException te) { te.printStackTrace(); return null; } return dr.getNode().getFirstChild(); } }