XML Application Help

Hey people.

I am using Xml to save and load settings from my application, and i need one help with one problem.

When i save settings, i need to be able to change the value of a node.

This is what i have done so far:


                WriteSettings.Load(MainApplication.FileLocation + "settings.xml");

                XmlNodeReader ReadSettings = new XmlNodeReader(WriteSettings);
                ReadSettings.Read();
                int current = 0;
                bool Nextcurrent = false;
                XmlNode Old = WriteSettings.ReadNode(ReadSettings);

                while (ReadSettings.Read())
                {
                    switch (ReadSettings.NodeType)
                    {
                        case XmlNodeType.EndElement:
                            //I will add something here, but i need to fix the problem below
                            break;

                        case XmlNodeType.Element:

                            //Get Account Name:
                            switch (ReadSettings.Name)
                            {


                                case "Name":
                                   
                                    XmlNode Name = WriteSettings.ReadNode(ReadSettings);
                                    //I tried this:
                                    //Old = WriteSettings.ReadNode(ReadSettings);
                                    //WriteSettings.ReplaceChild(Name, Old)
                                    //But that didn't work :(
                                   
                                    break;

 


But i need help with moving the value into the Xml File



Answer this question

XML Application Help

  • tschuler77

    Never mind.

    XPath pretty much solves the problem for me :)


  • XML Application Help