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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:45:44+00:00 2026-05-28T05:45:44+00:00

I am trying to get this to work I am using this code and

  • 0

I am trying to get this to work

I am using this code and it works fine by itself, but now I am trying to get the following element to be read: dc:creator and are not able to.

class file:

public class RSSItem

{
    XNamespace dc="http://purl.org/dc/elements/1.1/";
    public string Title { get; set; }
    public string Description { get; set; }
    public string PubDate { get; set; }
    public string Link { get; set; }
    public string strGuid { get; set; }
    public string Author { get; set; }
    public string Dc_creator { get; set; }


    // Next we’ll modify the constructor. First add a parameter list to the constructor:
    public RSSItem(string title, string description, string link, string guid, 
                   string pubDate, string (dc:creator) //<-- not working but what to use instead)
    {
        // This constructor will be used to parse the RSS xml. Add the following code to the constructor:
        Title = title;
        Description = description;
        Link = link;
        strGuid = guid;
        PubDate = pubDate; 
        Dc_creator = dc:creator; <-- not working but what to use instead

Obviously this does not work:

string (dc:creator)) in the constructor

page.cshtml:

  <div>
     @{
         XNamespace dc = XNamespace.Get("http://purl.org/dc/elements/1.1/");
         XDocument rss = XDocument.Load("http://rss.xml");
         var items = from elem in rss.Elements("rss").Elements("channel").Elements("item")
        select elem;

         foreach (var item in items)
         { 
             RSSItem rssItem = new RSSItem(
                 item.Element("title").Value,
                 item.Element("link").Value,
                 item.Element("guid").Value,
                 item.Element("description").Value,
                 //item.Element("author").Value,
                 item.Element("pubDate").Value,
                 item.Element(dc + "creator").Value
                 );
           <span class="rssStyle">
              <div>
                 <b>@rssItem.Title</b>
              </div>
    etc etc

So how do I manage to have the class constructor read the dc:creator element?

  • 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-28T05:45:45+00:00Added an answer on May 28, 2026 at 5:45 am

    Not the exact solution, but I had done this using XmlDocument. You will have to modify this according to your RssItem, I had similar object

    XmlDocument doc = new XmlDocument();
    doc.LoadXml(rss);
    //Get Channel Node
    XmlNode channelNode = doc.SelectSingleNode("rss/channel");
    if (channelNode != null) {
        //Add NameSpace
        XmlNamespaceManager nameSpace = new XmlNamespaceManager(doc.NameTable);
        nameSpace.AddNamespace("content", "http://purl.org/rss/1.0/modules/content/");
        nameSpace.AddNamespace("slash", "http://purl.org/rss/1.0/modules/slash/");
        nameSpace.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
    
        //Parse each item
        foreach (XmlNode itemNode in channelNode.SelectNodes("item")) {
            RssFeed rssItem = new RssFeed();
            rssItem.Guid = itemNode.SelectSingleNode("guid").InnerText;
            rssItem.Title = itemNode.SelectSingleNode("title").InnerText;
            rssItem.CreatedBy = itemNode.SelectSingleNode("dc:creator", nameSpace).InnerText;
            rssItem.Url = itemNode.SelectSingleNode("link").InnerText;
            rssItem.PubDate = DateTime.Parse(itemNode.SelectSingleNode("pubDate").InnerText);
            rssItem.CommentCount = itemNode.SelectSingleNode("slash:comments", nameSpace).InnerText;
            rssItem.Description = itemNode.SelectSingleNode("content:encoded", nameSpace).InnerText;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to get this code to work for hours! All I need
I'm trying to get this thing to work in IE (any version - works
I'm trying to get this simple program to work on windows, but it crashes:
I am trying to get the following piece of code to work in a
I am trying to get a telerik grid to work (paging works fine). My
Trying to get this to work, with no luck: [DataMember] public Type ParameterType {
I've spent too much time trying to get this to work on IE 7.
I've been trying to get this module to work and no matter what I've
I'm trying to get this expression to work, I'm pretty sure its not the
I am trying to get this script to work. it opens up a directry

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.