Parsing RSS2.0 feeds using Pull Parser on Android

Posted by Samuh on Stack Overflow See other posts from Stack Overflow or by Samuh
Published on 2010-05-13T07:20:14Z Indexed on 2010/05/13 7:24 UTC
Read the original article Hit count: 936

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.

© Stack Overflow or respective owner

Related posts about xmlpullparser

Related posts about rss