Parsing RSS2.0 feeds using Pull Parser on Android
- by Samuh
I am trying to parse a RSS2.0 feed, obtained from a remote server, on my Android device using XML Pull Parser.
// get a parser instance and set input,encoding
XmlPullParser parser = Xml.newPullParser();
parser.setInput(getInputStream(), null);
I am getting invalid token exceptions:
Error parsing document. (position:line
-1, column -1) caused by: org.apache.harmony.xml.ExpatParser$ParseException:
At line 158, column 25: not
well-formed (invalid token)
Strangely, when I download the feed XML on the device, bundle it inside the raw folder and then run the same code. Everything works fine.
What could be the problem here? How do I validate the XML before I parse it on device?
Thanks.