本文整理汇总了C#中System.Xml.XmlTextWriter.WriteCData方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlTextWriter.WriteCData方法的具体用法?C# System.Xml.XmlTextWriter.WriteCData怎么用?C# System.Xml.XmlTextWriter.WriteCData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlTextWriter
的用法示例。
在下文中一共展示了System.Xml.XmlTextWriter.WriteCData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "text/xml";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
int callstack_uid;
if (int.TryParse(Request.QueryString["callstack_uid"], out callstack_uid) == false)
callstack_uid = 1;
using (System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(Response.OutputStream, System.Text.Encoding.UTF8))
{
writer.WriteStartDocument();
writer.WriteStartElement("Comment");
writer.WriteAttributeString("callstack_uid", callstack_uid.ToString());
DB.ForEachCallstackComment CommentWriter = delegate(string author, string comment, DateTime created)
{
writer.WriteStartElement("Item");
writer.WriteAttributeString("author", author);
writer.WriteAttributeString("created", created.ToString());
writer.WriteCData(comment);
writer.WriteEndElement();
};
DB.LoadCallstackComment(callstack_uid, CommentWriter);
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
writer.Close();
}
}