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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:48:40+00:00 2026-05-19T01:48:40+00:00

my code attempts to grab data from the RSS feed of a website. It

  • 0

my code attempts to grab data from the RSS feed of a website. It grabs the nodes fine, but when attempting to grab the data from a node with a colon, it crashes and gives the error “Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.” The code is shown below:

WebRequest request = WebRequest.Create("http://buypoe.com/external.php?type=RSS2&lastpost=true");
WebResponse response = request.GetResponse();

StringBuilder sb = new StringBuilder("");
System.IO.StreamReader rssStream = new System.IO.StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));

XmlDocument rssDoc = new XmlDocument();
rssDoc.Load(rssStream);

XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item");

for (int i = 0; i < 5; i++)
{
   XmlNode rssDetail;
   rssDetail = rssItems.Item(i).SelectSingleNode("dc:creator");

   if (rssDetail != null)
   {
      user = rssDetail.InnerText;
   }
   else
   {
      user = "";
   }
}

I understand that I need to define the namespace, but am unsure how to do this. Help would be appreciated.

  • 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-19T01:48:41+00:00Added an answer on May 19, 2026 at 1:48 am

    You have to declare the dc namespace prefix using an XmlNamespaceManager before you can use it in XPath expressions:

    XmlDocument rssDoc = new XmlDocument();
    rssDoc.Load(rssStream);
    
    XmlNamespaceManager nsmgr = new XmlNamespaceManager(rssDoc.NameTable);
    nsmgr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
    
    XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item");
    for (int i = 0; i < 5; i++) {
        XmlNode rssDetail = rssItems[i].SelectSingleNode("dc:creator", nsmgr);
        if (rssDetail != null) {
            user = rssDetail.InnerText;
        } else {
            user = "";
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have c++ code that attempts to dynamically allocate a 2d array of bytes
I have a page where I grab a value from the query string and
In attempts of 100% code coverage, I came across a situation where I need
I regularly see production code from developers (large companies and individuals) that contains code
I'm in the process of porting some code from Linux to Mac OS X.
I'm using this code to attempt to grab a table name and store it
I am using the following code to attempt to read a large file (280Mb)
Has there been any attempt and creating a formalized method for organizing CSS code?
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
Code: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Unusual Array Lengths!</title> <script type=text/javascript> var arrayList = new Array();

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.