Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
324 views
in Technique[技术] by (71.8m points)

android - Reading an .xml file from sdcard

I have one xml file called bkup.xml stored inside sdcard "/sdcard/bkup.xml".

For creating bkup.xml I have used xmlSerialization.

I want to retrieve data from that bkup.xml file.

I have seen many examples but almost most of them are using resource file and using URL as a resource. But no one have example of giving a path of sdcard file.

I don't know how to fetch data from that file and parse it.

Thanks in advance.

Any suggestion will be appreciated

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is an complete example with source. You just to get the File using

 File file = new File(Environment.getExternalStorageDirectory()
                    + "your_path/your_xml.xml");

Then do the further processing.

UPDATE

If you need example for different types of XML Parsers you can download complete example from here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...