I'm stuck trying to figure out why my Android SAX parser doesn't like chacters like © and Ñ
I can have several parse routines that parse either the results of an http call that grabs an xml file sitting on my server or the results of a webserver that produces xml. For the case of the xml file everything is cool.
However, my webserver which returns a homecooked atom feed causes my app to get an exception:
org.apache.harmony.xml.ExpatParser$ParseException: At line 73, column 27: not well-formed (invalid token)
try {
Xml.parse(this.getInputStream(), Xml.Encoding.UTF_8,
root.getContentHandler());
}
catch(SAXException se){
hits this-> throw new RuntimeException(se);
}
catch (Exception e) {
throw new RuntimeException(e);
}
Note the UTF_8 thing.
My xml file looks like this, and the string causing the problem is año:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>News</title>
<id>SUCCESS</id>
<generator>News</generator>
<updated>2013-12-04T04:40:59Z</updated>
<language xmlns="">SPANISH</language>
<entry>
<title>Disfrutando el año de Gracias con la familia</title>
<link rel="alternate" type="text/html" href="http:/www.the.com/zocalo/news/1/810b28c1-289b-41d7-b4bb-148b0f52a83a/news_sp.xml" />
<link rel="enclosure" type="image/jpg" href="http://www.the.com.net/zocalo/news/1/810b28c1-289b-41d7-b4bb-148b0f52a83a/img1.png" />
<link rel="enclosure" type="image/jpg" />
etc
</entry>
</feed>
Any ideas what I should be checking for? Any help would be very appreciated. Thanks!!
Use
©
in place of©
andÑ
in place ofÑ
And your xml will be valid.