XmlDocument doc = new XmlDocument();
doc.LoadXml("xml格式字符串");
然后操作doc 你的xml数据都在doc里面
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("加载你的XML文件");
foreach (XmlNode node in xmlDoc.SelectNodes("//CLASS_VALUE"))
{ //遍历每个CLASS_VALUE节点
string strID = node.Attributes["id"].Value;
string strName = node.Attributes["name"].Value;
}
using System;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
namespace RegexTest
{
public class RegexTest
{
public void Test()
{
string input = @"
-
-
-
-
-
-
-
-
-
-
-
-
-
";
string pattern = @"id="(?
RegexOptions options = RegexOptions.None | RegexOptions.IgnoreCase | RegexOptions.Singleline;
Regex regex = new Regex(pattern, options);
MatchCollection matches = regex.Matches(input);
foreach (Match match in matches)
{
Console.WriteLine(match.Groups["id"].value + "\t" + match.Groups["name"].value );
}
}
}
}