从 sdcard 读取 .xml 文件 [英] Reading an .xml file from sdcard
问题描述
我有一个名为 bkup.xml 的 xml 文件存储在 sdcard "/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 作为资源.但是没有人给出给出sdcard文件路径的例子.
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.
提前致谢.
任何建议将不胜感激
推荐答案
Here
是带有源代码的完整示例.您只需使用
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");
然后做进一步的处理.
更新
如果您需要 不同
类型的 XML
Parsers
示例,您可以 download
complete
这里
的代码>示例.
If you need example for different
types of XML
Parsers
you can download
complete
example from here
.
这篇关于从 sdcard 读取 .xml 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!