I'm trying to replace
<photo>dummy.jpg</photo>
with this
<photo>NewImage_2012-03-22:15.00.00.jpg</photo>
the code looks like this
Element nameElement = (Element) fstNode;
NodeList nameElemList = nameElement.getElementsByTagName("photo");
Element firstElement = (Element) nameElemList.item(0);
NodeList fstNm = firstElement.getChildNodes();
Text newData = doc.createTextNode("NewImage_2012-03-22:15.00.00.jpg");
firstElement.replaceChild(newData, fstNm.item(0));
System.out.println("Data : " +
firstElement.getChildNodes().item(0).getNodeValue());
in the output it prints the new photo name, but it doesn't replace the data in the xml file. What am i missing?
Thanks.