I'm using the Apache Commons Configuration. How can I get directly a String of the XMLConfiguration without saving it to a file?

Thank you very much.

Accepted Answer

I've found the solution, it is possible via the StringWriter:

XMLConfiguration config = new XMLConfiguration();
StringWriter stringWriter = new StringWriter();
config.save(stringWriter);
System.out.println(stringWriter.toString());
Written by Thomas
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki