Hi,

I'm unable to consume a WS with the SAX, for some reason my
implementation doesn't read the complete XML feed, it reads it up to a
random point. Has anyone faced anything similiar? Here's what I'm
doing:

After calling a RESTful WS a read the response from the server as
follows:

if (isSessionActive){
  HttpEntity entity = response.getEntity();
  SAXParserFactory spFactory = SAXParserFactory.newInstance();
  SAXParser saxParser = spFactory.newSAXParser();
  XMLReader xmlReader = saxParser.getXMLReader();
  eventsHandler = new EventsHandler();
  xmlReader.setContentHandler(eventsHandler);
  xmlReader.parse(new InputSource(entity.getContent()));
}

Where my EventsHandler.java is as follows:

public class EventsHandler extends DefaultHandler {
        @Override
        public void startDocument() throws SAXException {
        }
        @Override
        public void endDocument() throws SAXException {
        }
        @Override
        public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
                Log.i(this.toString(), "<" + localName + ">");
        }
        @Override
        public void endElement(String namespaceURI, String localName, String
qName) throws SAXException{
                Log.i(this.toString(), "</" + localName + ">");
        }
        @Override
        public void characters(char ch[], int start, int length){
        }
}

Hope to get some feedback! Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to