加入收藏 | 设为首页 | 会员中心 | 我要投稿 温州站长网 (https://www.0577zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

c#中带头(声明)的xml(封装)生成

发布时间:2021-07-22 13:59:43 所属栏目:Asp教程 来源:互联网
导读:XmlDocument downLoadFilexml = new XmlDocument(); XmlElement root = null; XmlElement kisokChild = null; //生成xml的头 XmlNode xmlnode= downLoadFilexml.CreateXmlDeclaration("1.0", "utf-8", null); downLoadFilexml.AppendChild(xmlnode); root


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();

(编辑:温州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读