Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9175191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:52:25+00:00 2026-06-17T16:52:25+00:00

I am currently developing a windows 8 metro application using C# and XAML. I

  • 0

I am currently developing a windows 8 metro application using C# and XAML. I am reading RSS feeds from several sources using the Syndication method and it is working perfectly but the RSS from FACEBOOK is not actually and is crashing with the error “INVALID XML”. Does reading it as XmlDocument work? How to do it?

Below is my code:

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
using Windows.Data.Xml.Dom;
using Windows.Web.Syndication;



namespace App1
{

public class FeedData
{
    public string title { get; set; }
    public string description { get; set; }
    public DateTime pubDate { get; set; }

    private List<FeedItem> _Items = new List<FeedItem>();
    public List<FeedItem> Items
    {
        get
        {
            return this._Items;
        }
    }
}

// FeedItem 
// Holds info for a single blog post 
public class FeedItem
{
    public string title { get; set; }
    public string description { get; set; }
    public DateTime pubDate { get; set; }
    public Uri link { get; set; }
}

// FeedDataSource 
// Holds a collection of blog feeds (FeedData), and contains methods needed to 
// retreive the feeds. 
public class FeedDataSource
{
    private ObservableCollection<FeedData> _Feeds = new ObservableCollection<FeedData>();
    public ObservableCollection<FeedData> Feeds
    {
        get
        {
            return this._Feeds;
        }
    }



    public async Task GetFeedsAsync(Int32 ID)
    {
        if (ID == 1003)
        {
            Task<FeedData> feed1 =
            GetFeedAsync("http://outbound.indevcogroup.com/feeds/posts/default/-/INDEVCO%20Group");
            this.Feeds.Add(await feed1);
        }
        else if (ID == 1002)
        {
            Task<FeedData> feed12 =
          GetFeedAsync("http://www.facebook.com/feeds/page.php?format=rss20&id=126332847400326");
            this.Feeds.Add(await feed12);
        }
    }


    private async Task<FeedData> GetFeedAsync(string feedUriString)
    {
        // using Windows.Web.Syndication; 
        SyndicationClient client = new SyndicationClient();
        Uri feedUri = new Uri(feedUriString);

        try
        {

            SyndicationFeed feed = await client.RetrieveFeedAsync(feedUri);

            // This code is executed after RetrieveFeedAsync returns the SyndicationFeed. 
            // Process it and copy the data we want into our FeedData and FeedItem classes. 
            FeedData feedData = new FeedData();

            feedData.title = feed.Title.Text;
            if (feed.Subtitle != null && feed.Subtitle.Text != null)
            {
                feedData.description = feed.Subtitle.Text;
            }
            // Use the date of the latest post as the last updated date. 
            feedData.pubDate = feed.Items[0].PublishedDate.DateTime;

            foreach (SyndicationItem item in feed.Items)
            {
                FeedItem feedItem = new FeedItem();
                feedItem.title = item.Title.Text;
                feedItem.pubDate = item.PublishedDate.DateTime;
                // Handle the differences between RSS and Atom feeds. 
                if (feed.SourceFormat == SyndicationFormat.Atom10)
                {
                    feedItem.description = item.Content.Text;
                    feedItem.link = new Uri("http://www.scoop.it/t/agricultural-horticultural-                        news" + item.Source);
                }
                else if (feed.SourceFormat == SyndicationFormat.Rss20)
                {
                    feedItem.description = item.Summary.Text;
                    feedItem.link = item.Links[0].Uri;
                }
                feedData.Items.Add(feedItem);
            }
            return feedData;
        }
        catch (Exception)
        {
            return null;
        }
    }
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:52:26+00:00Added an answer on June 17, 2026 at 4:52 pm

    Like this:

    // this example pulls coca-cola's posts
    var _Uri = new Uri("http://www.facebook.com/feeds/page.php?format=rss20&id=40796308305");
    
    // including user agent, otherwise FB rejects the request
    var _Client = new HttpClient();
    _Client.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)");
    
    // fetch as string to avoid error
    var _Response = await _Client.GetAsync(_Uri);
    var _String = await _Response.Content.ReadAsStringAsync();
    
    // convert to xml (will validate, too)
    var _XmlDocument = new Windows.Data.Xml.Dom.XmlDocument();
    _XmlDocument.LoadXml(_String);
    
    // manually fill feed from xml
    var _Feed = new Windows.Web.Syndication.SyndicationFeed();
    _Feed.LoadFromXml(_XmlDocument);
    
    // continue as usual...
    foreach (var item in _Feed.Items)
    {
        // do something
    }
    

    Best of luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing a windows 8 application using XAML and C#. I developed
I am developing an application for Windows 8 Metro using Javascript (WinJS). Let's say
I'm currently developing a application where I will have multiple windows open using C#
I am currently developing an application in C# using Windows Forms. I am using
Currently I am developing a windows form application in c# that has several forms.
We are currently developing a Windows Forms application in VS 2008 C#. This application
I am currently developing an application for Windows CE on the TI OMAP processor,
Currently developing an application using the newest version of symfony, obtained through PEAR. This
Im currently developing an In-House Enterprise application. I will publish the app using Apple
I am currently developing a C# Windows Form Application. After the user has login

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.