I am reading a xml file from the SD card. Here I want to change the values of the XML file and I want to save the file to the sd card..
My code is like below.... Please guide me how to save XML file to the sd card after updating the values..
public void modifyNodeval(){
try{
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File("/sdcard/sss.xml"));
//Get the staff element by tag name directly
Node nodes = doc.getElementsByTagName("Employee").item(0);
//loop the staff child node
NodeList list = nodes.getChildNodes();
for (int i =0; i<list.getLength();i++){
Node node = list.item(i);
//get the salary element, and update the value
if("Emp_Name".equals(node.getNodeName())){
node.setNodeValue("795796");
}
}