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

  • SEARCH
  • Home
  • 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 8868729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:19:57+00:00 2026-06-14T17:19:57+00:00

try { rssDoc = new XmlDocument(); // Load the XML context into XmlDocument rssDoc.Load(rssReader);

  • 0
            try
            {
                rssDoc = new XmlDocument();
                // Load the XML context into XmlDocument
                rssDoc.Load(rssReader);
                MessageBox.Show(rssDoc.ToString());
            }
            catch (Exception ex)
            {
               errorProvider1.SetError(url, "Cannot load the RSS from this url");
            }
            // Loop for <rss> tag in xmldocument
            for (int i = 0; i < rssDoc.ChildNodes.Count; i++)
            {
                // If <rss> tag found
                if (rssDoc.ChildNodes[i].Name == "rss")
                {
                    // assign the <rss> tag node to nodeRSS
                    nodeRss = rssDoc.ChildNodes[i];
                }
            }
            //Loop for the <channel> tag in side <rss> tag stored in nodeRss
            for (int i = 0; i < nodeRss.ChildNodes.Count; i++)  <<<<<<EXCEPTION
            {
                // <channel> node found
                if (nodeRss.ChildNodes[i].Name == "channel")
                {
                    //assign the <channel> tag to nodeChannel 
                    nodeChannel = nodeRss.ChildNodes[i];
                }
            }

Above code is working fine for most of the rss feeds but I am getting a nullrefrence exception while going through the last loop.
What should i do to make it work?

  • 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-14T17:19:58+00:00Added an answer on June 14, 2026 at 5:19 pm

    Why reinvent the wheel?

    XmlNode nodeChannel = rssDoc.SelectSingleNode("/rss/channel");
    

    …should do the trick. (I’m pretty sure RSS only allows a single channel element inside the root rss element. Otherwise, look at SelectNodes() rather than SelectSingleNode().)

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

Sidebar

Related Questions

try { // Do stuff } catch (Exception e) { throw; } finally {
Try to read xml data into a variable to put it out in an
Try to save them like this: HttpCookie latcook = new HttpCookie(latitude, lat.Value.ToString()); HttpCookie lngcook
try{ Process process; process = Runtime.getRuntime().exec(command); BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); } catch
try: recursive_function() except RuntimeError e: # is this a max. recursion depth exceeded exception?
try { JSONArray jArray = new JSONArray(result); for(int i=0;i<jArray.length();i++) { JSONObject json_data = jArray.getJSONObject(i);
try { $friends = $facebook->api('/me/friends'); } catch (FacebookApiException $e) { error_log($e); } Shows :Fatal
Try to see which cast is faster (not necessary better): new c++ case or
Try this: Make a new XCode4 Applescript project. In the delegate, paste this code:
try { } catch() {} finally { try { } catch() { } finally

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.