i am new developer in android application.i would like to write the data into xml file.i mean i would like to change the content like elements,tags,data in xml file.i can able to read an xml file in that file, i would like to change or modify and save that xml file.
i have written sample application to read xml as follows
FileInputStream fstream = new FileInputStream("/sdcard/book.xml");
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// Print the content on the console
System.out.println ("Xml file content====>"+strLine);
data1.append(strLine);
data1.append('\n');
System.out.println("--------->"+data1.append(strLine)+"\n");
i have written this code in a method here book.xml is my xml file to change
when i call this method then i am getting out put with tags in logcat as follows
06-14 12:48:32.309: VERBOSE/(433): #######>>>>><?xml version="1.0" encoding="utf-8"?>
06-14 12:48:32.309: VERBOSE/(433): <Employee-Detail>
06-14 12:48:32.309: VERBOSE/(433): <Employee>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Id>E-001</Emp_Id>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Name>Vinod</Emp_Name>
06-14 12:48:32.309: VERBOSE/(433): <Emp_E-mail>[email protected]</Emp_E-mail>
06-14 12:48:32.309: VERBOSE/(433): </Employee>
06-14 12:48:32.309: VERBOSE/(433): <Employee>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Id>E-002</Emp_Id>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Name>Amit</Emp_Name>
06-14 12:48:32.309: VERBOSE/(433): <Emp_E-mail>[email protected]</Emp_E-mail>
06-14 12:48:32.309: VERBOSE/(433): </Employee>
06-14 12:48:32.309: VERBOSE/(433): <Employee>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Id>E-003</Emp_Id>
06-14 12:48:32.309: VERBOSE/(433): <Emp_Name>Deepak</Emp_Name>
06-14 12:48:32.309: VERBOSE/(433): <Emp_E-mail>[email protected]</Emp_E-mail>
06-14 12:48:32.309: VERBOSE/(433): </Employee>
06-14 12:48:32.309: VERBOSE/(433): </Employee-Detail>
how can write or edit or modify the above xml as prophetically?
please any body can help
thanks in advance.