加载和修改Android的xml文件 [英] Load and modify xml file in Android

查看:119
本文介绍了加载和修改Android的xml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这将是要么我需要添加一些值来修改和资产或res文件夹,然后我需要将XML转换成字符串发送作为SOAP请求的一部分的XML文件。这将是实现这一目标的最简单的方法?

I have an xml file which will be in either assets or res folder which i need to modify by adding some values and then i need to convert the xml into a string to be sent as part of a soap request. What would be the easiest way to achieve this?

推荐答案

您不能修改的资源文件。

You can't modify resource files.

如果您不需要修改的资源,你可以把资产文件夹中的XML文件。然后,你可以通过 AssetManager 访问(通过收益getResources()。getAssets())。随着 AssetManager 即可获得的InputStream 从XML文件或使用 XMLResourceParser 。并用它做任何你想要的。

If you don't need modify resources, you can put the XML file in assets folder. Then you can access it by AssetManager (returns by getResources().getAssets()). With AssetManager you can get InputStream from XML file or use XMLResourceParser. And do with it whatever you want.

这篇关于加载和修改Android的xml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆