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?
A:
You can't modify resource files.
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.
Sergey Glotov
2010-09-16 08:45:22
I put it in the assets folder and used an input stream reader to read the file all into one string. I then replaced placeholders in the file with the values from the user input. Seems to work fine
Ricardo
2010-09-21 01:10:30