CDATA exception while parsing an RSS feed
843834Dec 2 2008 — edited Dec 3 2008Hi All,
I developed a Rss feed reader.
The feed reader accepts all the feed xml and parses it and adds to the database and displays the content when clicked on url.
The Feed reader accepts all the feeds but when trying to add the following url,it gives a CDATA error
http://profit.ndtv.com/RSS/SectionRssfeed.aspx?Id=22&Main=15
The following is the error:
org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683)
at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208)
at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:580)
at controls.java.RssReaderCTLImpl.getFeedData(RssReaderCTLImpl.java:55)
at controls.java.RssReaderCTLBean.getFeedData(RssReaderCTLBean.java:123)
at pageflows.rssreader.RssReaderController.doInsert(RssReaderController.java:126)
The following is my code:
public String getFeedData(String url) {
try {
//XmlObject xml = XmlObject.Factory.parse(new java.io.File("C:\\Documents and Settings\\rajaguru.s\\Desktop\\sampleXML\\RSS 1.0.xml"));
String urlTitle=java.net.URLDecoder.decode(url,"utf-8");
URL theUrl = new URL(urlTitle);
XmlObject xml = XmlObject.Factory.parse(getUrlContent(theUrl));
please help me out.
thanks in advance
shalu