| | |
appending xml document in C#
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Mar 2008
Posts: 13
Reputation:
Solved Threads: 0
HI,
I need to append new tags to the existing xml document.
PLease review this code ,
string txt = TextBox1.Text.ToString();
XmlDocument doc= new XmlDocument();
doc.LoadXml(txt);
XmlElement el = doc.CreateElement("property1");
el.SetAttribute("name1", "C1");
el.InnerText = "This row is being appended to the end of the document.";
doc.DocumentElement.AppendChild(el);
doc.Save(txt);
This code will be helpful to create the childnode, but iam looking for appending Root node as well as childnodes.
Please help me to extend this code for Root nodes.
Note : no need to create XmlDeclaration statement becoz it will be thr for selected xml file by default.
Appreciate your precious reply.
Thanks a lot,
Anjali...
I need to append new tags to the existing xml document.
PLease review this code ,
string txt = TextBox1.Text.ToString();
XmlDocument doc= new XmlDocument();
doc.LoadXml(txt);
XmlElement el = doc.CreateElement("property1");
el.SetAttribute("name1", "C1");
el.InnerText = "This row is being appended to the end of the document.";
doc.DocumentElement.AppendChild(el);
doc.Save(txt);
This code will be helpful to create the childnode, but iam looking for appending Root node as well as childnodes.
Please help me to extend this code for Root nodes.
Note : no need to create XmlDeclaration statement becoz it will be thr for selected xml file by default.
Appreciate your precious reply.
Thanks a lot,
Anjali...
![]() |
Similar Threads
- Script to delete or backup logs at a specific time and under specific user (Shell Scripting)
- xml appending (C#)
- Append in xml document (C#)
Other Threads in the C# Forum
- Previous Thread: Flex ??
- Next Thread: fonction on any control
| Thread Tools | Search this Thread |
.net access algorithm alignment array barchart bitmap box broadcast buttons c# c#gridviewcolumn check checkbox client combobox communication control conversion csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing elevated encryption enum event excel file focus forloop form format forms function gdi+ hospitalmanagementsystem httpwebrequest image index input install java label list listbox localization login mandelbrot math messagebox mouseclick mysql operator path photoshop picturebox pixelinversion plotting pointer post programming radians read regex remote remoting richtextbox server sleep socket sql statistics stream string stringformatting sun table text textbox thread time timer update usercontrol validation visualstudio webbrowser whileloop windows winforms wpf xml





