C# TreeView读取Xml
1. Xml文本内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<xml>
<Emp id="1" p_id="">
<name>CEO</name>
</Emp>
<Emp id="2" p_id="1">
<name>CTO</name>
</Emp>
<Emp id="3" p_id="1">
<name>CFO</name>
</Emp>
<Emp id="4" p_id="2">
<name>Engineer</name>
</Emp>
</xml>
2. 效果图如下:
3. 按钮点击加载xml文件
private void button2_Click(object sender, EventArgs e)
{
XmlDocument docEmp = new XmlDocument();
docEmp.Load(&