XDocument doc = XDocument.Load(pathtoxml);
XElement templatenode = doc.Descendants("User").SingleOrDefault(p => p.Attribute("Name").Value == "templateuser");
XElement newnode = new XElement(templatenode);
newnode.Attribute("Name").Value = "newusername";
templatenode.AddAfterSelf(newnode);
doc.Save(pathtoxml);
Will create a clone of templateuser
Friday, February 10, 2012
Subscribe to:
Posts (Atom)