Hi,
I am trying to add info to an xml file using this code, but nothing happens!
XmlDocument doc = new XmlDocument();
doc.Load("c:\\program files\\survey maker\\projects\\xml\\new.xml");
XPathNavigator navigator = doc.CreateNavigator();
navigator.MoveToChild("Survey","");
navigator.MoveToChild("Question", "");
navigator.AppendChild("<Question>" + AddtxtBox1.Text + "</Question>");
navigator.CreateAttribute("", "type", "", AddcomboBox1.Text);
navigator.MoveToParent();
here is the orginal xml file:
<?xml version="1.0" encoding="utf-8"?>
<Survey>
<Question type="Field">How old are you?</Question>
</Survey>
AddtxtBox1 and AddcomboBox1 are found on the form.
I want the resulting xml file to look like this:
<?xml version="1.0" encoding="utf-8"?>
<Survey>
<Question type="Field">How old are you?</Question>
<Question type="something">This is a new question</Question>
</Survey>
thanks a lot.