Unexpected token while parsing Facebook RSS

171 Views Asked by At

I'm trying to parse the facebook RSS but none of them seems to work. Every method I've tried so far result in a different exception. I changed the format to format=atom10. I ended up with below code

void loadRSS3()
        {
            string url = "https://www.facebook.com/feeds/notifications.php?id=XXXX&viewer=XXXX&key=XXXX&format=atom10";

            var req = (HttpWebRequest)WebRequest.Create(url);
            req.Method = "GET";
            req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0)";
            var rep = req.GetResponse();
            XmlReaderSettings settings = new XmlReaderSettings();
            settings.XmlResolver = null;
            settings.DtdProcessing = DtdProcessing.Parse;

            var reader = XmlReader.Create(rep.GetResponseStream(), settings);

            SyndicationFeed feed = SyndicationFeed.Load(reader);
        }

it give error:

'= ' is an unexpected token. The expected token is ';'. Line 11, position 171.

How do I make it working?

1

There are 1 best solutions below

0
On BEST ANSWER

For anyone with same issue, I couldn't solve it using SyndicationFeed.Load() but with XDocument.Parse(xmlString) instead of.