朴勇佑的专栏

共享知识

Document转String


import javax.xml.transform.Result;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

private static void myDebug(Document doc){
	try{
		DOMSource source = new DOMSource(doc);
		StringWriter writer = new StringWriter();
		Result result = new StreamResult(writer);
		Transformer transformer = TransformerFactory.newInstance().newTransformer();
		transformer.transform(source, result);
		Log.i("TAG","response:"+ writer.getBuffer().toString());
	}catch(Exception e){
	}

}



阅读更多
上一篇粗体 style
下一篇scroll指定位置
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭