如何更改变量或表达式视图中的字符串表示对象?
问问题
230 次
1 回答
2
Eclipse 对此有特殊功能,即调用Detail Formatter
对于org.w3c.dom.Node接口需要添加以下代码:
if (this == null) return null;
javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(javax.xml.transform.OutputKeys.METHOD, "xml");
transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3");
javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(this);
if (source == null) return "Corrupted XML document: " + this.toString();
java.io.StringWriter os = new java.io.StringWriter();
javax.xml.transform.stream.StreamResult result = new javax.xml.transform.stream.StreamResult(os);
transformer.transform(source,result);
return os.toString ();
于 2012-09-28T16:38:24.000 回答