org.apache.commons.configuration
public class XMLPropertiesConfiguration extends PropertiesConfiguration
<?xml version="1.0"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <comment>Description of the property list</comment> <entry key="key1">value1</entry> <entry key="key2">value2</entry> <entry key="key3">value3</entry> </properties>The Java 5.0 runtime is not required to use this class. The default encoding for this configuration format is UTF-8. Note that unlike
PropertiesConfiguration
, XMLPropertiesConfiguration
does not support includes.
Since: 1.1
Version: $Revision: 439648 $, $Date: 2006-09-02 22:42:10 +0200 (Sa, 02 Sep 2006) $
Nested Class Summary | |
---|---|
class | XMLPropertiesConfiguration.XMLPropertiesHandler
SAX Handler to parse a XML properties file.
|
Field Summary | |
---|---|
static String | DEFAULT_ENCODING
The default encoding (UTF-8 as specified by http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html) |
Constructor Summary | |
---|---|
XMLPropertiesConfiguration()
Creates an empty XMLPropertyConfiguration object which can be
used to synthesize a new Properties file by adding values and
then saving(). | |
XMLPropertiesConfiguration(String fileName)
Creates and loads the xml properties from the specified file.
| |
XMLPropertiesConfiguration(File file)
Creates and loads the xml properties from the specified file.
| |
XMLPropertiesConfiguration(URL url)
Creates and loads the xml properties from the specified URL.
|
Method Summary | |
---|---|
void | load(Reader in) |
void | save(Writer out) |
void | writeProperty(PrintWriter out, String key, Object value)
Write a property.
|
void | writeProperty(PrintWriter out, String key, List values)
Write a list property.
|
Parameters: fileName The name of the properties file to load.
Throws: ConfigurationException Error while loading the properties file
Parameters: file The properties file to load.
Throws: ConfigurationException Error while loading the properties file
Parameters: url The location of the properties file to load.
Throws: ConfigurationException Error while loading the properties file
Parameters: out the output stream key the key of the property value the value of the property
Parameters: out the output stream key the key of the property values a list with all property values