c# 操作
在System.
(网上对这些类的记录真得很少啊 可能因为类比较多吧 msdn的介绍)
创建一个新的
new //在
"", "");
//创建根节点
"root");
root.InnerText = "我是根节点";
@"D:\My Documents\Visual Studio 2010\Projects\WebApplication2\WebApplication2\test.");
生成的
<??>
<root>我是根节点</root>
另外一种创建创建
new "<?" +
"<root>我是根节点</root>"
);
@"D:\My Documents\Visual Studio 2010\Projects\WebApplication2\WebApplication2\test.");
读取
<??>
<root id="root">
<list num="0">
<name type="string">minglecun</name>
<age type="number">55</age>
</list>
<list num="1">
<name type="string">huluwa</name>
<age type="number">1</age>
</list>
</root>
new @"D:\My Documents\Visual Studio 2010\Projects\WebApplication2\WebApplication2\test.");
//读某个节点
"//root");
Console.WriteLine( Console.WriteLine("------------------------------------------------");
"//root//list");
Console.WriteLine( Console.WriteLine("------------------------------------------------");
//
"//root").ChildNodes;
foreach (in xn0)
{
Console.WriteLine("========"+node.Name);
}
原标题:c# 操作 xml
关键词:C#