android - Load file from resource -
To summarize: To add a unit test to a SAX parser, I would like to load the XML from a file.
Now, I have a stratigraphic string inside my Unix test class, but this is not very convenient for large XML.
This is the reason why I would like to add some XML files to my project and load them in my unit test. How can I do this?
This question has been tagged as "Android" and I saw that you mentioned < Code> Activity , so I think you are trying to load an XML file inside an Android application. If this is the case, keep your XML file under / assets
and call:
InputStream = getAssets () From there, open ("input.xml")
from your activity
, you can manipulate it in SAXbuilder
. This will only work if you have set up your test to run the emulator (or if you are just trying to debug outside a unit test).
Comments
Post a Comment