74
ConvertXmlNodeToTreeNode(attribute, newTreeNode.Nodes);
1
using System;
2
using System.Windows.Forms;
3
using System.Xml;
4
public class XmlTreeDisplay : System.Windows.Forms.Form
5
{
6
private System.Windows.Forms.Button cmdLoad;
7
private System.Windows.Forms.Label lblFile;
8
private System.Windows.Forms.TextBox txtXmlFile;
9
private System.Windows.Forms.TreeView treeXml;
10
// (Bỏ qua phần mã designer.)
11
private void cmdLoad_Click(object sender, System.EventArgs e)
12
{
13
// Xóa cây.
14
treeXml.Nodes.Clear();
15
// Nạp tài liệu XML.
16
XmlDocument doc = new XmlDocument();
17
try
18
{
19
doc.Load(txtXmlFile.Text);
20
}
21
catch (Exception err)
22
{
23
MessageBox.Show(err.Message);
24
return;
Cached Result