XML相关
来源:互联网 发布:sql replace函数用法 编辑:程序博客网 时间:2024/06/03 17:05
创建XML以及读取XML
using System;using System.Xml.Linq;namespace CsStudy{ class Program { static void Main() { XDocument xd = new XDocument( new XDeclaration("1.0","utf-8","yes"),new XComment("注释来的"), new XProcessingInstruction("xml-stylesheet",@"href=""stories.css"" type=""text/css"""), new XElement("员工列表", new XAttribute("color", "red"), new XAttribute("size", "large"), new XElement("员工", new XElement("姓名", "张三"), new XElement("姓名", "李四")))); e.Save("e.xml"); XDocument e2 = XDocument.Load("e.xml"); Console.WriteLine(e2); Console.ReadKey(); } }}
输出:
<!--注释来的-->
<?xml-stylesheet href="stories.css" type="text/css"?>
<员工列表 color="red" size="large">
<员工>
<姓名>张三</姓名>
<姓名>李四</姓名>
</员工>
</员工列表>
0 0
- xml相关
- xml相关
- Xml相关
- XML相关
- XML相关
- xml相关
- XML相关
- XML相关标准
- XML相关资源
- XML相关技术参考
- XML相关资源
- XML相关资源
- XML相关技术
- XML 相关总结[转载]
- xml的相关知识
- XML相关资源
- xml相关的收藏
- XML Sitemap 相关问题
- LeetCode - Single Number II
- (advanced) UVA 最短路 10381 - The Rock
- Spring基于注解的缓存配置--EHCache AND OSCache
- 不明确薪资的招聘网站都是耍流氓
- php 数组的相加的异同
- XML相关
- Win8 Metro C# 调用 C++代码
- (21)ExtJS之使用VType验证
- ADS工程移植 Keil MDK 编译出现的警告和错误解决
- 国外的一些安全相关论坛收集
- java中的值传递和引用传递
- Qt WebView中出现cross domain ajax querying with jquery
- 【剑指offer】二维数组中查找_03
- CLI程序内创建全局的托管对象