关于C#读取xml(带有命名空间)的节点。谢谢
答案:1 悬赏:10
解决时间 2021-04-22 19:40
- 提问者网友:单纯说谎家
- 2021-04-22 08:56
CS从入门到精通 候捷 58.3 CS从入门到精通 候捷 58.3 C#入门帮助 高手 158.3 C#入门帮助 高手 158.3 1000284140245 粤S22592 普货 3
最佳答案
- 二级知识专家网友:放肆的依賴
- 2021-04-22 10:10
这是我修改config文件节点的代码,和读节点一样
string filepath=AppDomain.CurrentDomain.BaseDirectory + "app.config";
// filepath = filepath.Replace("bin\\Debug\\", "");
// System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
// xmldoc.Load(filepath);
// foreach (System.Xml.XmlNode xnode in xmldoc["configuration"]["appSettings"])
// {
// if (xnode.Name == "add")
// {
// if (xnode.Attributes.GetNamedItem("key").Value == "path")
// {
// xnode.Attributes.GetNamedItem("value").Value = this.tbxPath.Text.Trim();
// }
// }
// }
string filepath=AppDomain.CurrentDomain.BaseDirectory + "app.config";
// filepath = filepath.Replace("bin\\Debug\\", "");
// System.Xml.XmlDocument xmldoc = new System.Xml.XmlDocument();
// xmldoc.Load(filepath);
// foreach (System.Xml.XmlNode xnode in xmldoc["configuration"]["appSettings"])
// {
// if (xnode.Name == "add")
// {
// if (xnode.Attributes.GetNamedItem("key").Value == "path")
// {
// xnode.Attributes.GetNamedItem("value").Value = this.tbxPath.Text.Trim();
// }
// }
// }
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯