Unable to parse file in SD Card with SAX Parser

fesa

New Member
hope you're all well. I'm trying to parse an XML located in my SD card but for some reason I can't get my parser to parse the XML file. I think it has to do with the way I'm transforming my original file into a readable object for the parser.I've searched and searched but can't figure out what I'm doing wrong - nothing seems to work.I can process the exact same file with pullparser (I'm trying to get a handle on all 3 XML parsing methods right now)I'm including the basic code relating to the parsing; if you think the error's not there I can post more or answer queries:\[code\]super.onCreate(savedInstanceState); setContentView(R.layout.main); path = Environment.getExternalStorageDirectory() + File.separator + "MartyWeight" + File.separator + "martyweight.xml"; yourFile = new File (path);try{ SAXParserFactory saxPF = SAXParserFactory.newInstance(); SAXParser saxP = saxPF.newSAXParser(); InputStream inputStream = new FileInputStream(yourFile); Reader xmlReader = new InputStreamReader(inputStream, "UTF-8"); InputSource xmlSource = new InputSource(xmlReader); xmlSource.setEncoding("UTF-8"); XMLHandler myXMLHandler = new XMLHandler(); saxP.parse(xmlSource, myXMLHandler); }catch (Exception e){ System.out.println(e); }\[/code\]I know a lot of questions have been asked about parsing and SD cards - but I promise I have been thorough in my research and still not found a solution. Very frustrating!
 
Back
Top