android - XmlPullParser not reach end of document -


im working on simple android app, should fetch rss feeds, read , display information on screen. tried follow google example while implementing code (source: android developers).

my code looks that:

  public void fetchxml(string url, context context) {     try {         url urlobj = new url(url);         this.parser = this.xmlpullparserfactory.newpullparser();         inputstream stream = getinputstream(urlobj);         string string = this.extractstringfrominputstream(stream);         this.parser.setinput(new stringreader(string));          int eventtype = parser.geteventtype();          while (eventtype != xmlpullparser.end_document) {             log.i(tag, "value end_document: " + xmlpullparser.end_document + " - eventtype value: " + eventtype);             if (parser.geteventtype() != xmlpullparser.start_tag) {                 continue;             }             string name = parser.getname();              if (name.equals("title")) {                 title = readtitle(parser);             }              if (parser.geteventtype() and!= xmlpullparser.end_tag) {                 log.i(tag, "im in end tag");             }              eventtype = parser.next();     }      } catch (exception e) {         log.e(tag, "exception: ", e);     } } 

actually, prints me content of title xml-tag, never stops while-loop. value of eventtype 0. never go xmlpullparser.end_tag.

does knows wrong code?

i found problem myself. has been "continue" part. when delete it, worked.


Comments

Popular posts from this blog

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -