XElement channel =new XElement("channel", new XElement("title", "freeflying"), new XElement("link", fixedUrl), new XElement("description","the website for dream flying freely"), new XElement("pubDate",DateTime.Now.ToString()) );
foreach (var article in Articles.GetArticles()) { XElement item =new XElement("item");
XElement title =new XElement("title", article.Title);
wholeUrl =string.Format("{0}?id={1}&catelog={2}", fixedUrl, article.ID, article.Catelog); XElement link =new XElement("link", wholeUrl);
using System; using System.Data; using System.Configuration; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Web.UI.MobileControls; using System.Collections.Generic;
///<summary> /// Summary description for Articles ///</summary> publicclass Articles { public Articles() { // // TODO: Add constructor logic here // }
publicstatic List<Article> GetArticles() { returnnew List<Article>(){ new Article(234, "blog", DateTime.Now.AddDays(-23), Freq.none, 0.8, "asp.net seo", "articles about SEO in asp.net"), new Article(267, "blog", DateTime.Now.AddDays(-245), Freq.daily, 0.6, "ado.net pro","about the dataset usage"), new Article(653, "news", DateTime.Now.AddDays(-45), Freq.daily, 1,"CLR via C#","notebook about this book") }; }
}
publicclass Article { publicint ID; publicstring Catelog; public DateTime LastMod; publicdouble Weight; public Freq Frequency; publicstring Title; publicstring Description;
public Article(int id, string catelog, DateTime lastMod, Freq frequency, double weight, string title, string description) { ID = id; Catelog = catelog; LastMod = lastMod; Weight = weight; Frequency = frequency; Title = title; Description = description; } }