站长网 Asp教程 c#中带头(声明)的xml(封装)生成

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

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

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/jc/asp/2021/0722/14149.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部