Я использую конфигурацию Apache Commons. Как я могу получить напрямую строку XMLConfiguration, не сохраняя ее в файл?
Большое спасибо.
Я нашел решение, это возможно через StringWriter:
XMLConfiguration config = new XMLConfiguration(); StringWriter stringWriter = new StringWriter(); config.save(stringWriter); System.out.println(stringWriter.toString());
org.apache.commons.configuration.ConfigurationUtils.toString ()
общедоступная статическая строка toString (конфигурация конфигурации) Get a string representation of the key/value mappings of a configuration. Parameters: configuration - the configuration Returns: a string representation of the configuration
общедоступная статическая строка toString (конфигурация конфигурации)
Get a string representation of the key/value mappings of a configuration. Parameters: configuration - the configuration Returns: a string representation of the configuration