xml 文件
<?xml version="1.0" encoding="utf-8" ?> 
<FacilityTreeConfiguration type="YYKJ.FacilityTree.FacilityTreeScript.Configuration.ConfigurationManage,  Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<FacilityTreeSettings>
<TreeTypes>
<TreeType Name="FacilitySelect" Title="设备选择">
                <TreeType Name="FacilityManager" Title="设备选择">
</TreeTypes>
    </FacilityTreeSettings>    
</FacilityTreeConfiguration>如何读取TreeTypes 下的设备选择、设备选择两个节点
放到CheckedListBox中。

解决方案 »

  1.   

    var nodes=myXmlDom.selectSingleNode("FacilityTreeConfiguration/FacilityTreeSettings/TreeTypes");
    使用xpath来查找.
      

  2.   

    读取2个设备选择?try:XmlDocument doc = new XmlDocument();
    doc.Load(@"1.xml");
    XmlNodeList nodes = doc.SelectNodes("//TreeType");
    ArrayList al = new ArrayList();
    foreach(XmlNode node in nodes)
    {
       al.add(node.Attributes["Title"].Value);
    }CheckedListBox1.DataSource = al;
      

  3.   

    有错误哦~~
    <TreeType Name="FacilitySelect" Title="设备选择" />
    <TreeType Name="FacilityManager" Title="设备选择" />楼上的正解。还可以把xml反序列化成对象,更好用...
      

  4.   

    XmlDocument doc = new XmlDocument();
    doc.Load(@"1.xml");
    XmlNodeList nodes = doc.SelectNodes("//TreeType");
    ArrayList al = new ArrayList();
    foreach(XmlNode node in nodes)
    {
       al.add(node.Attributes["Title"].Value);
    }CheckedListBox1.DataSource = al;
      

  5.   

    行“6”上的“TreeType”开始标记与文件“file:///D:/QADP平台实用化开发项目/C代码/YYKJ.FacilityTree/YYKJ.FacilityTree.FacilityTreeDataModel/FacilityTreeDefines/FacilityTreeConfiguration.xml”中的结束标记“TreeTypes”不匹配。 行 7,位置 4。"<TreeType Name="FacilitySelect" Title="设备选择" />
    <TreeType Name="FacilityManager" Title="设备选择1" />TreeType两个不能同名的吗?