C# winform XML加载Treeview
XML格式:<xml><c:xmlid="1"name="ceshi1"group="1"uecode="00001"><c:xmlid="2"name="ceshi1....
XML格式:
<xml>
<c:xml id="1" name="ceshi1" group = "1" uecode = "00001">
<c:xml id="2" name="ceshi1.1" group = "2" uecode = "0000100001">
<c:xml id="3" name="ceshi1.2" group = "2" uecode = "0000100002">
<c:xml id="4" name="ceshi1.1.1" group = "3" uecode = "00001000100001">
要详细代码,谢谢!如果答案满意可以再加分!
</xml> 展开
<xml>
<c:xml id="1" name="ceshi1" group = "1" uecode = "00001">
<c:xml id="2" name="ceshi1.1" group = "2" uecode = "0000100001">
<c:xml id="3" name="ceshi1.2" group = "2" uecode = "0000100002">
<c:xml id="4" name="ceshi1.1.1" group = "3" uecode = "00001000100001">
要详细代码,谢谢!如果答案满意可以再加分!
</xml> 展开
2个回答
展开全部
using System.XML;
public XmlDocument XmlDoc;
XmlDoc = new XmlDocument();
XmlDoc.Load(xmlfile) ; //xmlfile 为xml文件的绝对路径
XmlNode node = XmlDoc.SelectSingleNode("根节点的名称");
XmlNodeList nodelist = node.ChildNodes;
//写一个方法递归遍历子节点 就可以 了
public void Analysis(XmlNodeList xlist)
{
foreach(XmlNode node in xlist)
{
.................
Analysis("");
}
}
public XmlDocument XmlDoc;
XmlDoc = new XmlDocument();
XmlDoc.Load(xmlfile) ; //xmlfile 为xml文件的绝对路径
XmlNode node = XmlDoc.SelectSingleNode("根节点的名称");
XmlNodeList nodelist = node.ChildNodes;
//写一个方法递归遍历子节点 就可以 了
public void Analysis(XmlNodeList xlist)
{
foreach(XmlNode node in xlist)
{
.................
Analysis("");
}
}
佳达源
2024-10-28 广告
2024-10-28 广告
深圳市佳达源电子有限公司主要经营,电子产品销售:电子元器件批发:电子元器件要售:计算机软硬件及辅助设备批发:计算机软硬件及辅助设备零售;家居用品销售;家具销售;灯具销售;安防设备销售;日用百货销售;厨具卫具及日用杂品零售:日用家电零售:五金...
点击进入详情页
本回答由佳达源提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询