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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-17 我要评论
想了解c#中带头(声明)的xml(封装)生成的相关内容吗,在本文为您仔细讲解c# xml生成的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点: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 = 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();

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们