inserting values in XPATH while looping around a HAshMap
Hi,
I have a method called setValueOfXPath in my class XMLUtils that is a generic function for XPATH on setting Attributes, it looks like:
publicstatic String setValueOfXPath(String xml, String xPath, String attribute, String value){
basically you can change the attribute value of a certain element by using this function.
Anyway, I have a HashMap that has key-values pairs that I must loop around and get into my XML, I'm trying the code below, but it isn't working - has anyone any ideas?
Set entries = endorsementMap.entrySet();
Iterator iterator = entries.iterator();
int value = 0;
while (iterator.hasNext()){
System.err.println("looping.......");
Map.Entry entry = (Map.Entry)iterator.next();
value = Integer.parseInt(entry.getValue().toString());
response = XMLUtils.setValueOfXPath(response,"//Endorsement[" + value +"]","Info", entry.getKey().toString());
}
it just fails to even execute the response line.

