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);
}
}
this.trvXML.Nodes.Add(rootNode);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void AnalyseXML(XmlNode node, TreeNode tnode)
{
try
{
XmlNodeList xnlAll = node.ChildNodes;
TreeNode tn_end=new TreeNode();
TreeNode tn=new TreeNode();
string strChineseName="";
bool TagFlag=false;
bool TagFlag2=false;
foreach(XmlNode snode in xnlAll)
{
//形成PDM原始文档功能树
if(snode.NodeType==XmlNodeType.Text)
{
tn = new TreeNode(snode.Value+"["+snode.NodeType.ToString()+"]");
}
else
{
tn=new TreeNode(snode.Name+"("+snode.NodeType.ToString()+")");
}
//形成PDM原始文档功能树完毕
//填充PDM表结构功能树
if(snode.NodeType==XmlNodeType.Element&&snode.ParentNode.Name.Equals("o:Table"))
{
//获取表中文名
if(snode.Name.Equals("a:Name"))
{
strChineseName=snode.FirstChild.Value;
}
//表英文名
if(snode.Name.Equals("a:Code"))
{