Reputation: 5791
I can't understand where problem is, despite the fact, that this code pretty easy.
I have such function:
public void WriteToDoc(string path)
{
XDocument doc = new XDocument (new XElement("General parameters",
new XElement("num_path", num_path.Text),
new XElement("Gen_Peroid", Gen_Peroid.Text),
new XElement("Alg_Perioad", Alg_Perioad.Text)
)
);
doc.Save(path);
}
num_path.Text
, Gen_Peroid.Text
and Alg_Perioad.Text
are string
.
This is how I use this function:
File.Create(@"C:\ProgramData\RadiolocationQ\Q.xml");
WriteToDoc(@"C:\ProgramData\RadiolocationQ\Q.xml");
Upvotes: 0
Views: 59
Reputation: 5689
Xml Elements cannot contain spaces. Fix your XML to conform to the standard
http://www.w3schools.com/xml/xml_elements.asp
Upvotes: 4