Problem of SAXParser CNN RSS (copyright)
Problem: It cannot read special character (c) in copyright tag
Solution: use tagsoup instead
import org.ccil.cowan.tagsoup.Parser;
/*SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
RSSHandler myHandler = new RSSHandler(id);
xr.setContentHandler(myHandler);
xr.parse(new InputSource(url.openStream()));
rssfeed = myHandler.getrssfeed(0);
*/
XMLReader xr = new Parser();
RSSHandler myHandler = new RSSHandler(id);
xr.setContentHandler(myHandler);
xr.parse(new InputSource(url.openStream()));
rssfeed = myHandler.getrssfeed(0);
Problem: It cannot read special character (c) in copyright tag
Solution: use tagsoup instead
import org.ccil.cowan.tagsoup.Parser;
/*SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
RSSHandler myHandler = new RSSHandler(id);
xr.setContentHandler(myHandler);
xr.parse(new InputSource(url.openStream()));
rssfeed = myHandler.getrssfeed(0);
*/
XMLReader xr = new Parser();
RSSHandler myHandler = new RSSHandler(id);
xr.setContentHandler(myHandler);
xr.parse(new InputSource(url.openStream()));
rssfeed = myHandler.getrssfeed(0);
Comments