I was stuck with this for about an hour before finding out that in my case it was "&". which cannot be resolved by XML PULL PARSER, so I found a solution. So, here is a piece of code that completely fixes it.
void ParsingActivity(String r) { try { parserCreator = XmlPullParserFactory.newInstance(); parser = parserCreator.newPullParser(); // Here we give our file object in the form of a stream to the // parser. parser.setInput(new StringReader(r.replaceAll("&", "&"))); // as a SAX parser this will raise events/callback as and when it // comes to a element. int parserEvent = parser.getEventType(); // we go thru a loop of all elements in the xml till we have // reached END of document. while (parserEvent != XmlPullParser.END_DOCUMENT) { switch (parserEvent) { // if u have reached start of a tag case XmlPullParser.START_TAG: // get the name of the tag String tag = parser.getName();
To a large extent, what I am doing is simply replacing & with & since I was dealing with URL parsing. Hope this helps.
Mr mido
source share