歌尔基办 v2.7.0版本的 MD5 值为:921fd7c85ec097e8cab7f049269b36e4
以下内容为反编译后的 XmlLog.java 源代码,内容仅作参考
package com.socks.library.klog;
import android.util.Log;
import com.socks.library.KLog;
import com.socks.library.Util;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
public class XmlLog {
public static void printXml(String str, String str2, String str3) {
String[] split;
String str4 = str2 != null ? str3 + "\n" + formatXML(str2) : str3 + KLog.NULL_TIPS;
Util.printLine(str, true);
for (String str5 : str4.split(KLog.LINE_SEPARATOR)) {
if (!Util.isEmpty(str5)) {
Log.d(str, "║ " + str5);
}
}
Util.printLine(str, false);
}
public static String formatXML(String str) {
try {
StreamSource streamSource = new StreamSource(new StringReader(str));
StreamResult streamResult = new StreamResult(new StringWriter());
Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
newTransformer.setOutputProperty("indent", "yes");
newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
newTransformer.transform(streamSource, streamResult);
return streamResult.getWriter().toString().replaceFirst(">", ">\n");
} catch (Exception e) {
e.printStackTrace();
return str;
}
}
}