0
當我試圖在Sharepoint中打開一個頁面時出現上述錯誤。實際上我用下面的代碼:XML解析錯誤:不正確
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();
}
但在輸出它顯示爲:在& lt和& GT標籤節點的標籤打開和關閉。如何糾正這一點?
sp.Append(「);有沒有在上面的代碼中,它沒有顯示在上面的代碼 –
Abhimanyu
2010-11-24 13:25:37