假设有个 test.xml,包含以下字段:
<config>
<property name="login_protocol" value="http" />
<property name="access_control" value="10"/>
<property name="receipt_route_kbn" value="smartphone_site"/>
<property name="fee_kbn" value="i_mode"/>
<property name="debug" value="true"/>
<property name="iplist_cache_interval" value="1800" />
</config>
在java文件中,获取 login_protocol 对应的 value:
... String login_protocal = ""; Config test = Config.getInstance("test.xml"); login_protocal = test.getProperty("login_protocal"); ...