读书人

应用common-configuration读取xml,pro

发布时间: 2012-08-01 17:53:41 作者: rapoo

使用common-configuration读取xml,properties文件

?

转帖出处:http://blog.csdn.net/pengchua/archive/2007/12/21/1957069.aspx

http://commons.apache.org/configuration/apidocs/index.html?
Commons Configuration provides a generic configuration interface which enables a Java application to

read configuration data from a variety of sources.

PropertiesConfiguration Loads configuration values from a properties file.?
XMLConfiguration Takes values from an XML document.?
INIConfiguration Loads the values from a .ini file as used by Windows.?
PropertyListConfiguration Loads values from an OpenStep .plist file. XMLPropertyListConfiguration is

also available to read the XML variant used by Mac OS X.?
JNDIConfiguration Using a key in the JNDI tree, can retrieve values as configuration properties.?
BaseConfiguration An in-memory method of populating a Configuration object.?
HierarchicalConfiguration An in-memory Configuration object that is able to deal with complex

structured data.?
SystemConfiguration A configuration using the system properties?
ConfigurationConverter Takes a java.util.Properties or an

org.apache.commons.collections.ExtendedProperties and converts it to a Configuration object.


1.读取XML文件中内容

?

<configuration>
? <properties fileName="usergui.properties"/>
</configuration>
ConfigurationFactory的定义文件是一个普通的xml文件.根元素是configuration.他饱含的子元素制定了需要装载

的配置资源.properties是元素之一,他用来包含属性文件

?

?

}??

?

?

读书人网 >XML SOAP

热点推荐