请教xml生成treeview,
xml文件如下:
<?xml version= "1.0 " standalone= "yes "?>
<NewDataSet>
<Table>
<DEPARTMENTNAME> 全部 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 综合部 </DEPARTMENTNAME1>
<NAME> bonnie </NAME>
</Table>
<Table>
<DEPARTMENTNAME> 全部 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 综合部 </DEPARTMENTNAME1>
<NAME> jakcy </NAME>
</Table>
<Table>
<DEPARTMENTNAME> 全部 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 研究室 </DEPARTMENTNAME1>
<NAME> rose </NAME>
</Table>
<Table>
<DEPARTMENTNAME> 全部 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 宣传办 </DEPARTMENTNAME1>
<NAME> andy </NAME>
</Table>
<Table>
<DEPARTMENTNAME> 全部2 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 临时办公室 </DEPARTMENTNAME1>
<NAME> lili </NAME>
</Table>
<Table>
<DEPARTMENTNAME> 全部2 </DEPARTMENTNAME>
<DEPARTMENTNAME1> 临时办公室 </DEPARTMENTNAME1>
<NAME> john </NAME>
</Table>
</NewDataSet>
我想将这个xml文件生成treeview,样式如下:
全部
综合部
bonnie
jakcy
研究室
rose
宣传办
andy
全部2
临时办公室
lili
john
请教一下,用c#。怎么实现
------解决方案--------------------using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
public partial class Default_aspx
{
void Page_Load(object sender, EventArgs e)
{
string xmlstr = " <?xml version=\ "1.0\ "?> <root> <Note NodeName=\ "的1\ "> <Note NodeName=\ "的2\ "> <Note NodeName=\ "的3\ " /> <Note NodeName=\ "的4\ " /> </Note> <Note NodeName=\ "的5\ " /> </Note> <Note NodeName=\ "的6\ "> <Note NodeName=\ "的7\ "> <Note NodeName=\ "的8\ " /> <Note NodeName=\ "的9\ " /> </Note> <Note NodeName=\ "的10\ " /> </Note> </root> ";
IterateXml(xmlstr);
}
/*
<?xml version=\ "1.0\ "?> <root> <Note NodeName=\ "的1\ "> <Note NodeName=\ &qu