Witam. Tworzę dokument Xml w poniższy sposób.
XmlElement root = doc.CreateElement("Pracownicy");
doc.AppendChild(root);
XmlElement studenci = doc.CreateElement("Pracownik");
root.AppendChild(studenci);
XmlElement name = doc.CreateElement("Imie");
name.AppendChild(doc.CreateTextNode("Jan"));
studenci.AppendChild(name);
XmlElement surname = doc.CreateElement("Nazwisko");
surname.AppendChild(doc.CreateTextNode("Kowalski"));
studenci.AppendChild(surname);
XmlElement group = doc.CreateElement("Wiek");
group.AppendChild(doc.CreateTextNode("36"));
studenci.AppendChild(group);
XmlTextWriter save = new XmlTextWriter("pracownicy.xml", null);
doc.Save(save);
Mój problem polega na tym, że nie wiem jak napisać metodę dodającą kolejne drzewa do tego dokumentu (mam na myśli kolejne osoby), niestety zawsze dokument zostaje nadpisany. Mógłby mi ktoś przedstawić jakąś prostą formułę na dodawanie tego węzła ? Będę wdzięczny. Pozdrawiam