I am writing a java code to update xml file elements . I need to know how to write the changes to the xml file.I used the setNodevalue() method but the change isn't reflecting in the xml file.I am parsing the xml file using sax parser.I am comparing an arraylist containing the tags that need to be updated with the elements of the xml file .In case of a match i need to update the xml file elements with values in a 2nd arraylisy(the index of the tags and its value are same in both arraylist).The xml file is not updated because the setnodevalue() in my code is updating the arraylist instead i should write the changes to the xml file.
Kindly share your suggestions and help me.
The following is a rough code that i have written,if it works i can use the functionality as part of an application that i am developing
System.out.println(" current xml node value:"+ ((Node) fstNm.item(0)).getNodeValue());
// the following line is updating the node but not the required xml file element
System.out.println(" updated xml node value:"+ ((Node) fstNm.item(0)).getNodeValue());
// need to proceed from here to update the xml