ASP.NET 生成 RSS Feed
2008-02-22 09:38:12来源:互联网 阅读 ()
前段时间在写RSS Feed。
经过了几次的修改,把相关的代码写成了单独的类。
感觉重用时还算比较方便的。于是贴出来,大家一起研究研究。
以下是RssBase.cs类:
1using System;
2using System.Collections.Generic;
3using System.Xml;
4
5namespace MyMedia.Utilities
6{
7 public class RssBase
8 {
9 RssBase constructor#region RssBase constructor
10 public RssBase(XmlTextWriter rssWriter)
11 {
12 this.rssWriter = rssWriter;
13 }
14 public RssBase(XmlTextWriter rssWriter, bool hasMedia, IList<ItemInfo> items)
15 {
16 this.rssWriter = rssWriter;
17 this.hasMedia = hasMedia;
18 this.items = items;
19 }
20 #endregion
21
22 [Serializable]
23 public sealed class ItemInfo
24 {
25 ItemInfo constructor#region ItemInfo constructor
26 public ItemInfo() { }
27 public ItemInfo(string itemTitle, string itemLink, string itemDescription, string itemPubDate, string itemAuthor, string itemGuid)
28 {
29 this.itemTitle = itemTitle;
30 this.itemLink = itemLink;
31 this.itemDescription = itemDescription;
32 this.itemAuthor = itemAuthor;
33 this.itemGuid = itemGuid;
34 this.itemPubDate = itemPubDate;
35 }
36 public ItemInfo(string itemTitle, string itemLink, string itemDescription, string itemPubDate, string itemAuthor,
37 string itemGuid, string mediaContentUrl, string mediaTitle, string mediaDescription,
38 string mediaThumbUrl, string mediaThumbWidth, string mediaThumbHeight, string mediaAuthor)
39 {
40 this.itemTitle = itemTitle;
41 this.itemLink = itemLink;
42 this.itemDescription = itemDescription;
43 this.itemPubDate = itemPubDate;
44 this.itemAuthor = itemAuthor;
45 this.itemGuid = itemGuid;
46 this.mediaContentUrl = mediaContentUrl;
47 this.mediaTitle = mediaTitle;
48 this.mediaDescription = mediaDescription;
49 this.mediaThumbUrl = mediaThumbUrl;
50 this.mediaThumbWidth = mediaThumbWidth;
51 this.mediaThumbHeight = mediaThumbHeight;
52 this.mediaAuthor = mediaAuthor;
53 }
54 #endregion
55
56 Internal item variables#region Internal item variables
57 // Item variables
58 private string itemTitle;
59 private string itemLink;
60 private string itemDescription;
61 private string itemPubDate = DateTime.Now.ToString("r");
62 private string itemDateTaken = DateTime.Now.ToString();
63 private string itemAuthor;
64 private string itemGuid;
65 // Media variables
66 private string mediaContentUrl;
67 private string mediaTitle;
68 private string mediaDescription;
69 private string mediaThumbUrl;
70 private string mediaThumbWidth;
71 private string mediaThumbHeight;
72 private string mediaAuthor;
73 #endregion
74
75 Item properties#region Item properties
76 public string ItemTitle
77 {
78 set { itemTitle = value; }
79 get { return itemTitle; }
80 }
81 public string ItemLink
82 {
83 set { itemLink = value; }
84 get { return itemLink; }
85 }
86 public string ItemDescription
87 {
88 set { itemDescription = value; }
89 get { return itemDescription; }
90 }
91 public string ItemPubDate
92 {
93 set { itemPubDate = value; }
94 get { return itemPubDate; }
95 }
96 public string ItemDateTaken
97 {
98 set { itemDateTaken = value; }
99 get { return itemDateTaken; }
100 }
101 public string ItemAuthor
102 {
103 set { itemAuthor = value; }
104 get { return itemAuthor; }
105 }
106 public string ItemGuid
107 {
108 set { itemGuid = value; }
109 get { return itemGuid; }
110 }
111 public string MediaContentUrl
112 {
113 set { mediaContentUrl = value; }
114 get { return mediaContentUrl; }
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:ASP.NET页面事件
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash