I'm trying to find out how to add a child to a xml file that looks like this test test I want to add node that adds a New User. That is inside the The Users node and doesn't overrite the data allready thier. Meaning thier whould be to User childs both with
the Name and Pass childern inside that child. I tryed this way but got an error Saying that Element is already there. XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(Server.MapPath("userlist.xml")); XmlElement Node = xmldoc.CreateElement("User"); Node.InnerText="";
xmldoc.AppendChild(Node); XmlElement Child1 = xmldoc.CreateElement("Name"); XmlElement Child2 = xmldoc.CreateElement("Pass"); Child1.InnerText= "Newname"; Child2.InnerText= "Newpass"; Node.AppendChild(Child1); Node.AppendChild(Child2); xmldoc.Save(Server.MapPath("userlist.xml"));
Is there a method that I can call that whould slove this?
None
0 Points
2 Posts
Adding a Child to Xml with C#
Oct 22, 2003 11:02 PM|m162|LINK
None
0 Points
1 Post
Re: Adding a Child to Xml with C#
Oct 23, 2003 06:28 AM|ReSpect|LINK