473,230 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

C# RSS feed generator & building the guid element

2
Windows XP Pro
VS 2005 & C# (I'm fairly new to C# but have doing VB.Net going on 2yrs and VB6 for 5yrs.)

I'm using C# to build a custom RSS generator. I'm having trouble building the guid element for each item node in my feed. Some items do not have the "link" node because the description element is the content. So using the "link" as the guid will not work in my case, as some sites suggest and as feedvalidator.org complains when I do not have one. Plus the content may change so I'm attempting to set the isPermaLink attribute to false to instruct the RSS readers/subscribers not to use this field; it's just there for uniqueness.

Here is what I need:
<guid isPermaLink="false">69DA.....383D26EAF0</guid>

I have tried building a "guid" object but when its serialized it takes each property and makes them attributes of the guid element. Like this:
<guid guid="69DA......383D26EAF0" isPermaLink="false" />
Which is represented by the code snippet below.
Here's my "guid" element:
Expand|Select|Wrap|Line Numbers
  1. [XmlElement("guid")]
  2. public guidAttributes Guid
  3.  get    { return _guid;     }
  4.  set    { _guid = value; }
  5. }
  6.  
Here is my guidAttributes class:
Expand|Select|Wrap|Line Numbers
  1. public class guidAttributes
  2. {
  3.  private string _guid;
  4.  private bool _isPermaLink;
  5.  
  6.  [XmlAttribute("guid")]
  7.  public string Guid
  8.  {
  9.   get {  return _guid; }
  10.   set { _guid = value; }
  11.  }
  12.  
  13.  [XmlAttribute("isPermaLink")]
  14.  public bool isPermaLink
  15.  {
  16.   get {  return _isPermaLink; }
  17.   set { _isPermaLink = value; }
  18.  }
  19. }
  20.  
Changing the "guid" property above from Attribute to element like this:
Expand|Select|Wrap|Line Numbers
  1. [XmlElement("guid")]
  2.  public string Guid
  3.  
Produces this output:
<guid isPermaLink="false">
<guid>69DA.....383D26EAF0</guid>
</guid>

I'm close but not there and just need a bit of help to put all the pieces together.

Any help is greatly appreciated.

Thanks,

Michael
Nov 10 '06 #1
2 15901
Troll
2
Well a co-worker helped me out. Pretty simple in retrospect. I would post the code but everyone else must know how to do it or have no need for the implementation. If you do need to see the code, let me know.

Mike
Nov 16 '06 #2
karlomanio
1 Bit
I'd like to see your solution.

Thanks,
karlomanio
Jan 14 '22 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Mr. Smith | last post by:
Hello all, My code can successfully open, write to, format and save several worksheets in a workbook then save it by a given name, close and quit excel. My problem is that if I try and do it...
1
by: Mike Logan | last post by:
I have a schema that defines my messages and objects. I then have a WSDL that defines the web services. I have my sample XSD, sample WSDL, and the code generated from WSDL.exe. In the generated...
5
by: Al | last post by:
Hi all We have created a xml file that imports a single project using the Import element. This project compiles to a class library, but has references to two other projects that are also class...
2
by: Sky | last post by:
Hello: I'm trying to make sense of snk files, when to use, under what conditions to regenerate new ones,...can someone take a look if these statemes make sense? And then the final questions at the...
4
by: Billy Barth | last post by:
I would like to create a RSS feed from my Access Database. I have an Access table for news which has the article title, date, and story in it. What I would like to do is pull the data from there...
8
by: mc | last post by:
I would like to be able to send from an ASP.NET page an email which when recieved takes the form of a "Sharing Invitation for a RSS Feed"...
5
by: Ed Flecko | last post by:
Hi folks, I'm trying to figure out this whole RSS feed thing. I've created my .xml file to use for my feed, and my browsers "recognize" that I have an RSS feed, and you can subscribe, etc., etc....
1
by: Tarik Monem | last post by:
Here's the code for the index.xml file on the blogger <?xml version="1.0" encoding="<$MTPublishCharset$>"?> <rss version="2.0"> <channel> <title><$MTBlogName remove_html="1"...
4
by: Blake Garner | last post by:
I'm looking for suggestions on how to approach generating rss feed ..xml files using python. What modules to people recommend I start with? Thanks! Blake
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.