how to Parse a local XML file in android?

audreylemur

New Member
I'm working on an android project, and I can't parse a local file (raw/file.xml). I've tried few advices that I've found on internet but in vain.It works when i try parsing a file in net (using URL Class...) but when i try with a local file program doesn't work !!! Please I need Help .(I use Sax as XML Parser)I replace the line URL \[code\]sourceUrl = new URL ("example.com/w...";);\[/code\] with \[code\]InputSource is = new InputSource(getResources().openRawResource(R.raw.example));\[/code\] and the line \[code\]xr.parse(new InputSource(sourceUrl.openStream()));\[/code\] with \[code\]xr.parse(new InputSource(is.getByteStream()));\[/code\]
 
Back
Top