RSS中的xml的问题

yu_shu 2005-03-13 05:31:31

系统出错的是
文本内容中发现无效字符。处理资源
'http://localhost/applet312/Rss1.aspx' 时出错。第 1 行,位置: 36
<rss version="2.0"><channel><title>
后面的就错了,为什么


public string GetRSS()
{
DataSet ds = gr.GenerateRSS();

strRSS = strRSS + "<rss version=\"2.0\">";
strRSS = strRSS + "<channel>";
strRSS = strRSS + "<title>土人制造</title>";
strRSS = strRSS + "<link>http://www.socent.com</link>";
strRSS = strRSS + "<description>土人制造</description>";
for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
strRSS = strRSS + "<item>";
strRSS = strRSS + "<title><![CDATA["+ds.Tables[0].Rows[i]["Title"]+"]]></title>";
strRSS = strRSS + "<link>http://www.socent.com/ArticleShow@"+ds.Tables[0].Rows[i]["PostID"]+".html</link> ";
strRSS = strRSS + "<description><![CDATA["+ds.Tables[0].Rows[i]["Content"]+"]]></description>";
strRSS = strRSS + "<copyright>土人制造</copyright>";
strRSS = strRSS + "<pubDate>"+Convert.ToDateTime(ds.Tables[0].Rows[i]["PostDate"].ToString()).ToString("yyyy-MM-dd HH:mm")+"</pubDate>";
strRSS = strRSS + "<comments>http://www.socent.com/CommentShow@"+ds.Tables[0].Rows[i]["PostID"]+".html</comments>";
strRSS = strRSS + "</item>";
}
strRSS = strRSS + "</channel>";
strRSS = strRSS + "</rss>";

return strRSS;
}
...全文
94 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
greennba99 2005-03-13
  • 打赏
  • 举报
回复
你在所有的"*****"(字符串)前面加上 @ 试试。

110,570

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧