zoukankan      html  css  js  c++  java
  • xml delete

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load("bookstore.xml");
                XmlNodeList xnl = xmlDoc.SelectSingleNode("bookstore").ChildNodes;

                foreach (XmlNode xn in xnl)
                {
                    XmlElement xe = (XmlElement)xn;
                    if (xe.GetAttribute("genre") == "fantasy")
                    {
                        xe.RemoveAttribute("genre");//删除genre属性  
                    }
                    else if (xe.GetAttribute("genre") == "update红")
                    {
                        xe.RemoveAll();//删除该节点的全部内容  
                    }
                }
                xmlDoc.Save("bookstore.xml");  

  • 相关阅读:
    vue子组件获取父组件方法
    css hack
    【Educational Codeforces Round 87 (Rated for Div. 2)】前4题
    【某次ks】20200512
    NoI Online 2反思
    RMQ&LCA
    杂谈
    高手训练矩乘T3
    0118ACM自闭赛
    网络流初步学习笔记
  • 原文地址:https://www.cnblogs.com/greencolor/p/1637765.html
Copyright © 2011-2022 走看看