• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps have error with saxParser on android(not well-formed (invalid token))

vitaly87

Lurker
I am trying to get xml file from url link . This code for android. I am using SAXParser for doing it. but I have error:
Code:
  org.apache.harmony.xml.ExpatParser$ParseException: At line 1, column 87: not well-formed (invalid token)
on this line
Code:
   saxParser.parse(url.openStream(),handler);
my code is:
Code:
  URL url = null;

try {
    url = new URL("http://www.ynet.co.il/Integration/StoryRss1854.xml");
} catch (MalformedURLException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = null;
try {
    saxParser = factory.newSAXParser();
    saxParser.parse(url.openStream(),handler);
What can be done?
And I dont have & on my xml.
thanks a lot
 
do you have control over the XML?

It looks like it's encoded as Windows 1255, I'd suggest changing it to UTF-8.

It looks like it is failing on the first Hebrew character there (col 87)

Alternatively you could use the DOM parser -- it's MUCH easier to code for and understand. and for short XML like you have there, the performance gain for SAX will be tiny.

hth
 
Back
Top Bottom