Hi, I am trying to develop a program to read through this xml file 'config.xml' and I have specific portions of the file that the user can edit and save. I have been searching everywhere for some help on reading to and from and writing to and saving childnodes from user input.

This is where I last left on and it's just a bunch of random things I tried after trying to gather information. Any help I would appreciate thanks for the help in advanced.

private void button2_Click(object sender, EventArgs e)
            XmlDocument doc = new XmlDocument();
            //XPathDocument doc = new XPathDocument(config.DesktopConfig);
            XPathNavigator nav = doc.CreateNavigator();
            XmlNamespaceManager mgr = new XmlNamespaceManager(nav.NameTable);
            mgr.AddNamespace("default", config.DesktopConfig);
            XPathNodeIterator interator = nav.Select("//default:MOUSE[@SENSITIVITY]", mgr);

            while (interator.MoveNext())
                interator.Current.GetAttribute("SENSITIVITY", textBox6.Text);
            XmlDocument docc = new XmlDocument();
            XmlNodeList sensitivityfile = docc.GetElementsByTagName("SENSITIVITY");
            foreach (XmlNode node in sensitivityfile)
                XmlElement sensitivityelement = (XmlElement) node;
                string SENSITIVITY = sensitivityelement.GetElementsByTagName("SENSITIVITY")[0].InnerText;

                if (sensitivityelement.HasAttributes)
                    SENSITIVITY = sensitivityelement.Attributes["SENSITIVITY"].InnerText;
                textBox6.Text = "{0} \n" + SENSITIVITY;

         XmlDocument sDoc = new XmlDocument();
         XmlNodeList sen = sDoc.SelectNodes("/MOUSE/SENSITIVITY");
         foreach (XmlNode s in sen)
             gunz_config_editor.Mouse sensitivity = new Mouse();
             sensitivity.SENSITIVITY = s["SENSITIVITY"].InnerText;
             textBox6.Text = sensitivity.SENSITIVITY;

This is also part of the GUI that this button is for. The node I'm trying to edit is as such (this child nodes are part of two different nodes which is where I'm having some trouble):



The one that I want to edit and access is the MOUSE Sensitivity one
[IMG]http://i52.tinypic.com/292uvqc.jpg[/IMG] <-- GUI part

Edited by pilipino93: n/a

7 Years
Discussion Span
Last Post by pilipino93

Thanks fore the reply, but do you think you can do it w/o the chinese characters so I can understand everything more clearly. Thanks =P


Any help from some pros here, I'm really off in that chinese guy's post..


bump, and who removed that other guys post? I was gunna review it a bit more see what I could scrap out of it and now it's gone -,-

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.