从读取SD卡的.xml文件文件、SD、xml

2023-09-05 23:11:04 作者:为你伤心。不值得

我有存储在名为bkup.xml一个XML文件中的内部SD卡/sdcard/bkup.xml。

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

有关创建bkup.xml我已经使用xmlSerialization。

For creating bkup.xml I have used xmlSerialization.

我想从bkup.xml文件中检索数据。

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

我看过很多例子,但几乎大部分都是使用资源文件,并使用URL作为一种资源。但是,没有人有例如给予SD卡文件的路径。

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.

在此先感谢。

任何建议将AP preciated

Any suggestion will be appreciated

推荐答案

这里 是一个完整的例子有来源。你只拿到了文件

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

然后做进一步的处理。

Then do the further processing.

更新

如果您需要榜样不同的类型 XML 的解析器可以从的 此处

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