c#中帶頭(聲明)的xml(封裝)生成
更新時間:2009年07月26日 09:52:02 作者:
c#中帶頭(聲明)的xml(封裝)生成代碼。
復(fù)制代碼 代碼如下:
XmlDocument downLoadFilexml = new XmlDocument();
XmlElement root = null;
XmlElement kisokChild = null;
//生成xml的頭
XmlNode xmlnode= downLoadFilexml.CreateXmlDeclaration("1.0", "utf-8", null);
downLoadFilexml.AppendChild(xmlnode);
root = downLoadFilexml.CreateElement("test");
root.SetAttribute("Guid",“1”);
root.SetAttribute("BuildID","0");
downLoadFilexml.AppendChild(root);
kisokChild = downLoadFilexml.CreateElement("testChild");
kisokChild.SetAttribute("Interval","111");
root.AppendChild(kisokChild);
Response.Write(downLoadFilexml.OuterXml);
Response.End();
相關(guān)文章
.NET Core 實現(xiàn)定時抓取網(wǎng)站文章并發(fā)送到郵箱
本片文章通過實例講述.NET Core 實現(xiàn)定時抓取博客園首頁文章信息并發(fā)送到郵箱這個功能,對此有興趣的朋友參考學(xué)習(xí)下。2018-02-02