0

abc.properties:

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

I need to read multiple XPATHs from properties: value to be changed at that XPATH.

Dinidu Hewage
  • 2,169
  • 6
  • 40
  • 51
Aditya
  • 1
  • @aldok: Earlier I was reading individual XPATHs and individual VALUES, so it was easy. Now in need to read multiple dependent properties... Can we use HashMap? And save ? And then later iterate it and change value? – Aditya Oct 31 '17 at 04:53
  • https://stackoverflow.com/questions/226050/how-do-i-specify-values-in-a-properties-file-so-they-can-be-retrieved-using-reso you have the answer here – Shree Naath Oct 31 '17 at 05:06
  • @Shree Nath: Not exactly... I am aware and have used String[ ] to load multiple properties separated by comma, but here, every comma further has two dependent properties seperated by colon which needs to be mapped. – Aditya Oct 31 '17 at 05:18

1 Answers1

0

Once you get the comma-separated properties, use StringTokenizer:

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