I’m working in a little app that needs to parse an XML file. The “parsing part” it’s working great, everything goes fine…
But I’m having a little problem, I don’t know how to open the resource that is under (res/xml/file.xml) to the Xml.parse(STRING, root.getContentHandler()); or Xml.parse (INPUTSTREAM…)…
The question is that I don’t know how to get an InpuntStream or String from a xml file that is in the res folder… any idea?? I’ve googled it but all the examples in the web are from a web xml that is downloaded using http, but none of them show how to parse a file from the resources!!
Thanks in advance!!
Try putting your XML file in
res/rawinstead ofres/xml. Then:will return an
InputStreamyou can use withXml.parse().