我想从这样的事情让输入流。
I am trying to get input stream from something like this.
InputSource myInputSource = new InputSource(activity.getResources().openRawResource(com.MYCLass.R.xml.programs));
myXMLReader.parse(myInputSource);
,然后调用解析的解析器实例我创建。一些如何,我什么也得不到。 如果我使用一台服务器的XML做工精细....
and then call parse on the parser instance i Created. Some how i get nothing. Works fine if I use a server XML....
把XML文件放到 / RES /原始文件夹
。它看起来像 openRawResource 只从该文件夹打开资源。您也可以尝试 getResources()的getXML(com.MYCLass.R.xml.programs);
这会回报你的XML解析器的一个实例
Put the xml file into /res/raw folder
. It looks like openRawResource opens resources from that folder only. You can also try getResources().getXml(com.MYCLass.R.xml.programs);
which will return you an instance of XML parser.
一块code从@Krupa采取
A piece of code taken from @Krupa
InputStream object = this.getResources()
.openRawResource(R.raw.fileName);