views:

557

answers:

1
  public static void parseit(String thexml){
         SAXParserFactory factory = SAXParserFactory.newInstance();
         SAXParser saxParser;

        try {
            saxParser = factory.newSAXParser();
            DefaultHandler handler = new DefaultHandler() {
                public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {


                }
                public void endElement(String uri, String localName, String qName)throws SAXException {

                }

                public void characters(char ch[], int start, int length) throws SAXException {

                }


             };      
            saxParser.parse(thexml, handler);
            } catch (SAXException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }catch (ParserConfigurationException e) {
                e.printStackTrace();    
            }
        }

This is my code for parsing an XML document. However, it always goes into IOException e, and I have no idea why. Can someone tell me how to view that error?

LogCat? How would I log that though?

+4  A: 

rather than e.printStackTrace(), use Log.e(....,....,e);

Then watch it using logcat.

Will