TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
t.transform(new DOMSource(document), new StreamResult(bos));
String str = bos.toString();如果你用其他的xml解析器,还有更直接的方法
Transformer t = tf.newTransformer();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
t.transform(new DOMSource(document), new StreamResult(bos));
String str = bos.toString();如果你用其他的xml解析器,还有更直接的方法
3q !!!