「Java」Documentオブジェクトを文字列Stringに変換するコード

Javaコード
public static String toXMFuncL(Document xmlDoc, String encoding) throws IOException
{
ByteArrayOutputStream byteRs = new ByteArrayOutputStream();
PrintWriter out=new PrintWriter(byteRs);
Format format = Format.getPrettyFormat();
format.setEncoding(encoding);
XMLOutputter docWriter = new XMLOutputter(format);
try {
docWriter.output(xmlDoc, out);
} catch (Exception e) {
}
return byteRs.toString();
}

Java

Posted by arkgame