近日我在用C#将PDM中相关内容导入到TreeView的过程中,遇到一个很奇怪的问题,请各位大虾指点,谢谢!
private void ReadXml(string strFileName)
{
try
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("c:xxx.pdm");
TreeNode rootNode = new TreeNode("PDM原始文档结构");
trvXML.Nodes.Clear();
this.trv_end.Nodes.Clear();
tn_end2=new TreeNode("PDM表结构");
trv_end.Nodes.Add(tn_end2);
XmlNodeList rootList = xmlDoc.ChildNodes;
foreach(XmlNode xmlnode in rootList)
{
TreeNode tn = new TreeNode(xmlnode.Name);
if (xmlnode.HasChildNodes)
{
rootNode.Nodes.Add(tn);
AnalyseXML(xmlnode, tn);
}
}