当我试图打开一页,上面的错误正在出现。 实际使用以下代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/xml";
Response.Write(GenerateTagCloud());
Response.End();
}
private string GenerateTagCloud()
{
SPWeb myweb = null;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
SPSite mysite1 = new SPSite(mysite.ID);
myweb = mysite1.OpenWeb();
});
myweb.AllowUnsafeUpdates = true;
SPList categories = myweb.Lists["Discussion Categories"];
SPList discussion = myweb.Lists["Team Discussion"];
System.Text.StringBuilder sp = new System.Text.StringBuilder();
//System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
sp.Append("<?xml version= 1.0 encoding= UTF-8 ?>");
sp.Append("<tags>");
foreach (SPListItem category in categories.Items)
{
string categoryname = category.Name;
categoryname = categoryname.Replace(" ", "%20");
sp.Append("<a href= " + myweb.Url + "/Pages/Home.aspx?Discussion=" + categoryname + " style= font-size: 13.5pt color= 0x7b7b7b >" + category.Name + "</a>");
}
sp.Append("</tags>");
myweb.AllowUnsafeUpdates = false;
return sp.ToString();
}
但它在产出中显示:标签的开端和 closing子的关闭;以及 如何纠正这种情况?