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 7129639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:15:50+00:00 2026-05-28T11:15:50+00:00

I am learning MVVM & Linq to xml by converting a simple wpf RSS

  • 0

I am learning MVVM & Linq to xml by converting a simple wpf RSS app. Originally, I used XmlDataProvider to load local xml files or RSS urls. I am now using the code below which works fine loading local xml files, but throws the “FileNotFoundException” when its a url. During debugging I see the correct url address in (string RSS_URL), yet the file is not found. My initial searching led me to Webclient & HttpWebRequest, but I haven’t had any success with them. Am I on the right track? Any code or tutorial links available?

public static List<RSSItem> Load(string RSS_URL)
    {
        if (!File.Exists(RSS_URL))
        {
            throw new FileNotFoundException("Datasource file could not be found", RSS_URL);
        }

        var rssfiles = XDocument.Load(RSS_URL).Descendants("item").Select(
            x => new RSSItem(
                (string)x.Element("title"),
                (string)x.Element("link"),
                (string)x.Element("description"))); 

        return rssfiles.ToList();
    }

Thank You

  • 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-05-28T11:15:51+00:00Added an answer on May 28, 2026 at 11:15 am

    XDocument.Load() will accept URLs without any problem. The issue in your code is that you’re using File.Exists() to determine whether or not he URL is valid. File.Exists() only accepts a filesystem path, not a uri.

    Quick piece of additional info: the Load() method relies on an underlying XmlReader and a call to Create(). If the resource (the URL in this case) doesn’t exist, a WebException will be thrown indicating that the resource doesn’t exist.

    XDocument.Load info:
    http://msdn.microsoft.com/en-us/library/bb343181.aspx

    XmlReader.Create info:
    http://msdn.microsoft.com/en-us/library/w8k674bf.aspx

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

Sidebar

Related Questions

I'm learning C#/WPF/MVVM by building a simple media player. I am using ICollectionView in
As I've been learning WPF, I've been concentrating on applying only the MVVM pattern
I'm learning WPF with MVVM and for a starter, I viewed Jason Dolinger's video
I'm used to working in WPF with the MVVM design pattern, but I've recently
I'm learning WPF and MVVM and trying to stress good design. I have lots
On my journey to learning MVVM I've established some basic understanding of WPF and
I'm learning MVVM through a project and I got stuck on something simple. I
I've just started learning WPF MVVM using Prism and Unity. Decoupling the view from
I have recently started learning wpf and am trying to use mvvm. My understanding
I'm learning WPF and the MVVM Pattern and I'm trying to build a calendar-like

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.