我正在使用Apache Commons配置.如何在不将其保存到文件的情况下直接获取XMLConfiguration的字符串?
非常感谢你.
解决方法:
我找到了解决方案,可以通过StringWriter:
XMLConfiguration config = new XMLConfiguration();
StringWriter stringWriter = new StringWriter();
config.save(stringWriter);
System.out.println(stringWriter.toString());