zoukankan      html  css  js  c++  java
  • c# 读改xml

    class ServerUtils
        {
             private static ServerUtils _instance = new ServerUtils();
            public static ServerUtils getInstance()
            {
                return _instance;
            }
            XmlDocument doc = new XmlDocument();
           
            private string serverIp;
            private string typecode;
            public string getServerIp()
            {
                doc.Load("XMLFile1.xml");
                XmlNode node = doc.SelectSingleNode("tongbu/server_ip");
                serverIp = node.FirstChild.Value;
                return serverIp;
            }
            public string gettypecheck()
            {
                XmlDocument doc = new XmlDocument();
                doc.Load("XMLFile1.xml");
                XmlNode node = doc.SelectSingleNode("tongbu/type");
                typecode = node.FirstChild.Value;
                return typecode;
            }
            public void ModifServerIP(string str)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load("XMLFile1.xml");
                XmlNode node = doc.SelectSingleNode("tongbu/server_ip");
                XmlElement xe = (XmlElement)node;
                xe.InnerText = str;
                doc.Save("XMLFile1.xml");
              
            }
            public void Modiftypecode(string str)
            {
                XmlDocument doc = new XmlDocument();
                doc.Load("XMLFile1.xml");
                XmlNode node = doc.SelectSingleNode("tongbu/type");
                XmlElement xe = (XmlElement)node;
                xe.InnerText = str;
                doc.Save("XMLFile1.xml");

            }
        }

  • 相关阅读:
    javaScript 匿名函数 理解
    javaScript this理解
    javaScript原型链理解
    Django学习笔记
    python mysql应用
    华为OBS上传,与modelart添加标签--python
    pyhton 定时任务
    制作滑动验证码(未完待续)
    测试扫描支付功能
    js 易错点(未完待续)
  • 原文地址:https://www.cnblogs.com/zhenmingliu/p/2524535.html
Copyright © 2011-2022 走看看