Hello,
I am new with learning the possibilities of Linq to XML and I recently have found that I can query an xml like a data base (I am quite fascinated by it now).
My question is How can I query an xml file and save the result in another xml file?:
string url = "employees.xml";
XElement employees= XElement.Load(url);
if (employees.Element("employee") != null)
{
var query = from f in employees.Element("employee").Elements("item").Take(10)
select new { Name = f.Element("name").Value, Surname= f.Element("surname").Value };
foreach (var feed in query)
{
//here... I like to write the result in a different xml file, I tried the
//common
doc.save("xmlout.xml");
}
}
Thanks a lot for your help,