Esempio n. 1
0
        public static void RSSOutput(HttpContext context, RssInfo rss)
        {
            StringBuilder sb = new StringBuilder();

            context.Response.ClearHeaders();
            context.Response.ContentType = "text/xml";
            context.Response.Charset     = "UTF-8";
            sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><rss version=\"2.0\"><channel>");
            sb.Append(string.Format("<title><![CDATA[{0}]]></title>", rss.Title));
            sb.Append(string.Format("<link><![CDATA[{0}]]></link>", rss.Link));
            sb.Append(string.Format("<description><![CDATA[{0}]]></description>", rss.Description));
            sb.Append(string.Format("<language>{0}</language>", rss.Laguage));
            sb.Append(string.Format("<pubDate>{0}</pubDate>", rss.PubDate));
            sb.Append(string.Format("<generator><![CDATA[{0}]]></generator>", rss.Generator));
            sb.Append(string.Format("", ""));
            foreach (RssItem item in rss.Items)
            {
                sb.Append("<item>");
                sb.Append(string.Format("<title><![CDATA[{0}]]></title>", item.Title));
                sb.Append(string.Format("<link><![CDATA[{0}]]></link>", item.Link));
                sb.Append(string.Format("<description><![CDATA[{0}]]></description>", item.Description));
                sb.Append(string.Format("<author><![CDATA[{0}]]></author>", item.Author));
                sb.Append(string.Format("<guid><![CDATA[{0}]]></guid>", item.Guid));
                sb.Append(string.Format("<pubDate>{0}</pubDate>", item.PubDate));
                if (!string.IsNullOrEmpty(item.Category))
                {
                    sb.Append(string.Format("<category>{0}</category>", item.Category));
                }
                sb.Append("</item>");
            }
            sb.Append("</channel></rss>");
            context.Response.Write(sb.ToString());
            context.Response.Flush();
        }
Esempio n. 2
0
 public static void RSSOutput(HttpContext context, RssInfo rss)
 {
     StringBuilder sb = new StringBuilder();
     context.Response.ClearHeaders();
     context.Response.ContentType = "text/xml";
     context.Response.Charset = "UTF-8";
     sb.Append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><rss version=\"2.0\"><channel>");
     sb.Append(string.Format("<title><![CDATA[{0}]]></title>", rss.Title));
     sb.Append(string.Format("<link><![CDATA[{0}]]></link>", rss.Link));
     sb.Append(string.Format("<description><![CDATA[{0}]]></description>", rss.Description));
     sb.Append(string.Format("<language>{0}</language>", rss.Laguage));
     sb.Append(string.Format("<pubDate>{0}</pubDate>", rss.PubDate));
     sb.Append(string.Format("<generator><![CDATA[{0}]]></generator>", rss.Generator));
     sb.Append(string.Format("", ""));
     foreach (RssItem item in rss.Items)
     {
         sb.Append("<item>");
         sb.Append(string.Format("<title><![CDATA[{0}]]></title>", item.Title));
         sb.Append(string.Format("<link><![CDATA[{0}]]></link>", item.Link));
         sb.Append(string.Format("<description><![CDATA[{0}]]></description>", item.Description));
         sb.Append(string.Format("<author><![CDATA[{0}]]></author>", item.Author));
         sb.Append(string.Format("<guid><![CDATA[{0}]]></guid>", item.Guid));
         sb.Append(string.Format("<pubDate>{0}</pubDate>", item.PubDate));
         if (!string.IsNullOrEmpty(item.Category))
             sb.Append(string.Format("<category>{0}</category>", item.Category));
         sb.Append("</item>");
     }
     sb.Append("</channel></rss>");
     context.Response.Write(sb.ToString());
     context.Response.Flush();
 }