zoukankan      html  css  js  c++  java
  • xml StreamReader

    try 
                    { 
                            using   (StreamReader   sr   =   new   StreamReader(fileurl)) 
                            { 
                                    XmlDocument   doc   =   new   XmlDocument(); 
                                    doc.Load(sr); 
    }
                                    XmlNode   root   =   doc.DocumentElement; 
                                    XmlElement   elem1   =   doc.CreateElement("name"); 
                                    elem1.InnerText   =   uname; 
                                    XmlElement   elem2   =   doc.CreateElement("logtime"); 
                                    elem2.InnerText   =   time; 
                                    XmlNode   userelem   =   doc.CreateNode(XmlNodeType.Element,   "user",   ""); 
                                    userelem.AppendChild(elem1); 
                                    userelem.AppendChild(elem2); 
                                    root.AppendChild(userelem); 
                                    doc.Save(fileurl); 
                                    doc   =   null; 
                                   
                            
                    } 
                    catch   (Exception   ex) 
                    {   } 

  • 相关阅读:
    python易混易乱(2)
    python易混易乱(1)
    #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
    关于 flask 实现数据库迁移以后 如何根据创建的模型类添加新的表?
    Linux同步互斥(Peterson算法,生产者消费者模型)
    正则表达式(Python)
    进程间通信
    CSS常见简写规则整理
    Django Model
    Django杂记
  • 原文地址:https://www.cnblogs.com/eebb/p/1166223.html
Copyright © 2011-2022 走看看