1

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 after a few items have been parsed:

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?

[EDIT: If this is set: parser.setProperty(XmlPullParser.FEATURE_VALIDATION,true); parsing fails immediately] Thanks.

2
  • Is Pull the only parser you will consider using? Commented May 23, 2010 at 23:03
  • I am doing this on Mobile so I prefer not to use DOM. Commented Jun 1, 2010 at 9:06

1 Answer 1

3

I posted an answer to this in your other post: http://www.coderanch.com/t/495391/XML/Parsing-RSS-feeds-XML-Pull#2230731

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.