private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Clear();
//XmlDocument xmlDoc = new XmlDocument();
//xmlDoc.Load(strPath);
//XmlNode xn = xmlDoc.SelectSingleNode("root");
//XmlNodeList xns = xn.ChildNodes;
//foreach (XmlNode xns1 in xns)
//{
// richTextBox1.Text += xns1.Name + ":" + xns1.InnerText + "\r\n";
//}
XElement xe = XElement.Load(strPath);//加载XML文档
IEnumerable<XElement> xes = xe.Elements();
foreach (XElement xes1 in xes)
{
richTextBox1.Text += xes1.Name + ":" + xes1.Value + "\r\n";
}
}
c# 加载xml
最新推荐文章于 2024-06-14 10:41:45 发布