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中。
<?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中。
使用xpath来查找.
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;
<TreeType Name="FacilitySelect" Title="设备选择" />
<TreeType Name="FacilityManager" Title="设备选择" />楼上的正解。还可以把xml反序列化成对象,更好用...
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;
<TreeType Name="FacilityManager" Title="设备选择1" />TreeType两个不能同名的吗?