且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Xml中删除粒子用户数据

更新时间:2023-09-29 16:10:16

XmlNodeList Nodes = xDoc.GetElementsByTagName("UserNode");
for (int i = 0; i < Nodes.Count; i++)
    {
        if (Nodes[i].Attributes["LoginID"] != null)
        {
            if (Nodes[i].Attributes["LoginID"].InnerText="2")//for example
            {
               Nodes[i].parentNode.RemoveChild(Nodes[i]);
                xDoc.Save(ccConfigPath);
            }
        }
    }