Here you can find the source of bytesToXml(final byte[] body)
public static Node bytesToXml(final byte[] body) throws TransformerException
//package com.java2s; //License from project: Open Source License import java.io.ByteArrayInputStream; import javax.xml.transform.Source; 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 { private static final TransformerFactory FACTORY = TransformerFactory.newInstance(); public static Node bytesToXml(final byte[] body) throws TransformerException { final Transformer transformer = FACTORY.newTransformer(); final Source source = new StreamSource(new ByteArrayInputStream(body)); final DOMResult result = new DOMResult(); transformer.transform(source, result); return result.getNode(); }//ww w . jav a2s . com }