如何加载由冒号分隔的多个属性

时间:2017-10-31 04:30:14

标签: java xml configuration xml-parsing configuration-files

abc.properties:

engine.xpath=messageHeader/messageId:1234, systemIdentifier/tradeId:4567, .....

我需要从属性中读取多个XPATH:要在XPATH上更改值。

1 个答案:

答案 0 :(得分:0)

获得以逗号分隔的属性后,请使用StringTokenizer

java.util.StringTokenizer st = new java.util.StringTokenizer(property, ":");
while (st.hasMoreTokens()) {
    System.out.println(st.nextToken());
}