asp.net Rss
代码
XmlWriterSettings ms = new XmlWriterSettings();
ms.Indent = true;
XmlWriter xw = XmlWriter.Create(Response.Output, ms);
xw.WriteStartDocument();
xw.WriteStartElement("rss");
xw.WriteAttributeString("version","2.0");
xw.WriteStartElement("channel");
xw.WriteElementString("title","1111");
xw.WriteElementString("link", "http://www.1111.com");
xw.WriteElementString("discription", "1111");
//////////填充的内容///////////
xw.WriteStartElement("item");
xw.WriteAttributeString("shopid","1");
xw.WriteStartElement("shopname");
xw.WriteCData("商家1");
xw.WriteEndElement();
xw.WriteStartElement("shoplink");
xw.WriteString("http://www.cqit.com.cn");
xw.WriteEndElement();
xw.WriteEndElement();
/////////////End////////////////
xw.WriteEndElement();
xw.WriteEndElement();
xw.WriteEndDocument();
xw.Flush();
xw.Close();
Response.ContentType = "text/xml";
Response.Flush();
Response.End();
ms.Indent = true;
XmlWriter xw = XmlWriter.Create(Response.Output, ms);
xw.WriteStartDocument();
xw.WriteStartElement("rss");
xw.WriteAttributeString("version","2.0");
xw.WriteStartElement("channel");
xw.WriteElementString("title","1111");
xw.WriteElementString("link", "http://www.1111.com");
xw.WriteElementString("discription", "1111");
//////////填充的内容///////////
xw.WriteStartElement("item");
xw.WriteAttributeString("shopid","1");
xw.WriteStartElement("shopname");
xw.WriteCData("商家1");
xw.WriteEndElement();
xw.WriteStartElement("shoplink");
xw.WriteString("http://www.cqit.com.cn");
xw.WriteEndElement();
xw.WriteEndElement();
/////////////End////////////////
xw.WriteEndElement();
xw.WriteEndElement();
xw.WriteEndDocument();
xw.Flush();
xw.Close();
Response.ContentType = "text/xml";
Response.Flush();
Response.End();