写入Xml的两种方式:
1.XMLDocument类,标准的Dom方式
XMLDocument document = new XMLDocument();
document.CreateElement();
xxxx.CreateAttribute();
2.XDocument类
XElement x = new xxx();
..Add();
//读取Xml
1.遍历所有节点元素,分别读取
2.根据节点名称,或者是id等等一些元素,快速获取某个节点。
1.XMLDocument类,标准的Dom方式
XMLDocument document = new XMLDocument();
document.CreateElement();
xxxx.CreateAttribute();
2.XDocument类
XElement x = new xxx();
..Add();
//读取Xml
1.遍历所有节点元素,分别读取
2.根据节点名称,或者是id等等一些元素,快速获取某个节点。
本文介绍使用XMLDocument类和XDocument类进行XML文件写入的两种常见方法,同时涵盖了通过遍历节点元素和根据特定标识符快速定位节点来读取XML文件的基本技巧。


被折叠的 条评论
为什么被折叠?



