Org.xmlpull.v1.XmlPullParserException:Unexpected token (position:unknown @5:1 in java.io.inputstreamreader@ 3FE1C1A2)
The problem is this, get an XML stream from the server, and then the Android client resolves it, but always package this error.
Pull parser parses XML input stream private Boolean parsexml (InputStream iStream) throws Xmlpullparserexception, I
oexception {//TODO auto-generated method Stub news = null;
Parsing Xmlpullparser parser = Xml.newpullparser () with pull parser;
Parser.setinput (IStream, "utf-8");
int event = Parser.geteventtype (); while (event!= xmlpullparser.end_document) {switch (event) {case Xmlpullparser. Start_document:if (Newes = = null) {throw new Illegalargumentexceptio
N ("Newes parameter cannot be null");
} log.i (Tag_service, "Start parsing xml file");
Break
Case XMLPULLPARSER.START_TAG:LOG.I (Tag_service, "encounter starting Tag" + parser.getname ());
if ("News1". Equals (Parser.getname ()) { String id = parser.getattributetype (0);
News = new News ();
News.setid (integer.valueof (id)); } if ("Title1". Equals (Parser.getname ())) {News.settitle (Parser.nextte
XT ()); } if ("Age1". Equals (Parser.getname ())) {News.setage (integer.valueof p
Arser.nexttext ()));
} break;
Case XMLPULLPARSER.END_TAG:LOG.I (Tag_service, "Encounter end Tag" + parser.getname ());
if ("News1". Equals (Parser.getname ())) {Newes.add (news);
News = null;
} break;
Default:break; event = Parser.next();
return true; }