用DataSet.ReadXML来读取这个文件

解决方案 »

  1.   

    1、Dataset.ReadXML()
    2、XmlDocument
      

  2.   

    装载到数据集里,然后从datatable里取值
    DataSet ds=new DataSet();
    StreamReader sr=new StreamReader(Application.StartupPath+"\\tt.xml",Encoding.GetEncoding("gb2312"));
    ds.ReadXml(sr,XmlReadMode.Auto);
      

  3.   

    能写得清楚点详细点吗?因为我没用过Dataset.ReadXML(),不知道怎么用~~谢谢啦
      

  4.   

    或者用XmlDocument来Select也可以
      

  5.   

    XmlDocument类, SelectSingleNode()方法
      

  6.   

    http://blog.csdn.net/lizanhong/archive/2004/06/23/24374.aspx
      

  7.   

    http://blog.csdn.net/lizanhong/archive/2004/06/23/24374.aspx
      

  8.   

    XmlDocument doc=new XmlDocument();
    doc.Load(@"e:\123.xml");XmlNode node=doc.SelectSingleNode("/ResourceConfig/NewSystemBranchGroup");foreach(XmlNode nodeChild in node.ChildNodes)
     Console.WriteLine(nodeChild.Attributes["Region"].Value);
      

  9.   

    这并不涉及数据库的应用,没有必要用到dataset,用xpathdocment最快
    代码段如下:
       using System;
    using System.Xml;
    using System.Xml.XPath;namespace ConsoleApplication2
    {
    class Class1
    {
    [STAThread]
    static void Main(string[] args)
    {
    XPathDocument doc=new XPathDocument("NewSystem.cfg");
    XPathNavigator nav=doc.CreateNavigator();
    XPathNodeIterator nods=nav.Select("//NewSystemBranchGroup");
    while(nods.MoveNext())
    {
    Console.Out.WriteLine(nods.Current.GetAttribute(nods.Current.LocalName,"CMB"));
    }
    }
    }
    }
      

  10.   

    Tomgus(小桥流水) is right