I am using Apache Commons configuration. How can I get the XMLConfiguration line directly without saving it to a file?
Many thanks.
I found a solution, this is possible through StringWriter:
XMLConfiguration config = new XMLConfiguration(); StringWriter stringWriter = new StringWriter(); config.save(stringWriter); System.out.println(stringWriter.toString());
org.apache.commons.configuration.ConfigurationUtils.toString ()
public static String toString (Configuration Configuration)Get a string representation of the key/value mappings of a configuration. Parameters: configuration - the configuration Returns: a string representation of the configuration
public static String toString (Configuration Configuration)
Get a string representation of the key/value mappings of a configuration. Parameters: configuration - the configuration Returns: a string representation of the configuration