File testfile=new
File(Environment.getExternalStorageDirectory(),"rawxml.xml");
try {
FileOutputStream fos=new FileOutputStream(testfile,false);
XmlSerializer serializer = Xml.newSerializer();
serializer.setOutput(fos, "utf-8");
serializer.startDocument("UTF-8",null);
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output",true);
//write start tag <hello>
serializer.startTag("","hello");
// value
serializer.text("shaikhriyaz");
//write end tag </hello>
serializer.endTag("","hello");
serializer.endDocument();
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
great work
ReplyDelete