我想编辑XML文件 [英] I want to edit xml file

查看:206
本文介绍了我想编辑XML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已修改ðxml文件的结构。我想编辑的可见价值

I have modified the structure of d xml file. i want to edit value of visible

推荐答案

您可以用这样code模式:

You can use such code pattern:

bool foobar()
    {
        XmlDocument doc = new XmlDocument();
        try
        {
            doc.Load(FileName);
            XmlNodeList ns = doc.SelectNodes("a/d/e/f");
            if (ns.Count == 1)
            {

                    ns[0].Attributes["visible"].Value = true;
                    doc.Save(FileName);
                    return (true);
            }
            else
                return (false);
        }
        catch (Exception e)
        {
            return (false);
        }
    }

这篇关于我想编辑XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆