I have an Application in which first I want to create a backup of message from inbox and store it into backup.xml
file which is stored at SDCARD/MYBACKUP/mybackup.xml
Now I want to retrieve data, stored on SDCARD/MYBACKUP/mybackup.xml
and display all messages in listview.
We must have followed the process to read an XML file in Java: Instantiate XML file: DOM parser loads the XML file into memory and consider every tag as an element. Get root node: Document class provides the getDocumentElement() method to get the root node and the element of the XML file.
XML files can be opened in a browser like IE or Chrome, with any text editor like Notepad or MS-Word. Even Excel can be used to open XML files. We also have Online editors to open XML files.
The XmlReader, XmlWriter and their derived classes contains methods and properties to read and write XML documents. With the help of the XmlDocument and XmlDataDocument classes, you can read entire document. The Load and Save method of XmlDocument loads a reader or a file and saves document respectively.
For Writing XML file to sdcard see this answeer Qberticus's Answer
android Reading file is just simple you have to use Xml parsing See This for XML parsing
To R/W Sdcard You have to give Permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With