C#_添加xml文件
2015-09-14 17:57
639 查看
引用:System.Xml;
View Code
学习网站:http://www.bccn.net/Article/web/xml/
System.Xml.XmlDocument xml = new System.Xml.XmlDocument(); System.Xml.XmlDeclaration dec = xml.CreateXmlDeclaration("1.0", "UTF-8", null); xml.AppendChild(dec); System.Xml.XmlElement ele = xml.CreateElement("A"); xml.AppendChild(ele); System.Xml.XmlElement ele2 = xml.CreateElement("B"); System.Xml.XmlAttribute xa = xml.CreateAttribute("C"); xa.Value = "D"; ele2.Attributes.Append(xa); ele2.InnerXml= "E"; ele.AppendChild(ele2); xml.Save(Server.MapPath("~/1.xml"));
View Code
学习网站:http://www.bccn.net/Article/web/xml/
相关文章推荐
- C#_收邮件
- C#_正则表达式
- C#_IO操作
- c# yield
- C#递归批量清空TEXTBOX
- 第一次写博客,c#初学者,数组
- 关于c#动态加载程序集的一些注意事项
- 【转】C# Serializable对象序列化的作用
- Emgu入门引导——加载并显示图像(C#风格)
- C# 下实现把Array复制到ArrayList中的四种方法
- C# 将RichTextBox中内容的文档以二进制形式存
- C#异常处理的几个原则
- C# 对象销毁和垃圾回收
- C#尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
- C# Winform MDI窗体,父窗体控件覆盖子窗体的解决办法
- c#修改本地连接工具 ip地址,dns,网关,子网掩码
- C#winform修改IP,dns
- C#读取Xml中出现”&”等特殊符号
- c#对csv的读写
- C#线程访问winform窗体控件